Changeset: 05d2228a090f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/05d2228a090f
Modified Files:
        sql/test/bincopy/Tests/bincopy_blobs_on_client.SQL.py
        sql/test/bincopy/Tests/bincopy_blobs_on_server.SQL.py
        sql/test/bincopy/Tests/bincopy_support.py
Branch: copyfaster
Log Message:

Make bincopy tests faster by reducing the nr of blobs

A typical data file is 4M, the bincopy data was 330M.
Now it's 33M.


diffs (82 lines):

diff --git a/sql/test/bincopy/Tests/bincopy_blobs_on_client.SQL.py 
b/sql/test/bincopy/Tests/bincopy_blobs_on_client.SQL.py
--- a/sql/test/bincopy/Tests/bincopy_blobs_on_client.SQL.py
+++ b/sql/test/bincopy/Tests/bincopy_blobs_on_client.SQL.py
@@ -4,10 +4,10 @@ import sys
 import os
 sys.path.append(os.getenv('TSTSRCDIR'))
 from bincopy_support import run_test
-from bincopy_support import NULL_BLOBS, NULL_BLOBS_LE, NULL_BLOBS_BE
+from bincopy_support import NRECS, NULL_BLOBS, NULL_BLOBS_LE, NULL_BLOBS_BE
 
-run_test('client', NULL_BLOBS)
+run_test('client', NULL_BLOBS, NRECS // 10)
 
-run_test('client', NULL_BLOBS_LE)
+run_test('client', NULL_BLOBS_LE, NRECS // 10)
 
-run_test('client', NULL_BLOBS_BE)
+run_test('client', NULL_BLOBS_BE, NRECS // 10)
diff --git a/sql/test/bincopy/Tests/bincopy_blobs_on_server.SQL.py 
b/sql/test/bincopy/Tests/bincopy_blobs_on_server.SQL.py
--- a/sql/test/bincopy/Tests/bincopy_blobs_on_server.SQL.py
+++ b/sql/test/bincopy/Tests/bincopy_blobs_on_server.SQL.py
@@ -5,10 +5,10 @@ import sys
 import os
 sys.path.append(os.getenv('TSTSRCDIR'))
 from bincopy_support import run_test
-from bincopy_support import NULL_BLOBS, NULL_BLOBS_LE, NULL_BLOBS_BE
+from bincopy_support import NRECS, NULL_BLOBS, NULL_BLOBS_LE, NULL_BLOBS_BE
 
-run_test('server', NULL_BLOBS)
+run_test('server', NULL_BLOBS, NRECS // 10)
 
-run_test('server', NULL_BLOBS_LE)
+run_test('server', NULL_BLOBS_LE, NRECS // 10)
 
-run_test('server', NULL_BLOBS_BE)
+run_test('server', NULL_BLOBS_BE, NRECS // 10)
diff --git a/sql/test/bincopy/Tests/bincopy_support.py 
b/sql/test/bincopy/Tests/bincopy_support.py
--- a/sql/test/bincopy/Tests/bincopy_support.py
+++ b/sql/test/bincopy/Tests/bincopy_support.py
@@ -14,7 +14,8 @@ BINCOPY_FILES = os.environ.get('BINCOPY_
 
 
 class DataMaker:
-    def __init__(self):
+    def __init__(self, nrecs):
+        self.nrecs = nrecs
         self.fixed_substitutions = dict()
         self.work_list = set()
         self.outfile_to_expected = dict()
@@ -60,11 +61,11 @@ class DataMaker:
             var = var[3:]
             ext = '.ne'
             flags.append('--native-endian')
-        base = f'bincopy_{var}{ext}.bin'
+        base = f'bincopy_{var}_{self.nrecs}{ext}.bin'
         dst_filename = os.path.join(BINCOPY_FILES, base)
         tmp_filename = os.path.join(BINCOPY_FILES, 'tmp_' + base)
         if not os.path.isfile(dst_filename):
-            cmd = ("bincopydata", *flags, var, str(NRECS), tmp_filename)
+            cmd = ("bincopydata", *flags, var, str(self.nrecs), tmp_filename)
             self.work_list.add( (cmd, tmp_filename, dst_filename))
         return dst_filename
 
@@ -86,15 +87,14 @@ class DataMaker:
         return self.outfile_to_expected.items()
 
 
-def run_test(side, testcase):
+def run_test(side, testcase, nrecs=NRECS):
     code, expected_result = testcase
     assert len(re.findall('@ON@', code)) == len(re.findall('COPY', code))
     assert '@ON@' in code
     # generate the query
-    data_maker = DataMaker()
+    data_maker = DataMaker(nrecs)
     data_maker.additionally('ON', 'ON ' + side.upper())
-    data_maker.additionally('NRECS', NRECS)
-    data_maker.additionally('NRECS_DIV_4', NRECS / 4)
+    data_maker.additionally('NRECS', nrecs)
     massage = lambda s: re.sub(r'@(>?(\w|!)+)@', data_maker.substitute_match, 
s)
     code = massage(code)
     code = f"START TRANSACTION;\n{code}\nROLLBACK;\n"
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to