Changeset: c9bb2f4d7a5e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c9bb2f4d7a5e
Modified Files:
        gdk/gdk_bbp.c
        testing/Mtest.py.in
        testing/sqllogictest.py
Branch: pp_hashjoin
Log Message:

merged with default


diffs (184 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -561,8 +561,7 @@ heapinit(BAT *b, const char *buf,
        b->tnosorted = (BUN) nosorted;
        b->tnorevsorted = (BUN) norevsorted;
        b->tunique_est = 0.0;
-       /* (properties & 0x0200) is the old tdense flag */
-       b->tseqbase = (properties & 0x0200) == 0 || base >= (uint64_t) oid_nil 
? oid_nil : (oid) base;
+       b->tseqbase = base >= (uint64_t) oid_nil ? oid_nil : (oid) base;
        b->theap->free = (size_t) free;
        b->theap->hasfile = free > 0;
        /* set heap size to match capacity */
@@ -2088,7 +2087,6 @@ heap_entry(FILE *fp, BATiter *bi, BUN si
                       (unsigned short) bi->sorted |
                           ((unsigned short) bi->revsorted << 7) |
                           ((unsigned short) bi->key << 8) |
-                          ((unsigned short) BATtdensebi(bi) << 9) |
                           ((unsigned short) bi->nonil << 10) |
                           ((unsigned short) bi->nil << 11) |
                           ((unsigned short) bi->ascii << 12),
diff --git a/sql/test/mapi/Tests/python3_dbapi.SQL.bat 
b/sql/test/mapi/Tests/python3_dbapi.SQL.bat
--- a/sql/test/mapi/Tests/python3_dbapi.SQL.bat
+++ b/sql/test/mapi/Tests/python3_dbapi.SQL.bat
@@ -4,4 +4,4 @@ rem must be aligned with the installatio
 rem clients/examples/python
 set testpath=%TSTSRCBASE%\clients\examples\python
 
-sqlsample.py %MAPIPORT% %TSTDB% %MAPIHOST%
+"%PYTHON%" "%testpath%\sqlsample.py" %MAPIPORT% %TSTDB% %MAPIHOST%
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -22,7 +22,6 @@ import signal
 import fnmatch
 import http
 import http.server
-import glob
 import datetime
 import pymonetdb  # check for pymonetdb early: it is essential for our work
 import concurrent.futures
@@ -75,8 +74,22 @@ def prgreen(str):
     print(str, end='')
 def prpurple(str):
     print(str, end='')
+use_esc = False
 if isatty:
-    if os.name != 'nt':
+    if os.name == 'nt':
+        try:
+            import ctypes
+            kernel32 = ctypes.windll.kernel32
+            origmode = ctypes.c_long()
+            handle = kernel32.GetStdHandle(-11) # STD_OUTPUT_HANDLE
+            if kernel32.GetConsoleMode(handle, ctypes.byref(origmode)):
+                if kernel32.SetConsoleMode(handle, origmode.value | 0x0004):
+                    use_esc = True
+        except (ImportError, AttributeError):
+            pass
+    else:
+        use_esc = True
+    if use_esc:
         # color output a little
         RED = '\033[1;31m'
         GREEN = '\033[0;32m'
@@ -3027,33 +3040,31 @@ def mapi_ping(port, host='localhost', tr
 
 
 threadids = {}
-up = '\033[A'
-down = '\033[B'
 
 
 def progress(count, errors, total, test, spaces=' '*(ttywidth or 100)):
     errs = '\r'
-    if os.name == 'nt':
-        nl = ''
-        line = 0
-    else:
+    if use_esc:
         tid = threading.get_ident()
-        nl = ''
         if tid not in threadids:
             threadids[tid] = len(threadids)
             nl = '\n'
+        else:
+            nl = ''
         line = len(threadids) - threadids[tid]
-        if errors == 1:
-            errs = f'\r{errors} error'
-        elif errors > 1:
-            errs = f'\r{errors} errors'
+        if errors:
+            errs = f'\r{errors} error{"" if errors == 1 else "s"}'
+        up = f'\033[{line}A' if line > 1 else '\033[A'
+        down = f'\033[{line}B' if line > 1 else '\033[B'
+    else:
+        nl = up = down = ''
     perc = int(count*100/total) if total and count else 0
     width = len(str(total))
     s = f'[{count:{width}}/{total}] ({perc:2}%)    {test}'
     if len(s) > ttywidth:
         test = test[len(s)-ttywidth:]
         s = f'[{count:{width}}/{total}] ({perc:2}%)    {test}'
-    sys.stdout.write(nl + '\r' + up*line + spaces + '\r' + s + down*line + 
errs)
+    sys.stdout.write(nl + '\r' + up + spaces + '\r' + s + down + errs)
 
 
 def DoIt(env, SERVER, CALL, TST, EXT, TestOutFile, TestErrFile, TIMEOUT, ME, 
length, nomito, threads, user, passwd, COND, PSRVR, total_tests, options, 
TSTDB, TSTDIR, TSTTRGDIR, TSTSRCDIR, environ):
diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py
--- a/testing/sqllogictest.py
+++ b/testing/sqllogictest.py
@@ -81,13 +81,22 @@ hashge = False                  # may ge
 
 skipidx = re.compile(r'create index .* \b(asc|desc)\b', re.I)
 
+
 class UnsafeDirectoryHandler(pymonetdb.SafeDirectoryHandler):
+    def __init__(self, srcdir, data_dir:Optional[Path]=None, **kwargs):
+        self.data_dir = data_dir
+        super().__init__(srcdir, **kwargs)
+
     def secure_resolve(self, filename: str) -> Optional[Path]:
+        if self.data_dir is not None and (self.data_dir / filename).exists():
+            return (self.data_dir / filename).resolve()
         return (self.dir / filename).resolve()
 
+
 class SQLLogicSyntaxError(Exception):
     pass
 
+
 class SQLLogicConnection(object):
     def __init__(self, conn_id, dbh, crs=None, language='sql'):
         self.conn_id = conn_id
@@ -164,7 +173,8 @@ class SQLLogic:
 
     def connect(self, username='monetdb', password='monetdb',
                 hostname='localhost', port=None, database=None, usock=None,
-                language='sql', timeout: Optional[int]=0, alltests=False,
+                language='sql', data_dir: Optional[Path]=None,
+                timeout: Optional[int]=0, alltests=False,
                 server=None):
         self.starttime = time.time()
         self.language = language
@@ -181,7 +191,8 @@ class SQLLogic:
         self.timeout = timeout
         self.alltests = alltests
         if language == 'sql':
-            transfer_handler = UnsafeDirectoryHandler(self.srcdir)
+            transfer_handler = UnsafeDirectoryHandler(self.srcdir,
+                                                      data_dir=data_dir)
             dbh = pymonetdb.connect(username=username,
                                     password=password,
                                     hostname=hostname,
@@ -1107,6 +1118,9 @@ if __name__ == '__main__':
                         help='password to use to login to the database with')
     parser.add_argument('--language', action='store', default='sql',
                         help='language to use for testing')
+    parser.add_argument('--data-dir', action='store',
+                        type=Path,
+                        help='directory for relative paths in ON CLIENT 
processing (default: directory of test script)')
     parser.add_argument('--nodrop', action='store_true',
                         help='do not drop tables at start of test')
     parser.add_argument('--timeout', action='store', type=int, default=0,
@@ -1126,7 +1140,7 @@ if __name__ == '__main__':
                         help='define substitution for $var as var=replacement'
                         ' (can be repeated)')
     parser.add_argument('--alltests', action='store_true',
-                        help='also executed "knownfail" tests')
+                        help='also execute "knownfail" tests')
     parser.add_argument('--run-until', action='store', type=int,
                         help='run tests until specified line')
     parser.add_argument('tests', nargs='*', help='tests to be run')
@@ -1140,7 +1154,8 @@ if __name__ == '__main__':
     sql.res = opts.results
     sql.connect(hostname=opts.host, port=opts.port, database=opts.database,
                 language=opts.language, username=opts.user,
-                password=opts.password, alltests=opts.alltests,
+                password=opts.password, data_dir=opts.data_dir,
+                alltests=opts.alltests,
                 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