Changeset: 149424068bbc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/149424068bbc
Modified Files:
        testing/Mtest.py.in
        testing/sqllogictest.py
Branch: Dec2025
Log Message:

Add possibility to specify default hash-threshold on the command line when 
approving.


diffs (81 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -32,6 +32,7 @@ procdebug = False
 verbose = False
 approve = False
 replace = False
+threshold = None
 stop_crash = False
 
 initdb = None
@@ -3224,6 +3225,7 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
                                     usock=pSrvr.usock,
                                     language=lang,
                                     timeout=TIMEOUT,
+                                    threshold=threshold,
                                     alltests=CONDITIONALS['KNOWNFAIL'])
                     except KeyboardInterrupt:
                         raise
@@ -3744,6 +3746,7 @@ def main(argv):
     parser.add_argument('--single-in-memory', action='store_true', 
dest='single_in_memory', help='use --in-memory for SingleServer directories')
     parser.add_argument('--approve', action='store_true', help='produce 
.newtest file in testing directory with calculated content')
     parser.add_argument('--approve+replace', action='store_true', 
dest='approve_replace', help='produce new .test file in source directory with 
calculated content')
+    parser.add_argument('--threshold', action='store', type=int, 
help='hash-threshold for .test files when approving')
     parser.add_argument('--ignore-conditions', action='store_true', 
dest='ignore_conditions', help='ignore conditions in All file')
     parser.add_argument('--skip-test-with-timeout', action='store_true', 
help='skip tests that have a .timeout file')
     parser.add_argument('--stop-at-crash', action='store_true', 
dest='stop_crash', help='stop testing when the server crashes')
@@ -3815,11 +3818,14 @@ def main(argv):
     procdebug = opts.procdebug
     global approve
     global replace
+    global threshold
     approve = opts.approve or opts.approve_replace
     if approve:
         os.environ['MTEST_APPROVE'] = 'TRUE'
     if opts.approve_replace:
         replace = True
+    if opts.threshold:
+        threshold = opts.threshold
     global stop_crash
     stop_crash = opts.stop_crash
     global ignore_conditions
diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py
--- a/testing/sqllogictest.py
+++ b/testing/sqllogictest.py
@@ -173,6 +173,7 @@ class SQLLogic:
     def connect(self, username='monetdb', password='monetdb',
                 hostname='localhost', port=None, database=None, usock=None,
                 language='sql', data_dir: Optional[Path]=None,
+                threshold: Optional[int]=100,
                 timeout: Optional[int]=0, alltests=False,
                 server=None):
         self.starttime = time.time()
@@ -189,6 +190,8 @@ class SQLLogic:
         self.database = database or 'demo'
         self.timeout = timeout
         self.alltests = alltests
+        if threshold:
+            self.threshold = threshold
         if language == 'sql':
             transfer_handler = UnsafeDirectoryHandler(self.srcdir,
                                                       data_dir=data_dir)
@@ -1122,6 +1125,9 @@ if __name__ == '__main__':
                         type=argparse.FileType('w'),
                         help='file in which to produce a new .test file '
                         'with updated results')
+    parser.add_argument('--hash-threshold', action='store',
+                        type=int, default=100,
+                        help='default hash-threshold value')
     parser.add_argument('--define', action='append',
                         help='define substitution for $var as var=replacement'
                         ' (can be repeated)')
@@ -1141,7 +1147,7 @@ if __name__ == '__main__':
     sql.connect(hostname=opts.host, port=opts.port, database=opts.database,
                 language=opts.language, username=opts.user,
                 password=opts.password, data_dir=opts.data_dir,
-                alltests=opts.alltests,
+                alltests=opts.alltests, threshold=opts.hash_threshold,
                 timeout=opts.timeout if opts.timeout > 0 else 0)
     for test in args:
         try:
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to