blob: 15cf03f9d2cf46a2ad0b80abeb94c98642eb3cac [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#!/bin/sh
2
3# run-ptest - 'ptest' test infrastructure shell script that
4# wraps the valgrind regression script vg_regtest.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05005#
6# Dave Lerner <dave.lerner@windriver.com>
Brad Bishopa34c0302019-09-23 22:34:48 -04007# Randy MacLeod <Randy.MacLeod@windriver.com>
Patrick Williamsc124f4f2015-09-15 14:41:29 -05008###############################################################
Brad Bishopa34c0302019-09-23 22:34:48 -04009VALGRIND_LIB=@libdir@/valgrind
Andrew Geisslerc926e172021-05-07 16:11:35 -050010VALGRIND_LIBEXECDIR=@libexecdir@/valgrind
Brad Bishopa34c0302019-09-23 22:34:48 -040011VALGRIND_BIN=@bindir@/valgrind
Brad Bishopd7bf8c12018-02-25 22:55:05 -050012
Brad Bishopa34c0302019-09-23 22:34:48 -040013LOG="${VALGRIND_LIB}/ptest/valgrind_ptest_$(date +%Y%m%d-%H%M%S).log"
14
15TOOLS="memcheck cachegrind callgrind helgrind drd massif dhat lackey none"
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060016EXP_TOOLS="exp-bbv"
Brad Bishopa34c0302019-09-23 22:34:48 -040017
18GDB_BIN=@bindir@/gdb
19cd ${VALGRIND_LIB}/ptest && ./gdbserver_tests/make_local_links ${GDB_BIN}
20
Andrew Geisslerd1e89492021-02-12 15:35:20 -060021echo "Hide valgrind tests that are non-deterministic"
22echo "Reported at https://bugs.kde.org/show_bug.cgi?id=430321"
23for i in `cat remove-for-all`; do
24 mv $i.vgtest $i.IGNORE;
25done
26
Brad Bishopa34c0302019-09-23 22:34:48 -040027arch=`arch`
28if [ "$arch" = "aarch64" ]; then
29 echo "Aarch64: Hide valgrind tests that result in defunct process and then out of memory"
30 for i in `cat remove-for-aarch64`; do
31 mv $i.vgtest $i.IGNORE;
32 done
33fi
34
Andrew Geissler595f6302022-01-24 19:11:47 +000035echo "Run non-deterministic tests using taskset to limit them to a single core."
Andrew Geissler09036742021-06-25 14:25:14 -050036for i in `cat taskset_nondeterministic_tests`; do
Andrew Geissler595f6302022-01-24 19:11:47 +000037 # The remove-for-aarch64 and taskset_nondeterministic_tests may overlap so
38 # check if a file exist.
39 if test -f "${i}.vgtest"; then
40 taskset 0x00000001 perl tests/vg_regtest --valgrind=${VALGRIND_BIN} --valgrind-lib=${VALGRIND_LIBEXECDIR} --yocto-ptest $i 2>&1|tee -a ${LOG}
41 mv $i.vgtest $i.IGNORE
42 fi
Andrew Geissler09036742021-06-25 14:25:14 -050043done
44
Brad Bishopa34c0302019-09-23 22:34:48 -040045cd ${VALGRIND_LIB}/ptest && ./tests/vg_regtest \
46 --valgrind=${VALGRIND_BIN} \
Andrew Geisslerc926e172021-05-07 16:11:35 -050047 --valgrind-lib=${VALGRIND_LIBEXECDIR} \
Brad Bishopa34c0302019-09-23 22:34:48 -040048 --yocto-ptest \
49 gdbserver_tests ${TOOLS} ${EXP_TOOLS} \
Andrew Geissler09036742021-06-25 14:25:14 -050050 2>&1|tee -a ${LOG}
Brad Bishopa34c0302019-09-23 22:34:48 -040051
52cd ${VALGRIND_LIB}/ptest && \
53 ./tests/post_regtest_checks $(pwd) \
54 gdbserver_tests ${TOOLS} ${EXP_TOOLS} \
55 2>&1|tee -a ${LOG}
56
Andrew Geissler595f6302022-01-24 19:11:47 +000057echo "Restore non-deterministic tests"
58for i in `cat taskset_nondeterministic_tests`; do
59 if test -f "${i}.vgtest.IGNORE"; then
60 mv $i.IGNORE $i.vgtest;
61 fi
62done
63
Brad Bishopa34c0302019-09-23 22:34:48 -040064if [ "$arch" = "aarch64" ]; then
65 echo "Aarch64: Restore valgrind tests that result in defunct process and then out of memory"
66 for i in `cat remove-for-aarch64`; do
67 mv $i.IGNORE $i.vgtest;
68 done
69fi
70
Andrew Geisslerd1e89492021-02-12 15:35:20 -060071echo "Restore valgrind tests that are non-deterministc"
72for i in `cat remove-for-all`; do
73 mv $i.IGNORE $i.vgtest;
74done
Brad Bishopd7bf8c12018-02-25 22:55:05 -050075
Andrew Geissler3b8a17c2021-04-15 15:55:55 -050076echo "Failed test details..."
77failed_tests=`grep FAIL: ${LOG} | awk '{print $2}'`
78for test in $failed_tests; do
79 for diff_results in `ls $test*.diff`; do
80 echo $diff_results
81 echo '************'
82 cat $diff_results
83 done
84done
85
Brad Bishopd7bf8c12018-02-25 22:55:05 -050086passed=`grep PASS: ${LOG}|wc -l`
87failed=`grep FAIL: ${LOG}|wc -l`
88skipped=`grep SKIP: ${LOG}|wc -l`
89all=$((passed + failed + skipped))
90
91( echo "=== Test Summary ==="
92 echo "TOTAL: ${all}"
93 echo "PASSED: ${passed}"
94 echo "FAILED: ${failed}"
95 echo "SKIPPED: ${skipped}"
96) | tee -a /${LOG}