Changeset: febc447b8cfd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/febc447b8cfd
Modified Files:
        sql/test/testdb/Tests/dump.SQL.py
        testing/Mtest.py.in
Branch: default
Log Message:

Merge with Dec2025 branch.


diffs (100 lines):

diff --git a/clients/Tests/exports.py b/clients/Tests/exports.py
--- a/clients/Tests/exports.py
+++ b/clients/Tests/exports.py
@@ -1,4 +1,5 @@
 import sys
+import os
 import difflib
 import MonetDBtesting.listexports
 with open('exports.stable.out') as fil:
@@ -7,3 +8,14 @@ output = MonetDBtesting.listexports.list
 for line in difflib.unified_diff(stable, output,
                                  fromfile='expected', tofile='received'):
     sys.stderr.write(line)
+approve = os.getenv('MTEST_APPROVE')
+if approve:
+    with open(os.path.join(os.getenv('TSTTRGDIR'),
+                           'exports.stable.out.new'), 'w') as fil:
+        for line in output:
+            fil.write(line)
+    if approve == 'REPLACE':
+        with open(os.path.join(os.getenv('TSTSRCDIR'),
+                               'exports.stable.out'), 'w') as fil:
+            for line in output:
+                fil.write(line)
diff --git a/sql/test/emptydb/Tests/check.SQL.py 
b/sql/test/emptydb/Tests/check.SQL.py
--- a/sql/test/emptydb/Tests/check.SQL.py
+++ b/sql/test/emptydb/Tests/check.SQL.py
@@ -48,6 +48,12 @@ if __name__ == '__main__':
     if opts.stableout is not None:
         stableout = opts.stableout
         check = True
+    if not approve and os.getenv('MTEST_APPROVE'):
+        if os.getenv('MTEST_APPROVE') == 'REPLACE':
+            approve = os.path.join(os.getenv('TSTSRCDIR'),
+                                   f'check.stable.out{".32bit" if 
os.getenv("TSTBITS") == "32" else ""}{".int128" if os.getenv("HAVE_HGE") else 
""}')
+        else:
+            approve = os.path.join(os.getenv('TSTTRGDIR'), 
'check.stable.out.new')
 
 xit = 0
 output = []
@@ -602,6 +608,9 @@ if check:
             fromfile='expected', tofile='received'):
         sys.stderr.write(line)
         xit = 1
+    if type(approve) == str:
+        with open(approve, 'w') as f:
+            f.writelines(output)
 elif approve:
     approve.writelines(output)
 else:
diff --git a/sql/test/testdb/Tests/dump.SQL.py 
b/sql/test/testdb/Tests/dump.SQL.py
--- a/sql/test/testdb/Tests/dump.SQL.py
+++ b/sql/test/testdb/Tests/dump.SQL.py
@@ -1,4 +1,5 @@
 import sys
+import os
 
 try:
     from MonetDBtesting import process
@@ -27,13 +28,23 @@ if len(sys.argv) == 2 and sys.argv[1] in
         if res is not None:
             points = ptsre.sub(r'(\g<0>)', res.group('points'))
             output[i] = line[:res.start('points')] + points + 
line[res.end('points'):]
-    stableout = '{}.stable.out'.format(sys.argv[1])
+    stableout = f'{sys.argv[1]}.stable.out'
     with open(stableout, encoding='utf-8') as fil:
         stable = fil.readlines()
     import difflib
     for line in difflib.unified_diff(stable, output,
                                      fromfile='expected', tofile='received'):
         sys.stderr.write(line)
+    approve = os.getenv('MTEST_APPROVE')
+    if approve:
+        if approve == 'REPLACE':
+            fn = os.path.join(os.getenv('TSTSRCDIR'),
+                              f'{sys.argv[1]}.stable.out')
+        else:
+            fn = os.path.join(os.getenv('TSTTRGDIR'),
+                              f'{sys.argv[1]}.stable.out.new')
+        with open(fn, 'w') as f:
+            f.writelines(out)
 else:
     sys.stdout.writelines(out)
 
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -3791,10 +3791,10 @@ def main(argv):
     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 approve:
+        os.environ['MTEST_APPROVE'] = 'REPLACE' if replace else 'TRUE'
     if opts.threshold:
         threshold = opts.threshold
     global stop_crash
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to