Update of /cvsroot/monetdb/sql/src/test/BugTracker/Tests
In directory
23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv30977/src/test/BugTracker/Tests
Modified Files:
Tag: Nov2009
set_sql_debug_64__breaking_the_DB.SF-1906287.py
Log Message:
propagated changes of Friday Oct 09 2009
from the Aug2009 branch to the Nov2009 branch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/10/09 - sjoerd:
src/test/BugTracker/Tests/set_sql_debug_64__breaking_the_DB.SF-1906287.py,1.5.8.2
Replace use of os.popen by subprocess.Popen. It seems on Windows the
former doesn't inherit stdout which causes all these tests to fail
there.
In addition, some tests used some totally bizarre constructs.
- If you create a process with a redirection from stdin (i.e. process
< file), then it makes no sense to create a pipe to that process.
- If you first replace the string port_num by some value and then to
attempt to replace the string port_num5 by another value, then the
second replace obviously has no effect.
- If one process writes output to stdout (buffered!) and then starts a
subprocess which also writes to the inherited stdout, then the
buffered output of the parent process will come at the end, not
where you might naively expect.
- "<%s" % ('%s/../some-file' % dir) can be replaced with
"<%s/../some-file" % dir (except that we should use os.path.join()
here).
Finally, cat | sed is not portable, so replaced that with a Python solution.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: set_sql_debug_64__breaking_the_DB.SF-1906287.py
===================================================================
RCS file:
/cvsroot/monetdb/sql/src/test/BugTracker/Tests/set_sql_debug_64__breaking_the_DB.SF-1906287.py,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -d -r1.6 -r1.6.2.1
--- set_sql_debug_64__breaking_the_DB.SF-1906287.py 19 Aug 2009 23:07:17
-0000 1.6
+++ set_sql_debug_64__breaking_the_DB.SF-1906287.py 9 Oct 2009 15:20:40
-0000 1.6.2.1
@@ -1,4 +1,9 @@
import os, time, sys
+try:
+ import subprocess
+except ImportError:
+ # use private copy for old Python versions
+ import MonetDBtesting.subprocess26 as subprocess
def clean_ports(cmd,mapiport,xrpcport):
cmd = cmd.replace('--port=%s' % mapiport,'--port=<mapi_port>')
@@ -12,18 +17,18 @@
srvcmd_ = clean_ports(srvcmd,str(port),os.getenv('XRPCPORT'))
sys.stderr.write('#mserver: "%s"\n' % (srvcmd))
sys.stderr.flush()
- srv = os.popen(srvcmd, 'w')
+ srv = subprocess.Popen(srvcmd, shell = True, stdin = subprocess.PIPE)
time.sleep(5) # give server time to start
return srv
def server_stop(srv):
- srv.close()
+ srv.communicate()
time.sleep(2) # give server time to stop
def client_load_file(clt, port, file):
f = open(file, 'r')
for line in f:
- clt.write(line)
+ clt.stdin.write(line)
f.close()
@@ -33,10 +38,10 @@
sys.stderr.flush()
sys.stderr.write('#client: "%s"\n' % (cltcmd))
sys.stderr.flush()
- clt = os.popen(cltcmd, 'w')
+ clt = subprocess.Popen(cltcmd, shell = True, stdin = subprocess.PIPE)
port = int(os.getenv('MAPIPORT'))
client_load_file(clt, port, file)
- clt.close()
+ clt.communicate()
return '%s ' % (lang)
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins