Update of /cvsroot/monetdb/sql/src/test/BugTracker-2009/Tests
In directory 
23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20774/src/test/BugTracker-2009/Tests

Modified Files:
      Tag: Nov2009
        create_on_ro_db_crash.SF-2830238.py 
        dumping_tables.SF-2776908.stable.out lost_update.SF-2790020.py 
        set_history_and_drop_table.SF-2607045.SQL.py 
Log Message:
New module MonetDBtesting.process to make it easier to write tests in Python.

U create_on_ro_db_crash.SF-2830238.py
Index: create_on_ro_db_crash.SF-2830238.py
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.py,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -u -d -r1.2.2.3 -r1.2.2.4
--- create_on_ro_db_crash.SF-2830238.py 15 Oct 2009 12:56:53 -0000      1.2.2.3
+++ create_on_ro_db_crash.SF-2830238.py 15 Oct 2009 15:50:49 -0000      1.2.2.4
@@ -1,15 +1,13 @@
 import sys
 import os
 import time
-import subprocess
+from MonetDBtesting import process
 
 def server():
-    s = subprocess.Popen('%s "--dbinit=include sql;" --set gdk_readonly=yes' % 
os.getenv('MSERVER'),
-                         shell = True,
-                         universal_newlines = True,
-                         stdin = subprocess.PIPE,
-                         stdout = subprocess.PIPE,
-                         stderr = subprocess.PIPE)
+    s = process.server('sql', args = ["--set", "gdk_readonly=yes"],
+                       stdin = process.PIPE,
+                       stdout = process.PIPE,
+                       stderr = process.PIPE)
     s.stdin.write('\nio.printf("\\nReady.\\n");\n')
     s.stdin.flush()
     while True:
@@ -22,14 +20,19 @@
             break
     return s
 
-def client():
-    c = subprocess.Popen("%s" % os.getenv('SQL_CLIENT'),
-                         shell = True,
-                         universal_newlines = True,
-                         stdin = subprocess.PIPE,
-                         stdout = subprocess.PIPE,
-                         stderr = subprocess.PIPE)
-    return c
+def server_stop(s):
+    out, err = s.communicate()
+    sys.stdout.write(out)
+    sys.stderr.write(err)
+
+def client(input):
+    c = process.client('sql',
+                         stdin = process.PIPE,
+                         stdout = process.PIPE,
+                         stderr = process.PIPE)
+    out, err = c.communicate(input)
+    sys.stdout.write(out)
+    sys.stderr.write(err)
 
 script1 = '''\
 create table t2 (a int);
@@ -37,13 +40,8 @@
 
 def main():
     s = server()
-    c = client()
-    o, e = c.communicate(script1)
-    sys.stdout.write(o)
-    sys.stderr.write(e)
-    o, e = s.communicate()
-    sys.stdout.write(o)
-    sys.stderr.write(e)
+    client(script1)
+    server_stop(s)
 
 if __name__ == '__main__':
     main()

U dumping_tables.SF-2776908.stable.out
Index: dumping_tables.SF-2776908.stable.out
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/test/BugTracker-2009/Tests/dumping_tables.SF-2776908.stable.out,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -d -r1.5 -r1.5.2.1
--- dumping_tables.SF-2776908.stable.out        24 Sep 2009 08:23:33 -0000      
1.5
+++ dumping_tables.SF-2776908.stable.out        15 Oct 2009 15:50:53 -0000      
1.5.2.1
@@ -34,19 +34,9 @@
 TABLE   sys.db_user_info
 TABLE   sys.dependencies
 TABLE   sys.functions
-TABLE   sys.i0
-TABLE   sys.i1
-TABLE   sys.i2
-TABLE   sys.i3
-TABLE   sys.i4
-TABLE   sys.i5
-TABLE   sys.i6
-TABLE   sys.i7
-TABLE   sys.i8
 TABLE   sys.idxs
 TABLE   sys.keycolumns
 TABLE   sys.keys
-TABLE   sys.n8
 TABLE   sys.privileges
 TABLE   sys.schemas
 TABLE   sys.sequences

U lost_update.SF-2790020.py
Index: lost_update.SF-2790020.py
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/test/BugTracker-2009/Tests/lost_update.SF-2790020.py,v
retrieving revision 1.2.4.2
retrieving revision 1.2.4.3
diff -u -d -r1.2.4.2 -r1.2.4.3
--- lost_update.SF-2790020.py   15 Oct 2009 12:57:00 -0000      1.2.4.2
+++ lost_update.SF-2790020.py   15 Oct 2009 15:50:53 -0000      1.2.4.3
@@ -1,15 +1,13 @@
 import sys
 import os
 import time
-import subprocess
+from MonetDBtesting import process
 
 def server():
-    s = subprocess.Popen("%s --dbinit='include sql;'" % os.getenv('MSERVER'),
-                         shell = True,
-                         universal_newlines = True,
-                         stdin = subprocess.PIPE,
-                         stdout = subprocess.PIPE,
-                         stderr = subprocess.PIPE)
+    s = process.server('sql',
+                       stdin = process.PIPE,
+                       stdout = process.PIPE,
+                       stderr = process.PIPE)
     s.stdin.write('\nio.printf("\\nReady.\\n");\n')
     s.stdin.flush()
     while True:
@@ -22,14 +20,19 @@
             break
     return s
 
-def client():
-    c = subprocess.Popen("%s" % os.getenv('SQL_CLIENT'),
-                         shell = True,
-                         universal_newlines = True,
-                         stdin = subprocess.PIPE,
-                         stdout = subprocess.PIPE,
-                         stderr = subprocess.PIPE)
-    return c
+def server_stop(s):
+    out, err = s.communicate()
+    sys.stdout.write(out)
+    sys.stderr.write(err)
+
+def client(input):
+    c = process.client('sql',
+                       stdin = process.PIPE,
+                       stdout = process.PIPE,
+                       stderr = process.PIPE)
+    out, err = c.communicate(input)
+    sys.stdout.write(out)
+    sys.stderr.write(err)
 
 script1 = '''\
 create table lost_update_t2 (a int);
