diff --git a/cmake/scripts/compiles_totals.pickle b/cmake/scripts/compiles_totals.pickle deleted file mode 100644 index 754e4db1b7d1c7b99480d3829664b2c115ff0f40..0000000000000000000000000000000000000000 Binary files a/cmake/scripts/compiles_totals.pickle and /dev/null differ diff --git a/cmake/scripts/distribute_testing.py b/cmake/scripts/distribute_testing.py deleted file mode 100644 index 9e93d4d8068aa04d5426221aa7279533fc317b20..0000000000000000000000000000000000000000 --- a/cmake/scripts/distribute_testing.py +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/env python3 - -import os -import pickle -import sys -from pprint import pprint -import subprocess -import time -from contextlib import contextmanager -import binpacking -from multiprocessing import Pool, cpu_count - - -MAXTIME = 8*60 -pickle_file = 'totals.pickle' - - -@contextmanager -def elapsed_timer(): - clock = time.time - start = clock() - elapser = lambda: clock() - start - yield lambda: elapser() - end = clock() - elapser = lambda: end-start - - -def _compile(binary): - with elapsed_timer() as timer: - try: - _ = subprocess.check_output(['ninja', '-j1', binary], universal_newlines=True, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as cpe: - if 'Timeout' not in cpe.output: - raise cpe - print('Timeout in compile {}'.format(binary)) - return timer() - - -def _run_tests(tpl): - binary, teststrings = tpl - testtimes = 0 - for test in teststrings.split(';'): - with elapsed_timer() as timer: - try: - _ = subprocess.check_output(['ctest', '-j1', '-N', '-R', test], universal_newlines=True, - stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as cpe: - if 'Timeout' not in cpe.output: - raise cpe - # be pessimistic and double the timeout value as time for this run - testtimes += timer() - print('Timeout in {} from {}'.format(test, binary)) - testtimes += timer() - return testtimes - - -def _redo(processes, keys, *args): - try: - with Pool(processes=processes) as pool: - result = pool.map(*args) - return {k: v for k,v in zip(keys, result)} - except subprocess.CalledProcessError as cpe: - print('*'*79) - print(cpe.stdout) - print(cpe.stderr) - print('*' * 79) - raise cpe - -def do_timings(builddir, pickledir, binaries, testnames, processes): - os.chdir(builddir) - testlimit = -1 - - binaries = binaries[:testlimit] - compiles_fn = os.path.join(pickledir, 'compiles_' + pickle_file) - try: - compiles = pickle.load(open(compiles_fn, 'rb')) - if set(compiles.keys()) != set(binaries): - print('redoing compiles due to mismatched binaries') - compiles = _redo(processes, binaries, _compile, binaries) - except FileNotFoundError: - print('redoing compiles due to missing pickle') - compiles = _redo(processes, binaries, _compile, binaries) - pickle.dump(compiles, open(compiles_fn, 'wb')) - - testnames = testnames[:testlimit] - testruns_fn = os.path.join(pickledir, 'testruns_' + pickle_file) - try: - loaded_testnames, testruns = pickle.load(open(testruns_fn, 'rb')) - if set(compiles.keys()) != set(binaries) or loaded_testnames != testnames: - print('redoing tests due to mismatched binaries/testnames') - testruns = _redo(processes, binaries, _run_tests, zip(binaries, testnames)) - except FileNotFoundError: - print('redoing tests due to missing pickle') - testruns = _redo(processes, binaries, _run_tests, zip(binaries, testnames)) - pickle.dump((testnames, testruns), open(testruns_fn, 'wb')) - - totals = {n: compiles[n]+testruns[n] for n in binaries} - pickle.dump(totals, open(os.path.join(pickledir, pickle_file), 'wb')) - # print('totals') - # pprint(totals) - return totals - - -# list comes with a leading empty entry -all_testnames = sys.argv[4].split('/')[1:] -builddir = sys.argv[1] -module_root = sys.argv[2] -pickledir = os.path.join(module_root, 'cmake', 'scripts') -testdir = os.path.join(module_root, 'dune', 'gdt', 'test') -cmake_outfile = os.path.join(testdir, 'builder_definitions.cmake') -binaries = sys.argv[3].split(';') -testname_map = {b: t.split(';') for b,t in zip(binaries, all_testnames)} -processes = cpu_count() - -totals = do_timings(builddir, pickledir, binaries, all_testnames, processes) - -b = list(totals.keys()) -bins = binpacking.to_constant_volume(totals, MAXTIME) -# for idx, bin in enumerate(bins): -# pprint('Bin {} vol: {}'.format(idx, sum(bin.values()))) -# pprint(bin) - -with open(cmake_outfile, 'wt') as out: - for idx, bin in enumerate(bins): - out.write('add_custom_target(test_binaries_builder_{} DEPENDS {})\n'.format(idx, ' '.join(bin.keys()))) - for binary in bin.keys(): - for testname in testname_map[binary]: - out.write('set_tests_properties({} PROPERTIES LABELS "builder_{}")\n'.format(testname, idx)) diff --git a/cmake/scripts/testruns_totals.pickle b/cmake/scripts/testruns_totals.pickle deleted file mode 100644 index 1ff8479a4b3754b9d7e164ebca260aaf106c9014..0000000000000000000000000000000000000000 Binary files a/cmake/scripts/testruns_totals.pickle and /dev/null differ diff --git a/dune/gdt/test/CMakeLists.txt b/dune/gdt/test/CMakeLists.txt index ed0612873c50367c8382b2b29b79ba176b5fcb6a..bf0cb2ca6163bb2ce8cb29ce3377d328908322b7 100644 --- a/dune/gdt/test/CMakeLists.txt +++ b/dune/gdt/test/CMakeLists.txt @@ -12,15 +12,7 @@ BEGIN_TESTCASES() END_TESTCASES() -set(DXT_TRAVIS_BUILDER 18) - -set(current_idx 0) - -foreach (target ${dxt_test_binaries}) - set(all_sorted_testnames "${all_sorted_testnames}/${dxt_test_names_${target}}") -endforeach (target ${dxt_test_binaries}) -add_custom_target(refresh_test_timings python3 ${CMAKE_SOURCE_DIR}/cmake/scripts/distribute_testing.py - "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}" "${dxt_test_binaries}" "${all_sorted_testnames}" VERBATIM) +# generated from dune-xt-common's distribute_testing.py include("builder_definitions.cmake") # link spe10 data file if present diff --git a/dune/gdt/test/compiles_totals.pickle b/dune/gdt/test/compiles_totals.pickle new file mode 100644 index 0000000000000000000000000000000000000000..4fc411f1b6ef7c87799ee9d2249400204e8d47ce Binary files /dev/null and b/dune/gdt/test/compiles_totals.pickle differ diff --git a/dune/gdt/test/testruns_totals.pickle b/dune/gdt/test/testruns_totals.pickle new file mode 100644 index 0000000000000000000000000000000000000000..48d8c99caae911bd3b4ea3f17732ec46e54ed96a Binary files /dev/null and b/dune/gdt/test/testruns_totals.pickle differ