Changeset: f3aee69540cb for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f3aee69540cb
Modified Files:
MonetDB4/tests/BugDay_2005-11-09_4.9.3/Tests/tcpip_close_crash.SF-1042370.py
MonetDB4/tests/BugDay_2005-11-09_4.9.3/Tests/tcpip_hangs_on_close.SF-1070569.py
pathfinder/benchmarks/Music/mod/MIL/Tests/xq2mil.py
pathfinder/benchmarks/XMark/mod/MIL/Tests/xq2mil.py
pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/file_locked_after_shredding.SF-1238352.MIL.py
pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/multiple_servers.SF-1385152.py
pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/multiple_servers_2.SF-1385152.py
pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/shredding_on_the_fly.SF-1377006.XQUERY.py
pathfinder/tests/BugTracker/Tests/mps0.py
pathfinder/tests/BugTracker/Tests/pf-O0_produces_wrong_MIL.SF-1771532.py
pathfinder/tests/BugTracker/Tests/port_busy.SF-1809586.py
pathfinder/tests/StandOff/StandOff.py
pathfinder/tests/StandOff/parser/Tests/so-good.py
python/examples/basics.py
python/examples/perf.py
python/test/runtests.py
sql/src/benchmarks/tpch/Tests/load.SQL.py
sql/src/test/BugDay_2005-10-06_2.8/Tests/MapiClient-dump.SF-905851.SQL.py
sql/src/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.SQL.py
sql/src/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.py
sql/src/test/BugTracker-2009/Tests/dumping_tables.SF-2776908.SQL.py
sql/src/test/BugTracker-2009/Tests/set_history_and_drop_table.SF-2607045.SQL.py
sql/src/test/BugTracker/Tests/auto_commit.SF-1724151.SQL.py
sql/src/test/BugTracker/Tests/connect_crash.SF-1436626.py
sql/src/test/BugTracker/Tests/local_temp_table.SF-1865953.SQL.py
sql/src/test/BugTracker/Tests/mapi_connect_errors_vanish.SF-1432134.SQL.py
sql/src/test/BugTracker/Tests/mdb_starts_with_sql_debug_64.SF-1999354.py
sql/src/test/BugTracker/Tests/set_a_new_user_password.SF-1844050.py
sql/src/test/BugTracker/Tests/set_sql_debug_64__breaking_the_DB.SF-1906287.py
sql/src/test/Connections/Tests/connections.py
sql/src/test/Dependencies/Tests/Dependencies.SQL.py
sql/src/test/Dump/Tests/dump-empty.SQL.py
sql/src/test/Dump/Tests/dump.SQL.py
sql/src/test/Dump/Tests/reload.SQL.py
sql/src/test/Skyserver/Tests/Skyserver.SQL.py
sql/src/test/Skyserver/Tests/Skyserver_v6.SQL.py
sql/src/test/Tests/like_tests.SQL.py
sql/src/test/Tests/null-byte-hang.SQL.py
sql/src/test/Tests/zones2.SQL.py
sql/src/test/Triggers/Tests/trigger_owner.SQL.py
sql/src/test/UserDump/Tests/create.SQL.py
sql/src/test/Users/Tests/role1.SQL.py
sql/src/test/Users/Tests/role2.SQL.py
sql/src/test/Users/Tests/table.SQL.py
sql/src/test/Users/Tests/unknown_user.SQL.py
sql/src/test/Views/Tests/Views.SQL.py
sql/src/test/mapi/Tests/utf8test.SQL.py
sql/src/test/mserver5-sql-readonly/Tests/mserver5-sql-readonly-table.py
sql/src/test/mserver5-sql-readonly/Tests/mserver5-sql-readonly-view.py
testing/src/process.py
Branch: Oct2010
Log Message:
Fixes to tests written in Python.
When a server is started through the process module, and its input and
output are both connected through a pipe (the usual situation), we now
wait until the server has started by sending a simple print command
and waiting for the output to appear. This is transparent to the
caller of the module.
This means that lots of small sleeps could be removed that were there
to wait for the server to start.
Catch all client and server output in pipes instead of having them
inherit stdout and stderr. In this way we're much more in control of
when and how the output is sent to the test's standard and error
outputs.
Use os.pardir instead of '..' to refer to the parent directory in
calls to os.path.join().
diffs (truncated from 1318 to 300 lines):
diff -r 8e8a69e6cd39 -r f3aee69540cb
MonetDB4/tests/BugDay_2005-11-09_4.9.3/Tests/tcpip_close_crash.SF-1042370.py
---
a/MonetDB4/tests/BugDay_2005-11-09_4.9.3/Tests/tcpip_close_crash.SF-1042370.py
Thu Sep 30 15:02:22 2010 +0200
+++
b/MonetDB4/tests/BugDay_2005-11-09_4.9.3/Tests/tcpip_close_crash.SF-1042370.py
Thu Sep 30 15:03:17 2010 +0200
@@ -1,4 +1,4 @@
-import os, time, sys
+import os, sys
from MonetDBtesting import process
def server_start(dbname):
diff -r 8e8a69e6cd39 -r f3aee69540cb
MonetDB4/tests/BugDay_2005-11-09_4.9.3/Tests/tcpip_hangs_on_close.SF-1070569.py
---
a/MonetDB4/tests/BugDay_2005-11-09_4.9.3/Tests/tcpip_hangs_on_close.SF-1070569.py
Thu Sep 30 15:02:22 2010 +0200
+++
b/MonetDB4/tests/BugDay_2005-11-09_4.9.3/Tests/tcpip_hangs_on_close.SF-1070569.py
Thu Sep 30 15:03:17 2010 +0200
@@ -1,4 +1,4 @@
-import os, time, sys
+import os, sys
from MonetDBtesting import process
def server_start(dbname):
@@ -54,7 +54,6 @@
x = 0
x += 1; srv1 = server_start("db" + str(x))
x += 1; srv2 = server_start("db" + str(x))
- time.sleep(1) # give servers time to start
srv1.stdin.write(prelude_1)
srv2.stdin.write(prelude_2)
diff -r 8e8a69e6cd39 -r f3aee69540cb
pathfinder/benchmarks/Music/mod/MIL/Tests/xq2mil.py
--- a/pathfinder/benchmarks/Music/mod/MIL/Tests/xq2mil.py Thu Sep 30
15:02:22 2010 +0200
+++ b/pathfinder/benchmarks/Music/mod/MIL/Tests/xq2mil.py Thu Sep 30
15:03:17 2010 +0200
@@ -1,4 +1,4 @@
-import os
+import os, sys
from MonetDBtesting import process
TSTSRCDIR = os.environ['TSTSRCDIR']
@@ -7,5 +7,8 @@
pf = process.pf(args = ['-M', '%s.xq' % os.path.join(TSTSRCDIR.replace(MIL,XQ),
'music')],
- stdout = open('music.mil', 'w'), log = True)
-pf.communicate()
+ stdout = open('music.mil', 'w'),
+ stderr = process.PIPE,
+ log = True)
+out, err = pf.communicate()
+sys.stderr.write(err)
diff -r 8e8a69e6cd39 -r f3aee69540cb
pathfinder/benchmarks/XMark/mod/MIL/Tests/xq2mil.py
--- a/pathfinder/benchmarks/XMark/mod/MIL/Tests/xq2mil.py Thu Sep 30
15:02:22 2010 +0200
+++ b/pathfinder/benchmarks/XMark/mod/MIL/Tests/xq2mil.py Thu Sep 30
15:03:17 2010 +0200
@@ -1,4 +1,4 @@
-import os
+import os, sys
from MonetDBtesting import process
TSTSRCDIR = os.environ['TSTSRCDIR']
@@ -7,5 +7,8 @@
pf = process.pf(args = ['-M', '%s.xq' % os.path.join(TSTSRCDIR.replace(MIL,XQ),
'xmark')],
- stdout = open('xmark.mil', 'w'), log = True)
-pf.communicate()
+ stdout = open('xmark.mil', 'w'),
+ stderr = process.PIPE,
+ log = True)
+out, err = pf.communicate()
+sys.stderr.write(err)
diff -r 8e8a69e6cd39 -r f3aee69540cb
pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/file_locked_after_shredding.SF-1238352.MIL.py
---
a/pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/file_locked_after_shredding.SF-1238352.MIL.py
Thu Sep 30 15:02:22 2010 +0200
+++
b/pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/file_locked_after_shredding.SF-1238352.MIL.py
Thu Sep 30 15:03:17 2010 +0200
@@ -1,20 +1,19 @@
-import os
+import os, sys
from MonetDBtesting import process
-def main():
- # create a temporary document
- fn = os.path.join(os.getenv('TSTTRGBASE'), 'testdoc.xml')
- f = open(fn,'w')
- f.write('<testdoc><content/></testdoc>\n')
- f.close()
- # shred it
- p = process.client('mil', stdin = process.PIPE)
- p.stdin.write('module("pathfinder");\n')
- p.stdin.write('shred_doc("%s", "testdoc.xml");\n' % fn.replace('\\',
r'\\'))
- p.communicate()
- # Here's the real test: try unlinking the source document while
- # the server is still running. If the unlink fails, we get a
- # traceback which should be caught by Mtest
- os.unlink(fn)
-
-main()
+# create a temporary document
+fn = os.path.join(os.getenv('TSTTRGBASE'), 'testdoc.xml')
+f = open(fn,'w')
+f.write('<testdoc><content/></testdoc>\n')
+f.close()
+# shred it
+p = process.client('mil', stdin = process.PIPE,
+ stdout = process.PIPE, stderr = process.PIPE)
+out, err = p.communicate('module("pathfinder");\n'
+ 'shred_doc("%s", "testdoc.xml");\n' %
fn.replace('\\', r'\\'))
+sys.stdout.write(out)
+sys.stderr.write(err)
+# Here's the real test: try unlinking the source document while
+# the server is still running. If the unlink fails, we get a
+# traceback which should be caught by Mtest
+os.unlink(fn)
diff -r 8e8a69e6cd39 -r f3aee69540cb
pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/multiple_servers.SF-1385152.py
---
a/pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/multiple_servers.SF-1385152.py
Thu Sep 30 15:02:22 2010 +0200
+++
b/pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/multiple_servers.SF-1385152.py
Thu Sep 30 15:03:17 2010 +0200
@@ -1,13 +1,14 @@
-import os, time
+import os, sys
from MonetDBtesting import process
-def main():
- srv = process.server('mil',
- dbinit =
'module(pathfinder);module(sql_server);mil_start();',
- stdin = process.PIPE)
- time.sleep(10) # give server time to start
- clt = process.client('mil', stdin = process.PIPE)
- clt.communicate()
- srv.communicate()
-
-main()
+srv = process.server('mil',
+ dbinit =
'module(pathfinder);module(sql_server);mil_start();',
+ stdin = process.PIPE,
+ stdout = process.PIPE, stderr = process.PIPE)
+clt = process.client('mil', stdout = process.PIPE, stderr = process.PIPE)
+out, err = clt.communicate()
+sys.stdout.write(out)
+sys.stderr.write(err)
+out, err = srv.communicate()
+sys.stdout.write(out)
+sys.stderr.write(err)
diff -r 8e8a69e6cd39 -r f3aee69540cb
pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/multiple_servers_2.SF-1385152.py
---
a/pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/multiple_servers_2.SF-1385152.py
Thu Sep 30 15:02:22 2010 +0200
+++
b/pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/multiple_servers_2.SF-1385152.py
Thu Sep 30 15:03:17 2010 +0200
@@ -1,4 +1,4 @@
-import os, time, sys
+import os, sys
from MonetDBtesting import process
def server_start(x,s,dbinit):
@@ -6,20 +6,25 @@
sys.stderr.write('\nserver %d%d : "%s"\n' % (x,s,dbinit))
sys.stdout.flush()
sys.stderr.flush()
- srv = process.server('mil', dbinit = dbinit, stdin = process.PIPE)
- time.sleep(5) # give server time to start
+ srv = process.server('mil', dbinit = dbinit, stdin = process.PIPE,
+ stdout = process.PIPE, stderr = process.PIPE)
return srv
def server_stop(srv):
- srv.communicate()
+ out, err = srv.communicate()
+ sys.stdout.write(out)
+ sys.stderr.write(err)
def client(x,s, c, dbinit, lang, cmd, h):
sys.stdout.write('\nserver %d%d : "%s", client %d: %s%s\n' %
(x,s,dbinit,c,h,lang))
sys.stderr.write('\nserver %d%d : "%s", client %d: %s%s\n' %
(x,s,dbinit,c,h,lang))
sys.stdout.flush()
sys.stderr.flush()
- clt = process.client(lang, stdin = process.PIPE)
- clt.communicate(cmd)
+ clt = process.client(lang, stdin = process.PIPE,
+ stdout = process.PIPE, stderr = process.PIPE)
+ out, err = clt.communicate(cmd)
+ sys.stdout.write(out)
+ sys.stderr.write(err)
return '%s(%s) ' % (h,lang)
def clients(x,dbinit):
diff -r 8e8a69e6cd39 -r f3aee69540cb
pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/shredding_on_the_fly.SF-1377006.XQUERY.py
---
a/pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/shredding_on_the_fly.SF-1377006.XQUERY.py
Thu Sep 30 15:02:22 2010 +0200
+++
b/pathfinder/tests/BugDay_2005-12-19_0.9.3/Tests/shredding_on_the_fly.SF-1377006.XQUERY.py
Thu Sep 30 15:03:17 2010 +0200
@@ -1,9 +1,9 @@
-import os
+import os, sys
from MonetDBtesting import process
-def main():
- fn = os.path.join(os.getenv('TSTSRCDIR'), 'test1377006.xml')
- p = process.client('xquery', stdin = process.PIPE)
- p.communicate('doc("%s")/x' % fn)
-
-main()
+fn = os.path.join(os.getenv('TSTSRCDIR'), 'test1377006.xml')
+p = process.client('xquery', stdin = process.PIPE, stdout = process.PIPE,
+ stderr = process.PIPE)
+out, err = p.communicate('doc("%s")/x' % fn)
+sys.stdout.write(out)
+sys.stderr.write(err)
diff -r 8e8a69e6cd39 -r f3aee69540cb pathfinder/tests/BugTracker/Tests/mps0.py
--- a/pathfinder/tests/BugTracker/Tests/mps0.py Thu Sep 30 15:02:22 2010 +0200
+++ b/pathfinder/tests/BugTracker/Tests/mps0.py Thu Sep 30 15:03:17 2010 +0200
@@ -1,10 +1,16 @@
-import os
+import os, sys
from MonetDBtesting import process
pf = process.pf(args = ['-M', '%s.xq' % os.environ['TST']],
- stdout = process.PIPE, log = True)
+ stdout = process.PIPE, stderr = process.PIPE, log = True)
srv = process.server(lang = 'xquery',
dbinit = 'module(pathfinder);
debugmask(and(debugmask(),xor(INT_MAX,8+2)));',
- stdin = pf.stdout, log = True, notrace = True)
-pf.communicate()
-srv.communicate()
+ stdin = pf.stdout,
+ stdout = process.PIPE, stderr = process.PIPE,
+ log = True, notrace = True)
+pf.stdout = None # given away
+out, err = pf.communicate()
+sys.stderr.write(err)
+out, err = srv.communicate()
+sys.stdout.write(out)
+sys.stderr.write(err)
diff -r 8e8a69e6cd39 -r f3aee69540cb
pathfinder/tests/BugTracker/Tests/pf-O0_produces_wrong_MIL.SF-1771532.py
--- a/pathfinder/tests/BugTracker/Tests/pf-O0_produces_wrong_MIL.SF-1771532.py
Thu Sep 30 15:02:22 2010 +0200
+++ b/pathfinder/tests/BugTracker/Tests/pf-O0_produces_wrong_MIL.SF-1771532.py
Thu Sep 30 15:03:17 2010 +0200
@@ -1,9 +1,14 @@
-import os
+import os, sys
from MonetDBtesting import process
pf = process.pf(args = ['-O0', '%s.xq' % os.environ['TST']],
- stdout = process.PIPE, log = True)
+ stdout = process.PIPE, stderr = process.PIPE, log = True)
srv = process.server(lang = 'xquery', stdin = pf.stdout,
+ stdout = process.PIPE, stderr = process.PIPE,
log = True, notrace = True)
-pf.communicate()
-srv.communicate()
+pf.stdout = None # given away
+out, err = pf.communicate()
+sys.stderr.write(err)
+out, err = srv.communicate()
+sys.stdout.write(out)
+sys.stderr.write(err)
diff -r 8e8a69e6cd39 -r f3aee69540cb
pathfinder/tests/BugTracker/Tests/port_busy.SF-1809586.py
--- a/pathfinder/tests/BugTracker/Tests/port_busy.SF-1809586.py Thu Sep 30
15:02:22 2010 +0200
+++ b/pathfinder/tests/BugTracker/Tests/port_busy.SF-1809586.py Thu Sep 30
15:03:17 2010 +0200
@@ -1,4 +1,4 @@
-import os, sys, socket, time
+import os, sys, socket
from MonetDBtesting import process
def prog(dbinit, input):
@@ -8,7 +8,6 @@
stdin = process.PIPE,
stdout = process.PIPE,
stderr = process.PIPE)
- time.sleep(2)
out, err = srv.communicate(input)
sys.stdout.write(out)
sys.stderr.write(err)
diff -r 8e8a69e6cd39 -r f3aee69540cb pathfinder/tests/StandOff/StandOff.py
--- a/pathfinder/tests/StandOff/StandOff.py Thu Sep 30 15:02:22 2010 +0200
+++ b/pathfinder/tests/StandOff/StandOff.py Thu Sep 30 15:03:17 2010 +0200
@@ -21,13 +21,19 @@
# 2008-2010 Eberhard Karls Universitaet Tuebingen, respectively. All
# Rights Reserved.
-import os
+import os, sys
from MonetDBtesting import process
pf = process.pf(args = ['-b', '%s.xq' % os.path.join(os.environ['TSTSRCDIR'],
os.environ['TST'])],
- stdout = process.PIPE, log = True)
+ stdout = process.PIPE, stderr = process.PIPE, log = True)
srv = process.server(lang = 'xquery', args = ['--set', 'standoff=enabled'],
- stdin = pf.stdout, log = True, notrace = True)
-pf.communicate()
-srv.communicate()
+ stdin = pf.stdout,
+ stdout = process.PIPE, stderr = process.PIPE,
+ log = True, notrace = True)
+pf.stdout = None # given away
+out, err = pf.communicate()
+sys.stderr.write(err)
+out, err = srv.communicate()
+sys.stdout.write(out)
+sys.stderr.write(err)
diff -r 8e8a69e6cd39 -r f3aee69540cb
pathfinder/tests/StandOff/parser/Tests/so-good.py
--- a/pathfinder/tests/StandOff/parser/Tests/so-good.py Thu Sep 30 15:02:22
2010 +0200
+++ b/pathfinder/tests/StandOff/parser/Tests/so-good.py Thu Sep 30 15:03:17
2010 +0200
@@ -1,8 +1,11 @@
-import os
+import os, sys
from MonetDBtesting import process
c = process.pf(args = ['-b', '-s1',
'%s.xq' % os.path.join(os.environ['TSTSRCDIR'],
- os.environ['TST'])])
-c.communicate()
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list