Update of /cvsroot/monetdb/pathfinder/tests/BugTracker/Tests
In directory 
23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21068/tests/BugTracker/Tests

Modified Files:
      Tag: Nov2009
        hang_non_existing_doc.SF-1911209.XQUERY.py 
        port_busy.SF-1809586.py stream-document.SF-2804823.XQUERY.py 
        update-with-timing.SF-2852928.XQUERY.py 
Log Message:
New module MonetDBtesting.process to make it easier to write tests in Python.

U stream-document.SF-2804823.XQUERY.py
Index: stream-document.SF-2804823.XQUERY.py
===================================================================
RCS file: 
/cvsroot/monetdb/pathfinder/tests/BugTracker/Tests/stream-document.SF-2804823.XQUERY.py,v
retrieving revision 1.4.4.1
retrieving revision 1.4.4.2
diff -u -d -r1.4.4.1 -r1.4.4.2
--- stream-document.SF-2804823.XQUERY.py        12 Oct 2009 15:36:09 -0000      
1.4.4.1
+++ stream-document.SF-2804823.XQUERY.py        15 Oct 2009 15:51:41 -0000      
1.4.4.2
@@ -1,21 +1,20 @@
 import os, sys
-import subprocess
+from MonetDBtesting import process
 
-def client(cmd, input = None):
-    clt = subprocess.Popen(cmd,
-                           stdin = subprocess.PIPE,
-                           stdout = subprocess.PIPE,
-                           stderr = subprocess.PIPE,
-                           universal_newlines = True)
+def client(lang, args, input = None):
+    clt = process.client(lang, args,
+                         stdin = process.PIPE,
+                         stdout = process.PIPE,
+                         stderr = process.PIPE)
     out, err = clt.communicate(input)
     sys.stdout.write(out)
     sys.stderr.write(err)
 
 def main():
