Changeset: 4022eaa82095 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4022eaa82095
Modified Files:
        testing/Mtest.py.in
        testing/Mz.py.in
        testing/helpers.py
Branch: default
Log Message:

Merge with Jan2022 branch.


diffs (truncated from 301 to 300 lines):

diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -1029,7 +1029,7 @@ static const char *pcre_specials = ".+?*
 #else
 /* special characters in POSIX basic regular expressions that need to
  * be escaped */
-static const char *pcre_specials = ".*[]^$\\";
+static const char *pcre_specials = "^.[$()|*+?{\\";
 #endif
 
 /* change SQL LIKE pattern into PCRE pattern */
@@ -1445,18 +1445,10 @@ re_like_clean(struct RE **re, uint32_t *
        }
 }
 
+#ifdef HAVE_LIBPCRE
 static inline str
-pcre_like_build(
-#ifdef HAVE_LIBPCRE
-       pcre **res,
-       pcre_extra **ex
-#else
-       regex_t *res,
-       void *ex
-#endif
-, const char *ppat, bool caseignore, BUN count)
+pcre_like_build(pcre **res, pcre_extra **ex, const char *ppat, bool 
caseignore, BUN count)
 {
-#ifdef HAVE_LIBPCRE
        const char *err_p = NULL;
        int errpos = 0;
        int options = PCRE_UTF8 | PCRE_NO_UTF8_CHECK | PCRE_MULTILINE | 
PCRE_DOTALL;
@@ -1464,47 +1456,42 @@ pcre_like_build(
 
        *res = NULL;
        *ex = NULL;
+
+       if (caseignore) {
+               options |= PCRE_CASELESS;
+       }
+       if ((*res = pcre_compile(ppat, options, &err_p, &errpos, NULL)) == NULL)
+               return createException(MAL, "pcre.pcre_like_build", 
OPERATION_FAILED
+                                                               ": compilation 
of regular expression (%s) failed"
+                                                               " at %d with 
'%s'", ppat, errpos, err_p);
+       *ex = pcre_study(*res, pcrestopt, &err_p);
+       if (err_p != NULL)
+               return createException(MAL, "pcre.pcre_like_build", 
OPERATION_FAILED
+                                                               ": pcre study 
of pattern (%s) "
+                                                               "failed with 
'%s'", ppat, err_p);
+       return MAL_SUCCEED;
+}
 #else
+static inline str
+pcre_like_build(regex_t *res, void *ex, const char *ppat, bool caseignore, BUN 
count)
+{
        int options = REG_NEWLINE | REG_NOSUB | REG_EXTENDED;
        int errcode;
 
        *res = (regex_t) {0};
        (void) count;
-#endif
 
        if (caseignore) {
-#ifdef HAVE_LIBPCRE
-               options |= PCRE_CASELESS;
-#else
                options |= REG_ICASE;
-#endif
        }
-       if (
-#ifdef HAVE_LIBPCRE
-               (*res = pcre_compile(ppat, options, &err_p, &errpos, NULL)) == 
NULL
-#else
-               (errcode = regcomp(res, ppat, options)) != 0
-#endif
-               )
+       if ((errcode = regcomp(res, ppat, options)) != 0)
                return createException(MAL, "pcre.pcre_like_build", 
OPERATION_FAILED
-                                                               ": compilation 
of regular expression (%s) failed"
-#ifdef HAVE_LIBPCRE
-                                                               " at %d with 
'%s'", ppat, errpos, err_p
-#else
-                                                               , ppat
-#endif
-                       );
-#ifdef HAVE_LIBPCRE
-       *ex = pcre_study(*res, pcrestopt, &err_p);
-       if (err_p != NULL)
-               return createException(MAL, "pcre.pcre_like_build", 
OPERATION_FAILED
-                                                               ": pcre study 
of pattern (%s) "
-                                                               "failed with 
'%s'", ppat, err_p);
-#else
+                                                          ": compilation of 
regular expression (%s) failed",
+                                                          ppat);
        (void) ex;
-#endif
        return MAL_SUCCEED;
 }
+#endif
 
 #define PCRE_LIKE_BODY(LOOP_BODY, RES1, RES2) \
        do { \
diff --git a/sql/backends/monet5/UDF/capi/Tests/All 
b/sql/backends/monet5/UDF/capi/Tests/All
--- a/sql/backends/monet5/UDF/capi/Tests/All
+++ b/sql/backends/monet5/UDF/capi/Tests/All
@@ -5,7 +5,7 @@ NOT_WIN32?capi02
 NOT_WIN32?capi03
 NOT_WIN32?capi04
 NOT_WIN32?capi05
-NOT_WIN32?capi06
+NOT_WIN32&HAVE_CPP?capi06
 NOT_WIN32?capi07
 NOT_WIN32?capi08
 NOT_WIN32?capi09
diff --git a/sql/backends/monet5/UDF/capi/Tests/SingleServer 
b/sql/backends/monet5/UDF/capi/Tests/SingleServer
--- a/sql/backends/monet5/UDF/capi/Tests/SingleServer
+++ b/sql/backends/monet5/UDF/capi/Tests/SingleServer
@@ -1,1 +1,2 @@
 --set embedded_c=true
+--set capi_cc='cc -std=c99'
diff --git a/sql/test/Tests/All b/sql/test/Tests/All
--- a/sql/test/Tests/All
+++ b/sql/test/Tests/All
@@ -1,6 +1,6 @@
 # Run these first so comment-dump doesn't encounter
 # leftovers from other tests
-comment-dump
+HAVE_LIBPCRE?comment-dump
 comment-on
 comment-auth-1
 USER=user_a&PASSWD=user_a?comment-auth-2
diff --git a/sql/test/miscellaneous/Tests/All b/sql/test/miscellaneous/Tests/All
--- a/sql/test/miscellaneous/Tests/All
+++ b/sql/test/miscellaneous/Tests/All
@@ -1,7 +1,7 @@
 column_aliases
 declared_tables
 trace_test
-simple_selects
+HAVE_LIBPCRE?simple_selects
 update_delete_aliases
 groupby_expressions
 values
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -405,6 +405,7 @@ CONDITIONALS = {
     'HAVE_PYMONETDB'       : False, # default PYTHON can import pymonetdb
     'HAVE_PYTHON_LZ4'      : False, # module lz4 is available
     'HAVE_RUBY'            : False,
+    'HAVE_CPP'             : False,
     'HAVE_DATA_PATH'       : False,
     'MERCURIAL'            : False,
     'RELEASERUN'           : False,
@@ -1239,7 +1240,7 @@ def PerformDir(env, testdir, testlist, a
                 options = []            # not used
             else:
                 oneserver = True
-                options = f.read().split()
+                options = splitcommand(f.read())
                 f.close()
 
         if testlist:
@@ -3604,6 +3605,14 @@ def main(argv) :
                 print('Ruby available, but MonetDB gem not available')
     CheckClassPath()
 
+    if CheckExec('c++'):
+        with process.Popen(['c++', '--version'],
+                           stdout=process.PIPE, stderr=process.PIPE,
+                           text=True) as proc:
+            cpp_out, cpp_err = proc.communicate()
+        if proc.returncode == 0:
+            CONDITIONALS['HAVE_CPP'] = True
+
     # tidy-up and fall-back to defaults where necessary
     vars_ = VARS + ['GDK_DEBUG', 'GDK_NR_THREADS', 'MONETDB_MOD_PATH']
     for v in vars_:
diff --git a/testing/Mz.py.in b/testing/Mz.py.in
--- a/testing/Mz.py.in
+++ b/testing/Mz.py.in
@@ -220,14 +220,14 @@ def _configure(str):
     return str
 
 try:
-    from helpers import build_work_ctx
+    from helpers import build_work_ctx, splitcommand
 except ImportError:
     try:
-        from MonetDBtesting.helpers import build_work_ctx
+        from MonetDBtesting.helpers import build_work_ctx, splitcommand
     except ImportError:
         p = _configure(os.path.join('@QXprefix@', '@QXPYTHON_LIBDIR@'))
         sys.path.insert(0, p)
-        from MonetDBtesting.helpers import build_work_ctx
+        from MonetDBtesting.helpers import build_work_ctx, splitcommand
         if 'PYTHONPATH' in os.environ:
             p += os.pathsep + os.environ['PYTHONPATH']
         os.environ['PYTHONPATH'] = p
@@ -292,32 +292,6 @@ else:
     if ttywidth > 0 and os.name == 'nt':
         ttywidth -= 1           # don't go to the edge
 
-import string                   # for whitespace
-def splitcommand(cmd):
-    '''Like string.split, except take quotes into account.'''
-    q = None
-    w = []
-    command = []
-    for c in cmd:
-        if q:
-            if c == q:
-                q = None
-            else:
-                w.append(c)
-        elif c in string.whitespace:
-            if w:
-                command.append(''.join(w))
-            w = []
-        elif c == '"' or c == "'":
-            q = c
-        else:
-            w.append(c)
-    if w:
-        command.append(''.join(w))
-    if len(command) > 1 and command[0] == 'call':
-        del command[0]
-    return command
-
 def remove(file):
     try:
         os.remove(file)
@@ -426,6 +400,7 @@ CONDITIONALS = {
     'HAVE_PYMONETDB'       : True,  # default PYTHON can import pymonetdb
     'HAVE_PYTHON_LZ4'      : False, # module lz4 is available
     'HAVE_RUBY'            : False,
+    'HAVE_CPP'             : False,
     'HAVE_DATA_PATH'       : False,
     'MERCURIAL'            : False,
     'RELEASERUN'           : False,
@@ -2446,6 +2421,14 @@ def main(argv) :
                 print('Ruby available, but MonetDB gem not available')
     CheckClassPath()
 
+    if CheckExec('c++'):
+        with process.Popen(['c++', '--version'],
+                           stdout=process.PIPE, stderr=process.PIPE,
+                           text=True) as proc:
+            cpp_out, cpp_err = proc.communicate()
+        if proc.returncode == 0:
+            CONDITIONALS['HAVE_CPP'] = True
+
     # tidy-up and fall-back to defaults where necessary
     vars_ = VARS + ['GDK_DEBUG', 'GDK_NR_THREADS', 'MONETDB_MOD_PATH']
     for v in vars_:
diff --git a/testing/helpers.py b/testing/helpers.py
--- a/testing/helpers.py
+++ b/testing/helpers.py
@@ -8,6 +8,32 @@ import os
 import sys
 
 
+import string                   # for whitespace
+def splitcommand(cmd):
+    '''Like string.split, except take quotes into account.'''
+    q = None
+    w = []
+    command = []
+    for c in cmd:
+        if q:
+            if c == q:
+                q = None
+            else:
+                w.append(c)
+        elif c in string.whitespace:
+            if w:
+                command.append(''.join(w))
+            w = []
+        elif c == '"' or c == "'":
+            q = c
+        else:
+            w.append(c)
+    if w:
+        command.append(''.join(w))
+    if len(command) > 1 and command[0] == 'call':
+        del command[0]
+    return command
+
 def get_tests_from_all_file(fpath:str):
     res = []
     with open(fpath, 'r') as f:
@@ -45,7 +71,7 @@ def process_test_dir(dir_path:str, ctx={
     if os.path.isfile(os.path.join(dir_path, 'SingleServer')):
         folder['single_server'] = True
         with open(os.path.join(dir_path, 'SingleServer'), 'r') as f:
-            folder['server_options'] = f.read().split()
+            folder['server_options'] = splitcommand(f.read())
     allf = os.path.join(real_dir_path, 'All')
     tests = get_tests_from_all_file(allf) if os.path.isfile(allf) else []
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to