From 58d1bd0906abf91e904c08dc50164b813f0cc084 Mon Sep 17 00:00:00 2001 From: Dan Villiom Podlaski Christiansen Date: Wed, 23 Sep 2020 20:00:59 +0200 Subject: [PATCH 1/7] testrunner: allow specifying cherrypicked tests on the command line --HG-- branch : testsuite-fixes --- testrunner/runner.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testrunner/runner.py b/testrunner/runner.py index c4a05848c3..553efe37a4 100644 --- a/testrunner/runner.py +++ b/testrunner/runner.py @@ -300,9 +300,10 @@ class RunParam(object): timeout = None cherrypick = None - def __init__(self, root): + def __init__(self, root, args): self.root = root self.self = self + self.cherrypick = args def startup(self): pass @@ -389,7 +390,7 @@ def main(args): testdirs = [] - run_param = RunParam(root) + run_param = RunParam(root, args[1:]) # the config files are python files whose run overrides the content # of the run_param instance namespace # in that code function overriding method should not take self -- GitLab From 3ebdc43adb6506e812406c28cb7567de460d288f Mon Sep 17 00:00:00 2001 From: Dan Villiom Podlaski Christiansen Date: Wed, 23 Sep 2020 20:01:10 +0200 Subject: [PATCH 2/7] testrunner: add --fail-fast argument --HG-- branch : testsuite-fixes --- testrunner/runner.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/testrunner/runner.py b/testrunner/runner.py index 553efe37a4..22ed0af430 100644 --- a/testrunner/runner.py +++ b/testrunner/runner.py @@ -109,9 +109,11 @@ def getsignalname(n): return 'signal %d' % (n,) def execute_test(cwd, test, out, logfname, interp, test_driver, - do_dry_run=False, timeout=None, + do_dry_run=False, timeout=None, fail_fast=False, _win32=(sys.platform=='win32')): args = interp + test_driver + if fail_fast: + args.append('-x') args += ['-p', 'resultlog', '--resultlog=%s' % logfname, #'--junitxml=%s.junit' % logfname, @@ -167,7 +169,7 @@ def interpret_exitcode(exitcode, test, logdata=""): failure = False return failure, extralog -def worker(num, n, run_param, testdirs, result_queue): +def worker(num, n, run_param, testdirs, fail_fast, result_queue): sessdir = run_param.sessdir root = run_param.root get_test_driver = run_param.get_test_driver @@ -192,7 +194,7 @@ def worker(num, n, run_param, testdirs, result_queue): test_driver = get_test_driver(test) exitcode = execute_test(root, test, one_output, logfname, interp, test_driver, do_dry_run=dry_run, - timeout=timeout) + timeout=timeout, fail_fast=fail_fast) cleanup(test) except: @@ -219,15 +221,15 @@ def worker(num, n, run_param, testdirs, result_queue): invoke_in_thread = thread.start_new_thread -def start_workers(n, run_param, testdirs): +def start_workers(n, run_param, fail_fast, testdirs): result_queue = Queue.Queue() for i in range(n): invoke_in_thread(worker, (i, n, run_param, testdirs, - result_queue)) + fail_fast, result_queue)) return result_queue -def execute_tests(run_param, testdirs, logfile, out): +def execute_tests(run_param, testdirs, fail_fast, logfile, out): sessdir = py.path.local.make_numbered_dir(prefix='usession-testrunner-', keep=4) run_param.sessdir = sessdir @@ -248,7 +250,7 @@ def execute_tests(run_param, testdirs, logfile, out): out.write("-- %s\n" % testname) out.write("-- total: %d to run\n" % len(testdirs)) - result_queue = start_workers(N, run_param, testdirs) + result_queue = start_workers(N, run_param, fail_fast, testdirs) done = 0 started = 0 @@ -282,6 +284,9 @@ def execute_tests(run_param, testdirs, logfile, out): if logdata: logfile.write(logdata) + if fail_fast and failure: + break + run_param.shutdown() return failure @@ -297,6 +302,7 @@ class RunParam(object): test_driver = [pytestpath] parallel_runs = 1 + fail_fast = False timeout = None cherrypick = None @@ -370,6 +376,9 @@ def main(args): parser.add_option("--dry-run", dest="dry_run", default=False, action="store_true", help="dry run"), + parser.add_option("--fail-fast", dest="fail_fast", default=False, + action="store_true", + help="stop at the first failure or error"), parser.add_option("--timeout", dest="timeout", default=None, type="int", help="timeout in secs for test processes") @@ -419,7 +428,7 @@ def main(args): print >>out, '\n'.join([str((k, getattr(run_param, k))) \ for k in dir(run_param) if k[:2] != '__']) - res = execute_tests(run_param, testdirs, logfile, out) + res = execute_tests(run_param, testdirs, opts.fail_fast, logfile, out) if res: sys.exit(1) -- GitLab From c30b910753be2c8708f44836bcdc3685ff772014 Mon Sep 17 00:00:00 2001 From: Dan Villiom Podlaski Christiansen Date: Wed, 23 Sep 2020 21:28:14 +0200 Subject: [PATCH 3/7] test_recompiler: xfail the long double test This fails on both Darwin/x86-64 and Linux/ARM64, and AFAICT the relevant 'shape', 'g', isn't defined anywhere. --HG-- branch : testsuite-fixes --- pypy/module/_cffi_backend/test/test_recompiler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py index ac0d4193e2..28363d8434 100644 --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -1616,6 +1616,7 @@ class AppTestRecompiler: res = lib.bok() assert [res.a, res.b, res.c] == [10, 20, 30] + @pytest.mark.xfail(reason="long double not implemented in ctypes") def test_extern_python_long_double(self): ffi, lib = self.prepare(""" extern "Python" int bar(int, long double, int); -- GitLab From 1e85a3c8868ed74476fd6c6409eda2e17ceefc10 Mon Sep 17 00:00:00 2001 From: Dan Villiom Podlaski Christiansen Date: Wed, 23 Sep 2020 12:57:09 +0200 Subject: [PATCH 4/7] test_newformat: try Danish locale first, as it works as expected on macOS --HG-- branch : testsuite-fixes --- pypy/objspace/std/test/test_newformat.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pypy/objspace/std/test/test_newformat.py b/pypy/objspace/std/test/test_newformat.py index 18e09e05ef..635c93638c 100644 --- a/pypy/objspace/std/test/test_newformat.py +++ b/pypy/objspace/std/test/test_newformat.py @@ -391,14 +391,23 @@ class AppTestFloatFormatting: def test_locale_german(self): import locale - for name in ['de_DE', 'de_DE.utf8']: + # German and Danish use the exact same numeric separators, but + # for some reason or other, macOS disagrees, and seems to + # specify no thousand separator in German, even in CPython + # 3.8. As macOS always includes all available locales, we try + # the Danish one first. On Linux, however, locales may require + # explicit installation, so Danish may not, in fact, be + # present. Fortunately, the German locale behaves sensibly + # there, so we can safely fallback to this ever so slightly + # more prevalent language. + for name in ['da_DK', 'da_DK.UTF-8', 'de_DE', 'de_DE.UTF-8']: try: locale.setlocale(locale.LC_NUMERIC, name) break except locale.Error: pass else: - skip("no german locale") + skip("neither German or Danish locale available") x = 1234.567890 try: assert locale.format('%g', x, grouping=True) == '1.234,57' -- GitLab From b656598e3246f422588e440ab076a5c7bccfab78 Mon Sep 17 00:00:00 2001 From: Dan Villiom Podlaski Christiansen Date: Wed, 23 Sep 2020 15:28:57 +0200 Subject: [PATCH 5/7] cparser: make the two NonImplementedErrors more helpful --HG-- branch : testsuite-fixes --- pypy/module/cpyext/cparser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pypy/module/cpyext/cparser.py b/pypy/module/cpyext/cparser.py index 3b4815fc6b..6959043757 100644 --- a/pypy/module/cpyext/cparser.py +++ b/pypy/module/cpyext/cparser.py @@ -830,7 +830,7 @@ class CTypeSpace(object): return rffi.CArrayPtr(TO) elif isinstance(obj, model.FunctionPtrType): if obj.ellipsis: - raise NotImplementedError + raise NotImplementedError('cannot handle functions with variadic arguments') args = [self.convert_type(arg) for arg in obj.args] res = self.convert_type(obj.result) return lltype.Ptr(lltype.FuncType(args, res)) @@ -839,7 +839,7 @@ class CTypeSpace(object): elif isinstance(obj, model.ArrayType): return rffi.CFixedArray(self.convert_type(obj.item), obj.length) else: - raise NotImplementedError + raise NotImplementedError("unsupported type %s" % (type(obj),)) def gettype(self, cdecl): try: -- GitLab From c7b402744202da7c538e504ef8f83981c97b765e Mon Sep 17 00:00:00 2001 From: Dan Villiom Podlaski Christiansen Date: Wed, 23 Sep 2020 20:51:12 +0200 Subject: [PATCH 6/7] test_recompile: fix test --HG-- branch : testsuite-fixes --- pypy/module/_cffi_backend/test/test_recompiler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py index 28363d8434..413cf15aff 100644 --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -11,7 +11,10 @@ def get_ext_suffix(): # soabi is None on cpython < 3.7 (incl 2.7), 'pypy-73' on pypy2 v7.3.1 # and something like 'cpython-38-x86_64-linux-gnu' on cpython 3.8 soabi = get_config_var('SOABI') or '' - ret = soabi + get_config_var('SO') + so = get_config_var('SO') + if soabi and so.startswith('.' + soabi): + return so[1:] + ret = soabi + so # either '.so' or 'pypy-73.so' if ret[0] == '.': return ret[1:] -- GitLab From a7a0d5c5fa671a74ca9c903ae877697b6813acd7 Mon Sep 17 00:00:00 2001 From: Dan Villiom Podlaski Christiansen Date: Fri, 2 Oct 2020 11:44:25 +0200 Subject: [PATCH 7/7] test_recompiler: restrict XFAIL to running under PyPy --HG-- branch : testsuite-fixes --- pypy/module/_cffi_backend/test/test_recompiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py index 413cf15aff..dfa0c26b96 100644 --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -1619,7 +1619,7 @@ class AppTestRecompiler: res = lib.bok() assert [res.a, res.b, res.c] == [10, 20, 30] - @pytest.mark.xfail(reason="long double not implemented in ctypes") + @pytest.mark.xfail("'__pypy__' in sys.modules") def test_extern_python_long_double(self): ffi, lib = self.prepare(""" extern "Python" int bar(int, long double, int); -- GitLab