-    xq_client = os.getenv('XQUERY_CLIENT').split()
-    client(xq_client + ['--input=my-document', '--collection=my-collection'],
+    client('xquery', ['--input=my-document', '--collection=my-collection'],
            '<document>test document</document>')
-    client(xq_client + ['-s', 'for $doc in pf:documents() where $doc/@url = 
"my-document" return $doc'])
-    client(xq_client + ['-s', 'pf:del-doc("my-document")'])
+    client('xquery',
+           ['-s', 'for $doc in pf:documents() where $doc/@url = "my-document" 
return $doc'])
+    client('xquery', ['-s', 'pf:del-doc("my-document")'])
 
 main()

U hang_non_existing_doc.SF-1911209.XQUERY.py
Index: hang_non_existing_doc.SF-1911209.XQUERY.py
===================================================================
RCS file: 
/cvsroot/monetdb/pathfinder/tests/BugTracker/Tests/hang_non_existing_doc.SF-1911209.XQUERY.py,v
retrieving revision 1.2.6.1
retrieving revision 1.2.6.2
diff -u -d -r1.2.6.1 -r1.2.6.2
--- hang_non_existing_doc.SF-1911209.XQUERY.py  12 Oct 2009 15:36:09 -0000      
1.2.6.1
+++ hang_non_existing_doc.SF-1911209.XQUERY.py  15 Oct 2009 15:51:41 -0000      
1.2.6.2
@@ -1,25 +1,24 @@
 import os, sys
-import subprocess
+from MonetDBtesting import process
 
-def client(cmd, input = None):
-    clt = subprocess.Popen(cmd,
-                           stdin = subprocess.PIPE,
-                           stdout = subprocess.PIPE,
-                           stderr = subprocess.PIPE,
-                           universal_newlines = True)
+def client(lang, args, input = None):
+    clt = process.client(lang, args = args,
+                         stdin = process.PIPE,
+                         stdout = process.PIPE,
+                         stderr = process.PIPE)
     out, err = clt.communicate(input)
     sys.stdout.write(out)
     sys.stderr.write(err)
 
 def main():
-    xq_client = os.getenv('XQUERY_CLIENT').split()
     # HACK ALERT: create updatable document by appending ,10 to collection name
-    client(xq_client + ['--input=doc1911209.xml', 
'--collection=doc1911209.xml,10'],
+    client('xquery',
+           ['--input=doc1911209.xml', '--collection=doc1911209.xml,10'],
            '<aap/>')
-    client(xq_client + ['-s', 'do insert <beer/> into 
doc("doc1911209.xml")/aap'])
+    client('xquery', ['-s', 'do insert <beer/> into 
doc("doc1911209.xml")/aap'])
     for i in range(1000):
-        client(xq_client + ['-s', 'pf:documents()'])
-        client(xq_client + ['-s', 'doc("does_not_exist.xml")'])
-    client(xq_client + ['-s', 'pf:del-doc("doc1911209.xml")'])
+        client('xquery', ['-s', 'pf:documents()'])
+        client('xquery', ['-s', 'doc("does_not_exist.xml")'])
+    client('xquery', ['-s', 'pf:del-doc("doc1911209.xml")'])
 
 main()

U port_busy.SF-1809586.py
Index: port_busy.SF-1809586.py
===================================================================
RCS file: 
/cvsroot/monetdb/pathfinder/tests/BugTracker/Tests/port_busy.SF-1809586.py,v
retrieving revision 1.2.6.1
retrieving revision 1.2.6.2
diff -u -d -r1.2.6.1 -r1.2.6.2
--- port_busy.SF-1809586.py     12 Oct 2009 15:36:09 -0000      1.2.6.1
+++ port_busy.SF-1809586.py     15 Oct 2009 15:51:41 -0000      1.2.6.2
@@ -1,14 +1,12 @@
 import os, sys, socket
-import subprocess
+from MonetDBtesting import process
 
-def prog(cmd, input = None):
-    clt = subprocess.Popen(cmd,
-                           stdin = subprocess.PIPE,
-                           stdout = subprocess.PIPE,
-                           stderr = subprocess.PIPE,
-                           universal_newlines = True,
-                           shell = type(cmd) == type(''))
-    out, err = clt.communicate(input)
+def prog(dbinit, input):
+    srv = process.server('mil', dbinit = dbinit,
+                        stdin = process.PIPE,
+                        stdout = process.PIPE,
+                        stderr = process.PIPE)
+    out, err = srv.communicate(input)
     sys.stdout.write(out)
     sys.stderr.write(err)
 
@@ -16,27 +14,19 @@
     mserver = os.getenv('MSERVER')
 
     # test mapi and pathfinder modules with MAPIPORT busy
-    port = os.getenv('MAPIPORT')
-    if port:
-        port = int(port)
-    else:
-        port = 50001
+    port = int(os.getenv('MAPIPORT', '50000'))
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     s.bind(('', port))
-    prog(mserver + ' "--dbinit=module(mapi);"', 'print(1);\n')
-    prog(mserver + ' "--dbinit=module(pathfinder);"', 'print(1);\n')
+    prog('module(mapi);', 'print(1);\n')
+    prog('module(pathfinder);', 'print(1);\n')
     s.close()
 
     # test mapi and pathfinder modules with XRPCPORT busy
-    port = os.getenv('XRPCPORT')
-    if port:
-        port = int(port)
-    else:
-        port = 50001
+    port = int(os.getenv('XRPCPORT', '50001'))
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     s.bind(('', port))
-    prog(mserver + ' "--dbinit=module(mapi);"', 'print(1);\n')
-    prog(mserver + ' "--dbinit=module(pathfinder);"', 'print(1);\n')
+    prog('module(mapi);', 'print(1);\n')
+    prog('module(pathfinder);', 'print(1);\n')
     s.close()
 
 main()

U update-with-timing.SF-2852928.XQUERY.py
Index: update-with-timing.SF-2852928.XQUERY.py
===================================================================
RCS file: 
/cvsroot/monetdb/pathfinder/tests/BugTracker/Tests/update-with-timing.SF-2852928.XQUERY.py,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -u -d -r1.2.4.1 -r1.2.4.2
--- update-with-timing.SF-2852928.XQUERY.py     12 Oct 2009 15:36:09 -0000      
1.2.4.1
+++ update-with-timing.SF-2852928.XQUERY.py     15 Oct 2009 15:51:41 -0000      
1.2.4.2
@@ -1,12 +1,11 @@
 import os, sys
-import subprocess
+from MonetDBtesting import process
 
-def client(cmd, input = None):
-    clt = subprocess.Popen(cmd,
-                           stdin = subprocess.PIPE,
-                           stdout = subprocess.PIPE,
-                           stderr = subprocess.PIPE,
-                           universal_newlines = True)
+def client(lang, args, input = None):
+    clt = process.client(lang, args,
+                         stdin = process.PIPE,
+                         stdout = process.PIPE,
+                         stderr = process.PIPE)
     out, err = clt.communicate(input)
     sys.stdout.write(out)
     sys.stderr.write(err)
@@ -22,14 +21,17 @@
 '''
 
 def main():
-    xq_client = os.getenv('XQUERY_CLIENT').split()
     # HACK ALERT: create updatable document by appending ,10 to collection name
-    client(xq_client + ['--input=hello-SF.2852928.xml', 
'--collection=hello-SF.2852928.xml,10'],
+    client('xquery',
+           ['--input=hello-SF.2852928.xml',
+            '--collection=hello-SF.2852928.xml,10'],
            hellodoc)
     sys.stdout.write('#~BeginVariableOutput~#\n')
-    client(xq_client + ['-t', '-s', 'do insert <a/> into 
doc("hello-SF.2852928.xml")/hello'])
+    client('xquery',
+           ['-t',
+            '-s', 'do insert <a/> into doc("hello-SF.2852928.xml")/hello'])
     sys.stdout.write('#~EndVariableOutput~#\n')
-    client(xq_client + ['-s', 'doc("hello-SF.2852928.xml")'])
-    client(xq_client + ['-s', 'pf:del-doc("hello-SF.2852928.xml")'])
+    client('xquery', ['-s', 'doc("hello-SF.2852928.xml")'])
+    client('xquery', ['-s', 'pf:del-doc("hello-SF.2852928.xml")'])
 
 main()


------------------------------------------------------------------------------
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-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to