File tree Expand file tree Collapse file tree 5 files changed +75
-9
lines changed
Expand file tree Collapse file tree 5 files changed +75
-9
lines changed Original file line number Diff line number Diff line change @@ -130,9 +130,21 @@ jobs:
130130 else
131131 echo "TEST_OMP_PROCS=2" >> $GITHUB_ENV
132132 fi
133- pushd ${BUILD_DIR}
134- ctest -j ${TEST_OMP_PROCS} --output-on-failure
135- popd
133+ echo "TEST_UUID=$(uuidgen)" >> ${GITHUB_ENV}
134+ ctest -j ${TEST_OMP_PROCS} --output-on-failure --test-dir ${BUILD_DIR}
135+
136+ - name : Archive any failed test output
137+ if : failure()
138+ run : |
139+ ./utils/test/collect_failed_output.sh ${BUILD_DIR} ${BUILD_DIR}/failed-tests.${TEST_UUID}.tar
140+
141+ - name : Upload the archive of failed test output
142+ if : failure()
143+ uses : actions/upload-artifact@v4
144+ with :
145+ name : failed-tests.${{ env.TEST_UUID }}.tar
146+ path : ${{ env.BUILD_DIR }}/failed-tests.${{ env.TEST_UUID }}.tar
147+ retention-days : 2
136148
137149 - name : Install project
138150 run : cmake --install ${BUILD_DIR}
Original file line number Diff line number Diff line change @@ -29,14 +29,14 @@ endforeach()
2929
3030foreach (test IN LISTS tests)
3131 add_test (
32- NAME dftb+_ ${test}
32+ NAME app/ dftb+/ ${test}
3333 COMMAND ${srcdir} /bin/autotest2
3434 -r ${srcdir} -w ${builddir} -d ${srcdir} /bin/tagdiff
3535 -P "${TEST_RUNNER} " -p "$<TARGET_FILE:dftb+>"
3636 -G ${srcdir} /bin/globalpostrun.sh
3737 -s P,R,C,S ${test} )
3838 set_tests_properties (
39- dftb+_ ${test}
39+ app/ dftb+/ ${test}
4040 PROPERTIES
4141 ENVIRONMENT "DFTBPLUS_PARAM_DIR=${PROJECT_SOURCE_DIR} /external" )
4242endforeach ()
Original file line number Diff line number Diff line change @@ -29,13 +29,13 @@ endforeach()
2929
3030foreach (test IN LISTS tests)
3131 add_test (
32- NAME modes_ ${test}
32+ NAME app/modes/ ${test}
3333 COMMAND ${srcdir} /bin/autotest2
3434 -r ${srcdir} -w ${builddir} -d ${srcdir} /bin/tagdiff
3535 -P "${MODES_RUNNER} " -p "$<TARGET_FILE:modes>"
3636 -s P,R,C,S ${test} )
3737 set_tests_properties (
38- modes_ ${test}
38+ app/modes/ ${test}
3939 PROPERTIES
4040 ENVIRONMENT "DFTBPLUS_PARAM_DIR=${PROJECT_SOURCE_DIR} /external" )
4141endforeach ()
Original file line number Diff line number Diff line change @@ -30,10 +30,10 @@ endforeach()
3030
3131foreach (test IN LISTS tests)
3232 add_test (
33- NAME phonons_ ${test}
33+ NAME app/phonons/ ${test}
3434 COMMAND ${srcdir} /bin/autotest2
3535 -r ${srcdir} -w ${builddir} -d ${srcdir} /bin/tagdiff
3636 -P "${TEST_RUNNER} " -p "$<TARGET_FILE:phonons>"
3737 -s P,R,C,S ${test} )
38- set_tests_properties (phonons_ ${test} PROPERTIES LABELS "phonons/${test} " )
38+ set_tests_properties (app/phonons/ ${test} PROPERTIES LABELS "phonons/${test} " )
3939endforeach ()
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ #
3+ # Collect the output of failed tests into a tarball
4+ #
5+ # Usage: collect_failed_output.sh <build_dir> <archive_name>
6+ #
7+ # build_dir: The build directory where code was built and tested with CMake
8+ # archive_name: The name of the tarball to create
9+ #
10+ # The program assumes that the test names in the failure log are of the form *:<test_name>
11+ # <test_name> is the name of the test directory that is below <build_dir>/test.
12+ #
13+
14+ BUILD_DIR=" $1 "
15+ ARCHIVE_NAME=" $2 "
16+
17+ if [ " $# " -ne " 2" ]; then
18+ echo " Usage: $0 <build_dir> <archive_name>"
19+ exit 1
20+ fi
21+
22+ if [ ! -d ${BUILD_DIR} ]; then
23+ echo " No build directory found at ${BUILD_DIR} "
24+ exit 0
25+ fi
26+
27+ TEST_FAILURE_LOG=" ${BUILD_DIR} /Testing/Temporary/LastTestsFailed.log"
28+
29+ if [ ! -f ${TEST_FAILURE_LOG} ]; then
30+ echo " No test failure log found at ${TEST_FAILURE_LOG} "
31+ exit 0
32+ fi
33+
34+ TEST_ROOT_DIR=" test"
35+
36+ echo " Checking ${TEST_FAILURE_LOG} for failed tests"
37+ FAILED_TEST_DIRS=()
38+ for test in $( cat ${TEST_FAILURE_LOG} ) ; do
39+ dir=" ${TEST_ROOT_DIR} /${test#*: } "
40+ if [ -e ${BUILD_DIR} /${dir} ]; then
41+ FAILED_TEST_DIRS+=(${dir} )
42+ else
43+ echo " Ignoring non-existent test directory ${dir} "
44+ fi
45+ done
46+
47+ if [ ${# FAILED_TEST_DIRS[@]} -eq 0 ]; then
48+ echo " No failed test directories to archive, exiting..."
49+ exit 0
50+ fi
51+
52+ tar -C ${BUILD_DIR} -c -f ${ARCHIVE_NAME} ${FAILED_TEST_DIRS}
53+
54+ echo " Archive with failed test directories created at ${ARCHIVE_NAME} "
You can’t perform that action at this time.
0 commit comments