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

Don't convert variables too soon in .test.in files.


diffs (40 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -2173,7 +2173,7 @@ def RunTest(env, TST, COND, oktests, len
         test = re.compile('^'+TST+r'(_[sp][0-9][0-9])?\..*\.in$', re.MULTILINE)
         for ff in listdir(TSTTRGDIR):
             fff = ff[:-3]
-            if test.match(ff) and not os.path.isfile(fff):
+            if test.match(ff) and not os.path.isfile(fff) and not 
ff.endswith('.test.in'):
                 f = openutf8(fff,'w')
                 for l in openutf8(ff):
                     f.write(expandvars(l, env))
@@ -3045,12 +3045,14 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
                                 pass
                         if returncode is None:
                             defines = []
+                            testfile = TST+EXT
                             if lang == 'sql' and 
os.path.exists(TST+'.test.in'):
+                                testfile = TST+'.test.in'
                                 for key in ('TSTDATAPATH', 'TSTSRCBASE', 
'TSTSRCDIR', 'TSTTRGDIR', 'UTSTSRCDIR', 'TSTDB', 'MAPIPORT'):
                                     if key in env:
                                         defines.append(f'{key}={env[key]}')
                             try:
-                                sql.parse(TST+EXT, 
approve=open(TST+'.newtest','w') if approve else None, defines=defines)
+                                sql.parse(testfile, 
approve=open(TST+'.newtest','w') if approve else None, defines=defines)
                             except KeyboardInterrupt:
                                 raise
                             except sqllogictest.SQLLogicSyntaxError:
diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py
--- a/testing/sqllogictest.py
+++ b/testing/sqllogictest.py
@@ -740,6 +740,8 @@ class SQLLogic:
                 val = val.strip()
                 defs.append((re.compile(r'\$(' + key + r'\b|{' + key + '})'),
                              val, key))
+                defs.append((re.compile(r'\$(Q' + key + r'\b|{Q' + key + '})'),
+                             val.replace('\\', '\\\\'), 'Q'+key))
         self.defines = sorted(defs, key=lambda x: (-len(x[1]), x[1], x[2]))
         self.lines = []
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to