Changeset: 02c98722bf14 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/02c98722bf14 Modified Files: sql/backends/monet5/UDF/capi/Tests/All sql/backends/monet5/UDF/capi/Tests/SingleServer testing/Mtest.py.in testing/Mz.py.in testing/helpers.py Branch: Jan2022 Log Message:
For capi, add conditional for C++ compiler, add option to compile in C99 mode. diffs (175 lines): 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/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -404,6 +404,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, @@ -1238,7 +1239,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: @@ -3612,6 +3613,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) @@ -425,6 +399,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, @@ -2444,6 +2419,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 @@ -7,6 +7,32 @@ import os, sys import re +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: @@ -43,7 +69,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 [] test_names = kwargs.get('test_names') _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org