Changeset: 915cbc42e765 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=915cbc42e765
Removed Files:
        sql/test/scripts/Tests/lz4-dump.sql
Modified Files:
        sql/test/scripts/Tests/alastair_udf_mergetable_bug.py
        sql/test/scripts/Tests/alastair_udf_mergetable_bug.stable.err
        sql/test/scripts/Tests/alastair_udf_mergetable_bug.stable.out
        sql/test/scripts/Tests/copy-from-lz4.py
        sql/test/scripts/Tests/copy-from-lz4.stable.out
Branch: mtest
Log Message:

Silenced sql/test/scripts Python tests


diffs (258 lines):

diff --git a/sql/test/scripts/Tests/alastair_udf_mergetable_bug.py 
b/sql/test/scripts/Tests/alastair_udf_mergetable_bug.py
--- a/sql/test/scripts/Tests/alastair_udf_mergetable_bug.py
+++ b/sql/test/scripts/Tests/alastair_udf_mergetable_bug.py
@@ -1,40 +1,26 @@
 import sys
-import os
+
+from MonetDBtesting.sqltest import SQLTestCase
 try:
     from MonetDBtesting import process
 except ImportError:
     import process
 
-def client(input):
-    with process.client('sql',
-                        stdin=process.PIPE,
-                        stdout=process.PIPE,
-                        stderr=process.PIPE) as c:
-        out, err = c.communicate(input)
-        sys.stdout.write(out)
-        sys.stderr.write(err)
-
-script1 = '''\
-create table tab1 (group_by_col int, index_col int, f float);
-create table tab2 (index_col int, f float);
-
-insert into tab1 values (1,1,1),(1,2,2),(2,1,3),(2,2,4),(3,1,5),(3,2,6);
-insert into tab2 values (1,111),(2,222),(3,333),(4,444);
-
-set optimizer='default_pipe';
-select optimizer;
-select tab1.group_by_col,SUM(fuse(cast (tab1.f as INT),cast (tab2.f as INT))) 
from tab2 inner join tab1 on tab1.index_col = tab2.index_col group by 
tab1.group_by_col;
-
-drop table tab1;
-drop table tab2;
-
-'''
-
 with process.server(args=["--set", "gdk_nr_threads=2", "--forcemito"],
                     stdin=process.PIPE,
                     stdout=process.PIPE,
                     stderr=process.PIPE) as s:
-    client(script1)
+    with SQLTestCase() as tc:
+        tc.connect(username="monetdb", password="monetdb")
+        tc.execute("create table tab1 (group_by_col int, index_col int, f 
float);").assertSucceeded()
+        tc.execute("create table tab2 (index_col int, f 
float);").assertSucceeded()
+        tc.execute("insert into tab1 values 
(1,1,1),(1,2,2),(2,1,3),(2,2,4),(3,1,5),(3,2,6);").assertSucceeded().assertRowCount(6)
+        tc.execute("insert into tab2 values 
(1,111),(2,222),(3,333),(4,444);").assertSucceeded().assertRowCount(4)
+        tc.execute("set optimizer='default_pipe';").assertSucceeded()
+        tc.execute("select 
optimizer;").assertSucceeded().assertRowCount(1).assertDataResultMatch([("default_pipe",)])
+        tc.execute("select tab1.group_by_col,SUM(fuse(cast (tab1.f as 
INT),cast (tab2.f as INT))) from tab2 inner join tab1 on tab1.index_col = 
tab2.index_col group by tab1.group_by_col;") \
+            .assertSucceeded().assertRowCount(3).assertDataResultMatch([(1, 
12884902221),(2, 30064771405),(3, 47244640589)])
+        tc.execute("drop table tab1;").assertSucceeded()
+        tc.execute("drop table tab2;").assertSucceeded()
     out, err = s.communicate()
-    sys.stdout.write(out)
     sys.stderr.write(err)
diff --git a/sql/test/scripts/Tests/alastair_udf_mergetable_bug.stable.err 
b/sql/test/scripts/Tests/alastair_udf_mergetable_bug.stable.err
--- a/sql/test/scripts/Tests/alastair_udf_mergetable_bug.stable.err
+++ b/sql/test/scripts/Tests/alastair_udf_mergetable_bug.stable.err
@@ -5,24 +5,6 @@ stderr of test 'alastair_udf_mergetable_
 # 14:10:49 >  "/usr/bin/python2" "alastair_udf_mergetable_bug.py" 
"alastair_udf_mergetable_bug"
 # 14:10:49 >  
 
-# builtin opt  gdk_dbpath = 
/export/scratch2/zhang/monet-install/Jan2014/debug/var/monetdb5/dbfarm/demo
-# builtin opt  gdk_debug = 0
-# builtin opt  gdk_vmtrim = no
-# builtin opt  monet_prompt = >
-# builtin opt  monet_daemon = no
-# builtin opt  mapi_port = 50000
-# builtin opt  mapi_open = false
-# builtin opt  mapi_autosense = false
-# builtin opt  sql_optimizer = default_pipe
-# builtin opt  sql_debug = 0
-# cmdline opt  gdk_nr_threads = 0
-# cmdline opt  mapi_open = true
-# cmdline opt  mapi_port = 31835
-# cmdline opt  mapi_usock = /var/tmp/mtest-11152/.s.monetdb.31835
-# cmdline opt  monet_prompt = 
-# cmdline opt  mal_listing = 2
-# cmdline opt  gdk_dbpath = 
/export/scratch2/zhang/monet-install/Jan2014/debug/var/MonetDB/mTests_sql_test
-# cmdline opt  gdk_nr_threads = 2
 
 # 14:10:50 >  
 # 14:10:50 >  "Done."
diff --git a/sql/test/scripts/Tests/alastair_udf_mergetable_bug.stable.out 
b/sql/test/scripts/Tests/alastair_udf_mergetable_bug.stable.out
--- a/sql/test/scripts/Tests/alastair_udf_mergetable_bug.stable.out
+++ b/sql/test/scripts/Tests/alastair_udf_mergetable_bug.stable.out
@@ -5,43 +5,6 @@ stdout of test 'alastair_udf_mergetable_
 # 14:10:49 >  "/usr/bin/python2" "alastair_udf_mergetable_bug.py" 
"alastair_udf_mergetable_bug"
 # 14:10:49 >  
 
-#create table tab1 (group_by_col int, index_col int, f float);
-#create table tab2 (index_col int, f float);
-#insert into tab1 values (1,1,1),(1,2,2),(2,1,3),(2,2,4),(3,1,5),(3,2,6);
-[ 6    ]
-#insert into tab2 values (1,111),(2,222),(3,333),(4,444);
-[ 4    ]
-#set optimizer='default_pipe';
-#select optimizer;
-% .%2 # table_name
-% %2 # name
-% varchar # type
-% 12 # length
-[ "default_pipe"       ]
-#select tab1.group_by_col,SUM(fuse(cast (tab1.f as INT),cast (tab2.f as INT))) 
from tab2 inner join tab1 on tab1.index_col = tab2.index_col group by 
tab1.group_by_col;
-% sys.tab1,    sys.%3 # table_name
-% group_by_col,        %3 # name
-% int, bigint # type
-% 1,   11 # length
-[ 1,   12884902221     ]
-[ 2,   30064771405     ]
-[ 3,   47244640589     ]
-#drop table tab1;
-#drop table tab2;
-# MonetDB 5 server v11.17.14
-# This is an unreleased version
-# Serving database 'mTests_sql_test', using 8 threads
-# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
-# Found 15.591 GiB available main-memory.
-# Copyright (c) 1993-July 2008 CWI.
-# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
-# Visit http://www.monetdb.org/ for further information
-# Listening for connection requests on mapi:monetdb://riga.ins.cwi.nl:31835/
-# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-11152/.s.monetdb.31835
-# MonetDB/GIS module loaded
-# MonetDB/JAQL module loaded
-# MonetDB/SQL module loaded
-# SQL catalog created, loading sql scripts once
 
 # 14:10:50 >  
 # 14:10:50 >  "Done."
