| 1 | |
| 2 | |
| 3 | |
| 4 |
|
| 5 | set -e
|
| 6 |
|
| 7 | err=0
|
| 8 | perfdata=$(mktemp /tmp/__perf_c2c_test.perf.data.XXXXX)
|
| 9 |
|
| 10 | cleanup() {
|
| 11 | rm -f "${perfdata}"
|
| 12 | rm -f "${perfdata}".old
|
| 13 | trap - EXIT TERM INT
|
| 14 | }
|
| 15 |
|
| 16 | trap_cleanup() {
|
| 17 | echo "Unexpected signal in ${FUNCNAME[1]}"
|
| 18 | cleanup
|
| 19 | exit 1
|
| 20 | }
|
| 21 | trap trap_cleanup EXIT TERM INT
|
| 22 |
|
| 23 | check_c2c_support() {
|
| 24 | |
| 25 | if ! perf c2c record -o "${perfdata}" -- true > /dev/null 2>&1 ; then
|
| 26 | return 1
|
| 27 | fi
|
| 28 | return 0
|
| 29 | }
|
| 30 |
|
| 31 | test_c2c_record_report() {
|
| 32 | echo "c2c record and report test"
|
| 33 | if ! check_c2c_support ; then
|
| 34 | echo "c2c record and report test [Skipped: perf c2c record failed (possibly missing hardware support)]"
|
| 35 | err=2
|
| 36 | return
|
| 37 | fi
|
| 38 |
|
| 39 | |
| 40 | if ! perf c2c record -o "${perfdata}" -- perf test -w datasym 1 > /dev/null 2>&1 ; then
|
| 41 | echo "c2c record and report test [Skipped: perf c2c record failed during workload]"
|
| 42 | return
|
| 43 | fi
|
| 44 |
|
| 45 | if ! perf c2c report -i "${perfdata}" --stdio > /dev/null 2>&1 ; then
|
| 46 | echo "c2c record and report test [Failed: report failed]"
|
| 47 | err=1
|
| 48 | return
|
| 49 | fi
|
| 50 |
|
| 51 | if ! perf c2c report -i "${perfdata}" -N > /dev/null 2>&1 ; then
|
| 52 | echo "c2c record and report test [Failed: report -N failed]"
|
| 53 | err=1
|
| 54 | return
|
| 55 | fi
|
| 56 |
|
| 57 | echo "c2c record and report test [Success]"
|
| 58 | }
|
| 59 |
|
| 60 | test_c2c_record_report
|
| 61 | cleanup
|
| 62 | exit $err
|