Changeset: 8ac87a0fd1e0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8ac87a0fd1e0
Modified Files:
        sql/test/miscellaneous/Tests/groupby_error.test
        testing/sqllogictest.py
Branch: Sep2022
Log Message:

Implemented skipif/onlyif condition for number of threads.


diffs (67 lines):

diff --git a/sql/test/miscellaneous/Tests/groupby_error.test 
b/sql/test/miscellaneous/Tests/groupby_error.test
--- a/sql/test/miscellaneous/Tests/groupby_error.test
+++ b/sql/test/miscellaneous/Tests/groupby_error.test
@@ -100,6 +100,8 @@ NULL
 NULL
 NULL
 
+#output differs for 1 vs. multiple threads
+skipif threads=1
 query T nosort
 PLAN SELECT DISTINCT col0, col1, col2, col0 FROM tab0
 ----
@@ -107,6 +109,14 @@ group by (
 | table("sys"."tab0") [ "tab0"."col0", "tab0"."col1", "tab0"."col2" ]
 ) [ "tab0"."col0", "tab0"."col1", "tab0"."col2" ] [ "tab0"."col0", 
"tab0"."col1", "tab0"."col2", "tab0"."col0" ]
 
+onlyif threads=1
+query T nosort
+PLAN SELECT DISTINCT col0, col1, col2, col0 FROM tab0
+----
+group by (
+| table("sys"."tab0") [ "tab0"."col0", "tab0"."col1", "tab0"."col2" ]
+) [ "tab0"."col2", "tab0"."col0", "tab0"."col1" ] [ "tab0"."col0", 
"tab0"."col1", "tab0"."col2", "tab0"."col0" ]
+
 query IIII rowsort
 SELECT DISTINCT col0, col1, col2, col0 FROM tab0
 ----
diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py
--- a/testing/sqllogictest.py
+++ b/testing/sqllogictest.py
@@ -664,6 +664,7 @@ class SQLLogic:
     def parse(self, f, approve=None, verbose=False, defines=None):
         self.approve = approve
         self.initfile(f, defines)
+        nthreads = None
         if self.language == 'sql':
             self.crs.execute(f'call sys.setsession(cast({self.timeout or 0} as 
bigint))')
         else:
@@ -693,10 +694,24 @@ class SQLLogic:
             if not words:
                 continue
             while words[0] == 'skipif' or words[0] == 'onlyif':
-                if words[0] == 'skipif' and words[1] in ('MonetDB', 
f'arch={architecture}'):
-                    skipping = True
-                elif words[0] == 'onlyif' and words[1] not in ('MonetDB', 
f'arch={architecture}'):
-                    skipping = True
+                if words[0] == 'skipif':
+                    if words[1] in ('MonetDB', f'arch={architecture}'):
+                        skipping = True
+                    elif words[1].startswith('threads='):
+                        if nthreads is None:
+                            self.crs.execute("select value from env() where 
name = 'gdk_nr_threads'")
+                            nthreads = self.crs.fetchall()[0][0]
+                        if words[1] == f'threads={nthreads}':
+                            skipping = True
+                elif words[0] == 'onlyif':
+                    if words[1] not in ('MonetDB', f'arch={architecture}'):
+                        skipping = True
+                    elif words[1].startswith('threads='):
+                        if nthreads is None:
+                            self.crs.execute("select value from env() where 
name = 'gdk_nr_threads'")
+                            nthreads = self.crs.fetchall()[0][0]
+                        if words[1] != f'threads={nthreads}':
+                            skipping = True
                 self.writeline(line.rstrip())
                 line = self.readline()
                 words = line.split(maxsplit=2)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to