@@ -63,41 +66,21 @@
 
 def main():
     s = server()
-    c = client()
-    o, e = c.communicate(script1)
-    sys.stdout.write(o)
-    sys.stderr.write(e)
-    o, e = s.communicate()
-    sys.stdout.write(o)
-    sys.stderr.write(e)
+    client(script1)
+    server_stop(s)
 
     s = server()
-    c = client()
-    o, e = c.communicate(script2)
-    sys.stdout.write(o)
-    sys.stderr.write(e)
+    client(script2)
     time.sleep(60)                      # wait until log is flushed
-    o, e = s.communicate()
-    sys.stdout.write(o)
-    sys.stderr.write(e)
+    server_stop(s)
 
     s = server()
-    c = client()
-    o, e = c.communicate(script3)
-    sys.stdout.write(o)
-    sys.stderr.write(e)
-    o, e = s.communicate()
-    sys.stdout.write(o)
-    sys.stderr.write(e)
+    client(script3)
+    server_stop(s)
 
     s = server()
-    c = client()
-    o, e = c.communicate(cleanup)
-    sys.stdout.write(o)
-    sys.stderr.write(e)
-    o, e = s.communicate()
-    sys.stdout.write(o)
-    sys.stderr.write(e)
+    client(cleanup)
+    server_stop(s)
 
 if __name__ == '__main__':
     main()

U set_history_and_drop_table.SF-2607045.SQL.py
Index: set_history_and_drop_table.SF-2607045.SQL.py
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/test/BugTracker-2009/Tests/set_history_and_drop_table.SF-2607045.SQL.py,v
retrieving revision 1.2.6.2
retrieving revision 1.2.6.3
diff -u -d -r1.2.6.2 -r1.2.6.3
--- set_history_and_drop_table.SF-2607045.SQL.py        12 Oct 2009 15:36:21 
-0000      1.2.6.2
+++ set_history_and_drop_table.SF-2607045.SQL.py        15 Oct 2009 15:50:54 
-0000      1.2.6.3
@@ -1,19 +1,19 @@
 import os, sys
-import subprocess
+from MonetDBtesting import process
 
 def main():
     dir = os.getenv('TSTSRCDIR')
     clcmd = str(os.getenv('SQL_CLIENT'))
     sys.stdout.write('Load history\n')
-    clt1 = subprocess.Popen(clcmd + ' "%s"' % os.path.join(dir,'..', 
'..','..','sql','history.sql'), shell = True, universal_newlines = True, stdout 
= subprocess.PIPE)
+    clt1 = process.client('sql', args = [os.path.join(dir,'..', 
'..','..','sql','history.sql')], stdout = process.PIPE)
     out, err = clt1.communicate()
     sys.stdout.write(out)
     sys.stdout.write('Run test\n')
-    clt1 = subprocess.Popen(clcmd + ' "%s"' % 
os.path.join(dir,'..','set_history_and_drop_table.SF-2607045.sql'), shell = 
True, universal_newlines = True, stdout = subprocess.PIPE)
+    clt1 = process.client('sql', args = 
[os.path.join(dir,'..','set_history_and_drop_table.SF-2607045.sql')], stdout = 
process.PIPE)
     out, err = clt1.communicate()
     sys.stdout.write(out)
     sys.stdout.write('Drop history\n')
-    clt1 = subprocess.Popen(clcmd + ' "%s"' % 
os.path.join(dir,'..','drop_history.sql'), shell = True, universal_newlines = 
True, stdout = subprocess.PIPE)
+    clt1 = process.client('sql', args = 
[os.path.join(dir,'..','drop_history.sql')], stdout = process.PIPE)
     out, err = clt1.communicate()
     sys.stdout.write(out)
 


------------------------------------------------------------------------------
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

Reply via email to