diff --git a/sql/test/scripts/Tests/copy-from-lz4.py 
b/sql/test/scripts/Tests/copy-from-lz4.py
--- a/sql/test/scripts/Tests/copy-from-lz4.py
+++ b/sql/test/scripts/Tests/copy-from-lz4.py
@@ -1,5 +1,6 @@
 import os, sys, tempfile
 
+from MonetDBtesting.sqltest import SQLTestCase
 try:
     from MonetDBtesting import process
 except ImportError:
@@ -11,15 +12,25 @@ try:
     os.unlink(tmpf)
 
     with process.server(args=[], stdin=process.PIPE, stdout=process.PIPE, 
stderr=process.PIPE) as s:
-        data = open(os.path.join(os.getenv('TSTSRCDIR'), 
'lz4-dump.sql')).read()
-        with process.client('sql', stdin=process.PIPE, log=True,
-                            stdout=process.PIPE, stderr=process.PIPE) as c:
-            out, err = c.communicate(data.replace('/tmp/testing-dump.lz4', 
tmpf))
-            sys.stdout.write(out)
-            sys.stderr.write(err)
-
+        with SQLTestCase() as tc:
+            tc.connect(username="monetdb", password="monetdb")
+            tc.execute("CREATE TABLE outputlz4 (a bigint, b real, c 
clob);").assertSucceeded()
+            tc.execute("CREATE TABLE readlz4 (a bigint, b real, c 
clob);").assertSucceeded()
+            tc.execute("""COPY 4 RECORDS INTO outputlz4 (a, b, c) FROM STDIN 
USING DELIMITERS ',',E'\n','"' NULL AS '';
+1,2.0,"another"
+2,2.1,"test"
+3,2.2,"to perform"
+,1.0,
+""").assertSucceeded().assertRowCount(4)
+            tc.execute("SELECT a, b, c FROM 
outputlz4;").assertSucceeded().assertRowCount(4) \
+                
.assertDataResultMatch([(1,2,"another"),(2,2.1,"test"),(3,2.2,"to 
perform"),(None,1,None)])
+            tc.execute("COPY (SELECT a, b, c FROM outputlz4) INTO '%s' USING 
DELIMITERS ',',E'\n','\"' NULL AS '';" % tmpf).assertSucceeded()
+            tc.execute("COPY 4 RECORDS INTO readlz4 (a, b, c) FROM '%s' USING 
DELIMITERS ',',E'\n','\"' NULL AS '';" % tmpf).assertSucceeded()
+            tc.execute("SELECT a, b, c FROM 
readlz4;").assertSucceeded().assertRowCount(4) \
+                
.assertDataResultMatch([(1,2,"another"),(2,2.1,"test"),(3,2.2,"to 
perform"),(None,1,None)])
+            tc.execute("drop table outputlz4;").assertSucceeded()
+            tc.execute("drop table readlz4;").assertSucceeded()
         out, err = s.communicate()
-        sys.stdout.write(out)
         sys.stderr.write(err)
 finally:
     try:
diff --git a/sql/test/scripts/Tests/copy-from-lz4.stable.out 
b/sql/test/scripts/Tests/copy-from-lz4.stable.out
--- a/sql/test/scripts/Tests/copy-from-lz4.stable.out
+++ b/sql/test/scripts/Tests/copy-from-lz4.stable.out
@@ -7,56 +7,6 @@ stdout of test 'copy-from-lz4` in direct
 
 
 # 18:01:50 >  
-# 18:01:50 >  Mtimeout -timeout 60 mclient -lsql -ftest -tnone -Eutf-8 -i -e 
--host=/var/tmp/mtest-16374 --port=35324 --database=mTests_sql_test < 
"/home/ferreira/repositories/MonetDB-default/src/sql/test/Tests/lz4-dump.sql"
-# 18:01:50 >  
-
-#CREATE TABLE outputlz4 (a bigint, b real, c clob);
-#CREATE TABLE readlz4 (a bigint, b real, c clob);
-#COPY 4 RECORDS INTO outputlz4 (a, b, c) FROM STDIN USING DELIMITERS 
',','\n','"' NULL AS '';
-#1,2.0,"another"
-#2,2.1,"test"
-#3,2.2,"to perform"
-#,1.0,
-[ 4    ]
-#SELECT a, b, c FROM outputlz4;
-% sys.outputlz4,       sys.outputlz4,  sys.outputlz4 # table_name
-% a,   b,      c # name
-% bigint,      real,   clob # type
-% 1,   15,     10 # length
-[ 1,   2,      "another"       ]
-[ 2,   2.1,    "test"  ]
-[ 3,   2.2,    "to perform"    ]
-[ NULL,        1,      NULL    ]
-#COPY (SELECT a, b, c FROM outputlz4) INTO '/tmp/testing-dump.lz4' USING 
DELIMITERS ',','\n','"' NULL AS '';
-[ 4    ]
-#COPY 4 RECORDS INTO readlz4 (a, b, c) FROM '/tmp/testing-dump.lz4' USING 
DELIMITERS ',','\n','"' NULL AS '';
-[ 4    ]
-#SELECT a, b, c FROM readlz4;
-% sys.readlz4, sys.readlz4,    sys.readlz4 # table_name
-% a,   b,      c # name
-% bigint,      real,   clob # type
-% 1,   15,     10 # length
-[ 1,   2,      "another"       ]
-[ 2,   2.1,    "test"  ]
-[ 3,   2.2,    "to perform"    ]
-[ NULL,        1,      NULL    ]
-#DROP TABLE outputlz4;
-#DROP TABLE readlz4;
-# MonetDB 5 server v11.30.0
-# This is an unreleased version
-# Serving database 'mTests_sql_test', using 8 threads
-# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers
-# Found 15.492 GiB available main-memory.
-# Copyright (c) 1993 - July 2008 CWI.
-# Copyright (c) August 2008 - 2018 MonetDB B.V., all rights reserved
-# Visit https://www.monetdb.org/ for further information
-# Listening for connection requests on 
mapi:monetdb://dhcp-23.eduroam.cwi.nl:35324/
-# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-16374/.s.monetdb.35324
-# MonetDB/GIS module loaded
-# MonetDB/SQL module loaded
-# SQL catalog created, loading sql scripts once
-
-# 18:01:50 >  
 # 18:01:50 >  "Done."
 # 18:01:50 >  
 
diff --git a/sql/test/scripts/Tests/lz4-dump.sql 
b/sql/test/scripts/Tests/lz4-dump.sql
deleted file mode 100644
--- a/sql/test/scripts/Tests/lz4-dump.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-CREATE TABLE outputlz4 (a bigint, b real, c clob);
-CREATE TABLE readlz4 (a bigint, b real, c clob);
-
-COPY 4 RECORDS INTO outputlz4 (a, b, c) FROM STDIN USING DELIMITERS 
',',E'\n','"' NULL AS '';
-1,2.0,"another"
-2,2.1,"test"
-3,2.2,"to perform"
-,1.0,
-SELECT a, b, c FROM outputlz4;
-COPY (SELECT a, b, c FROM outputlz4) INTO '/tmp/testing-dump.lz4' USING 
DELIMITERS ',',E'\n','"' NULL AS '';
-
-COPY 4 RECORDS INTO readlz4 (a, b, c) FROM '/tmp/testing-dump.lz4' USING 
DELIMITERS ',',E'\n','"' NULL AS '';
-SELECT a, b, c FROM readlz4;
-
-DROP TABLE outputlz4;
-DROP TABLE readlz4;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to