From a66d24971f85db3988e04b8eaa82fcdc2681dade Mon Sep 17 00:00:00 2001 From: Thom Wiggers Date: Tue, 31 Mar 2020 14:03:02 +0200 Subject: [PATCH] Speed up circleci tests --- .circleci/config.yml | 1 + test/test_char.py | 2 +- test/test_duplicate_consistency.py | 48 +++++++++++++++++------------- test/test_linter.py | 5 ++-- 4 files changed, 32 insertions(+), 24 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8e9a1037..c2340014 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,6 +22,7 @@ version: 2.1 command: | docker run -e CI=true -e PQCLEAN_ONLY_TYPES -e PQCLEAN_ONLY_DIFF=1 -e PQCLEAN_SKIP_SCHEMES=sphincs-haraka-128f-robust,sphincs-haraka-192s-robust,sphincs-sha256-128f-robust,sphincs-sha256-192s-robust,sphincs-shake256-128f-robust,sphincs-shake256-192s-robust,sphincs-haraka-128f-simple,sphincs-haraka-192s-simple,sphincs-sha256-128f-simple,sphincs-sha256-192s-simple,sphincs-shake256-128f-simple,sphincs-shake256-192s-simple,sphincs-haraka-128s-robust,sphincs-haraka-256f-robust,sphincs-sha256-128s-robust,sphincs-sha256-256f-robust,sphincs-shake256-128s-robust,sphincs-shake256-256f-robust,sphincs-haraka-128s-simple,sphincs-haraka-256f-simple,sphincs-sha256-128s-simple,sphincs-sha256-256f-simple,sphincs-shake256-128s-simple,sphincs-shake256-256f-simple,sphincs-haraka-192f-robust,sphincs-haraka-256s-robust,sphincs-sha256-192f-robust,sphincs-sha256-256s-robust,sphincs-shake256-192f-robust,sphincs-shake256-256s-robust,sphincs-haraka-192f-simple,sphincs-haraka-256s-simple,sphincs-sha256-192f-simple,sphincs-sha256-256s-simple,sphincs-shake256-192f-simple,sphincs-shake256-256s-simple --rm -v `pwd`:`pwd` -w `pwd` -v ~/ccache:/ccache "pqclean/ci-container:$ARCH" /bin/bash -c " uname -a && + PQCLEAN_SKIP_TESTS=api_h,char,duplicate_consistency,metadata,preprocessor,no_symlinks,microsoft_nmakefile_present,makefile_present,format,license export CCACHE_NOSTATS=1 && export CCACHE_DIR=/ccache && export CCACHE_SLOPPINESS=include_file_mtime && diff --git a/test/test_char.py b/test/test_char.py index 890d35db..a81a9d53 100644 --- a/test/test_char.py +++ b/test/test_char.py @@ -39,8 +39,8 @@ def walk_tree(ast, parent=[]): pqclean.Scheme.all_implementations(), ids=str, ) -@helpers.filtered_test @helpers.skip_windows() +@helpers.filtered_test def test_char(implementation): errors = [] for fname in os.listdir(implementation.path()): diff --git a/test/test_duplicate_consistency.py b/test/test_duplicate_consistency.py index a6e0763f..2876569b 100644 --- a/test/test_duplicate_consistency.py +++ b/test/test_duplicate_consistency.py @@ -17,28 +17,34 @@ sys.tracebacklimit = 0 def pytest_generate_tests(metafunc): ids = [] argvalues = [] - for scheme in pqclean.Scheme.all_schemes(): - for implementation in scheme.implementations: - if os.path.isfile( - os.path.join( + if 'duplicate_consistency' not in os.environ.get('PQCLEAN_SKIP_TESTS', '').split(','): + for scheme in pqclean.Scheme.all_schemes(): + for implementation in scheme.implementations: + if os.path.isfile( + os.path.join( + 'duplicate_consistency', + '{}_{}.yml'.format(scheme.name, implementation.name))): + metafile = os.path.join( 'duplicate_consistency', - '{}_{}.yml'.format(scheme.name, implementation.name))): - metafile = os.path.join( - 'duplicate_consistency', - '{}_{}.yml'.format(scheme.name, implementation.name)) - with open(metafile, encoding='utf-8') as f: - metadata = yaml.safe_load(f.read()) - for group in metadata['consistency_checks']: - source = pqclean.Implementation.by_name( - group['source']['scheme'], - group['source']['implementation']) - argvalues.append( - (implementation, source, group['files'])) - ids.append( - "{metafile}: {scheme.name} {implementation.name}" - .format(scheme=scheme, - implementation=implementation, - metafile=metafile)) + '{}_{}.yml'.format(scheme.name, implementation.name)) + with open(metafile, encoding='utf-8') as f: + metadata = yaml.safe_load(f.read()) + for group in metadata['consistency_checks']: + source = pqclean.Implementation.by_name( + group['source']['scheme'], + group['source']['implementation']) + argvalues.append( + (implementation, source, group['files'])) + ids.append( + "{metafile}: {scheme.name} {implementation.name}" + .format(scheme=scheme, + implementation=implementation, + metafile=metafile)) + else: + # Placeholders so we don't crash + ids = ['dummy'] + argvalues = [('dummy', 'dummy', 'dummy')] + metafunc.parametrize(('implementation', 'source', 'files'), argvalues, ids=ids) diff --git a/test/test_linter.py b/test/test_linter.py index 204a4c35..c6b13749 100644 --- a/test/test_linter.py +++ b/test/test_linter.py @@ -19,8 +19,9 @@ additional_flags = [] #['-fix-errors'] @helpers.skip_windows() @helpers.filtered_test def test_clang_tidy(implementation: pqclean.Implementation): - if platform.machine() in ['i386']: - raise unittest.SkipTest("Clang-tidy has false-positives on i386") + if platform.machine() in ['armv7l']: + # armv7l: slow, not more useful than i386 + raise unittest.SkipTest() helpers.ensure_available('clang-tidy') cfiles = implementation.cfiles() common_files = glob(os.path.join('..', 'common', '*.c'))