Skip to content
Snippets Groups Projects
Unverified Commit 456b69a4 authored by René Fritze's avatar René Fritze
Browse files

[cmake] adds prototype work dist script

parent 3a7b3de0
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
import os
import pickle
import sys
from pprint import pprint
import subprocess
import time
from contextlib import contextmanager
import binpacking
MAXTIME = 45*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 redo_timings(argv):
builddir = argv[1]
builder_count = argv[2]
binaries = argv[3].split(';')
# list comes with a leading empty entry
testnames = argv[4].split('/')[1:]
os.chdir(builddir)
compiles = {}
testtimes = {}
testlimit = -1
binaries = binaries[:testlimit]
testnames = testnames[:testlimit]
totals = {}
for binary in binaries:
with elapsed_timer() as timer:
subprocess.check_call(['ninja', '-j1', binary])
compiles[binary] = timer()
totals[binary] = compiles[binary]
for binary, teststrings in zip(binaries, testnames):
testtimes[binary] = 0
pprint(teststrings.split('/'))
for test in teststrings.split('/'):
with elapsed_timer() as timer:
subprocess.check_call(['ctest', '-j1', '-R', test])
testtimes[binary] += timer()
totals[binary] = testtimes[binary]
print('compiles')
pprint(compiles)
print('testtimes')
pprint(testtimes)
print('totals')
pprint(totals)
pickle.dump(totals, open(os.path.join(builddir, pickle_file), 'wb'))
return totals
try:
builddir = sys.argv[1]
totals = pickle.load(open(os.path.join(builddir, pickle_file), 'rb'))
except FileNotFoundError:
totals = redo_timings(sys.argv)
b = list(totals.values())
bins = binpacking.to_constant_volume(b,MAXTIME)
pprint(bins)
\ No newline at end of file
......@@ -17,18 +17,12 @@ set(DXT_TRAVIS_BUILDER 18)
set(current_idx 0)
foreach (target ${dxt_test_binaries})
math(EXPR list_idx "${current_idx} % ${DXT_TRAVIS_BUILDER}")
list(APPEND test_names_numbered_${list_idx} ${target})
foreach(testname ${dxt_test_names_${target}})
set_tests_properties(${testname} PROPERTIES LABELS "builder_${list_idx}")
endforeach()
MATH(EXPR current_idx "${current_idx}+1")
set(all_sorted_testnames "${all_sorted_testnames}/${dxt_test_names_${target}}")
endforeach (target ${dxt_test_binaries})
# message(STATUS "LL ${all_sorted_testnames}")
MATH(EXPR max_idx "${DXT_TRAVIS_BUILDER}-1")
foreach(idx RANGE 0 ${max_idx} 1)
add_custom_target(test_binaries_builder_${idx} DEPENDS ${test_names_numbered_${idx}})
endforeach(idx RANGE 0 ${max_idx} 1)
add_custom_target(refresh_test_timings python3 ${CMAKE_SOURCE_DIR}/cmake/scripts/distribute_testing.py
"${CMAKE_BINARY_DIR}" ${DXT_TRAVIS_BUILDER} "${dxt_test_binaries}" "${all_sorted_testnames}" VERBATIM)
# link spe10 data file if present
if (NOT ${SPE10MODEL1DATA} STREQUAL "SPE10MODEL1DATA-NOTFOUND")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment