Update of /cvsroot/monetdb/sql/src/test/BugDay_2005-10-06_2.8/Tests
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9197
Modified Files:
Tag: SQL_2-20
MapiClient-dump.SF-905851.SQL.py
Log Message:
Significantly simplified the test.
Don't use indirection in the command given to subprocess.Popen: it has
its own, portable method of doing indirection.
Use os.path.join() to create path names for files: it uses the
system's path separators.
Don't catch the output of the subcommand in pipes if the *only* thing
we do is echo the output to our own stdout/stderr. May as well let
the system do that. Also, this makes that a potential deadlock can't
occur: by reading first the stdout completely and then stderr, it may
be that reading stdout hangs because the subprocess produced too much
on stderr to fill the pipe and thus hang. (If you do need to do
something with stdout or stderr, use the communicate() method which
makes sure no deadlock occurs.)
Wait for the subprocess to terminate. (If you use communicate, it
also waits.)
Index: MapiClient-dump.SF-905851.SQL.py
===================================================================
RCS file:
/cvsroot/monetdb/sql/src/test/BugDay_2005-10-06_2.8/Tests/MapiClient-dump.SF-905851.SQL.py,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -d -r1.1.2.5 -r1.1.2.6
--- MapiClient-dump.SF-905851.SQL.py 24 Oct 2007 15:41:38 -0000 1.1.2.5
+++ MapiClient-dump.SF-905851.SQL.py 25 Oct 2007 09:36:31 -0000 1.1.2.6
@@ -6,21 +6,24 @@
import MonetDB.subprocess26 as subprocess
-def client(cmd):
- clt = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
- sys.stdout.write(clt.stdout.read())
- clt.stdout.close()
- sys.stderr.write(clt.stderr.read())
- clt.stderr.close()
-
+def client(cmd, infile = None):
+ if infile is not None:
+ f = open(infile)
+ else:
+ f = None
+ clt = subprocess.Popen(cmd, shell=True, stdin = f)
+ if f is not None:
+ f.close()
+ clt.wait()
def main():
- clcmd = 'Mlog -x %s < %s/JdbcClient_create_tables.sql' %
(os.getenv('SQL_CLIENT'), os.getenv('RELSRCDIR'))
- clcmd1 = 'Mlog -x %s < %s/JdbcClient_inserts_selects.sql' %
(os.getenv('SQL_CLIENT'), os.getenv('RELSRCDIR'))
- clcmd2 = 'Mlog -x %s' % os.getenv('SQL_DUMP')
- client(clcmd)
- client(clcmd1)
- client(clcmd2)
+ client('Mlog -x %s' % os.getenv('SQL_CLIENT'),
+ os.path.join(os.getenv('RELSRCDIR'),
+ 'JdbcClient_create_tables.sql'))
+ client('Mlog -x %s' % os.getenv('SQL_CLIENT'),
+ os.path.join(os.getenv('RELSRCDIR'),
+ 'JdbcClient_inserts_selects.sql'))
+ client('Mlog -x %s' % os.getenv('SQL_DUMP'))
main()
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins