Changeset: 766bdabd4d7c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/766bdabd4d7c
Modified Files:
        testing/Mtest.py.in
Branch: Aug2024
Log Message:

Mtest: set ODBCSYSINI instead of ODBCINI

And split odbc.ini into odbc.ini and odbcinst.ini

This insulates Mtest's odbc setup from whatever else is going on in the system.

odbc.ini can now just set Driver=MonetDB and does not need any file system paths


diffs (64 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -2215,12 +2215,18 @@ def RunTest(env, TST, COND, oktests, len
                 f.close()
 
         if odbc:
-            f = openutf8('odbc.ini', 'w')
-            f.write(f'''\
-[MonetDB-Test]
+            with openutf8('odbcinst.ini', 'w') as f:
+                f.write(f'''\
+[MonetDB]
 Description = Test MonetDB Data Source
 Driver = {env["LIBDIR"]}/libMonetODBC.so
 Setup = {env["LIBDIR"]}/libMonetODBCs.so
+''')
+            with openutf8('odbc.ini', 'w') as f:
+                f.write(f'''\
+[MonetDB-Test]
+Description = Test MonetDB Data Source
+Driver = MonetDB
 Host = localhost
 Port = {env["MAPIPORT"]}
 Database = {TSTDB}
@@ -2230,16 +2236,17 @@ Debug =
 
 [MonetDB-Test-Wrong]
 Description = Wrong values for Database, Uid and Pwd
-Driver = {env["LIBDIR"]}/libMonetODBC.so
-Setup = {env["LIBDIR"]}/libMonetODBCs.so
+Driver = MonetDB
 Host = localhost
 Port = {env["MAPIPORT"]}
 Database = {TSTDB}-Wrong
 User = {user or "monetdb"}-Wrong
 Password = {passwd or "monetdb"}-Wrong
 ''')
-            f.close()
-            os.environ['ODBCINI'] = os.path.join(TSTTRGDIR, 'odbc.ini')
+            orig_odbcsysini = os.environ.pop('ODBCSYSINI', None)
+            orig_odbcini = os.environ.pop('ODBCINI', None)
+            orig_odbcinstini = os.environ.pop('ODBCINSTINI', None)
+            os.environ['ODBCSYSINI'] = TSTTRGDIR
 
         STABLEout,STABLEerr = 
StableOutErr(env,par,TST,SYST,RELEASE,DIST,VERSION)
         TIMEOUT = par['TIMEOUT']
@@ -2268,7 +2275,15 @@ Password = {passwd or "monetdb"}-Wrong
             print(" %7.3fs " % TX, end='')
 
         if odbc:
-            del os.environ['ODBCINI']
+            if orig_odbcsysini is not None:
+                os.environ['ODBCSYSINI'] = orig_odbcsysini
+            else:
+                del os.environ['ODBCSYSINI']
+            if orig_odbcini is not None:
+                os.environ['ODBCINI'] = orig_odbcini
+            if orig_odbcinstini is not None:
+                os.environ['ODBCINSTINI'] = orig_odbcinstini
+
 
         if tres == 'timeout':
             errcode = F_TIME
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to