Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test: Replace arm spe fork test workload with sqrtloop

So that it can get rid of requirement of a compiler. I've also removed
killall as it'll kill perf process now and run the test workload for 10
sec instead.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: James Clark <james.clark@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Zhengjun Xing <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20221116233854.1596378-9-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
e011979e 39281709

+1 -43
+1 -43
tools/perf/tests/shell/test_arm_spe_fork.sh
··· 11 11 12 12 skip_if_no_arm_spe_event || exit 2 13 13 14 - # skip if there's no compiler 15 - if ! [ -x "$(command -v cc)" ]; then 16 - echo "failed: no compiler, install gcc" 17 - exit 2 18 - fi 19 - 20 - TEST_PROGRAM_SOURCE=$(mktemp /tmp/__perf_test.program.XXXXX.c) 21 - TEST_PROGRAM=$(mktemp /tmp/__perf_test.program.XXXXX) 14 + TEST_PROGRAM="perf test -w sqrtloop 10" 22 15 PERF_DATA=$(mktemp /tmp/__perf_test.perf.data.XXXXX) 23 16 PERF_RECORD_LOG=$(mktemp /tmp/__perf_test.log.XXXXX) 24 17 ··· 20 27 echo "Cleaning up files..." 21 28 rm -f ${PERF_RECORD_LOG} 22 29 rm -f ${PERF_DATA} 23 - rm -f ${TEST_PROGRAM_SOURCE} 24 - rm -f ${TEST_PROGRAM} 25 30 } 26 31 27 32 trap cleanup_files exit term int 28 - 29 - # compile test program 30 - cat << EOF > $TEST_PROGRAM_SOURCE 31 - #include <math.h> 32 - #include <stdio.h> 33 - #include <stdlib.h> 34 - #include <unistd.h> 35 - #include <sys/wait.h> 36 - 37 - int workload() { 38 - while (1) 39 - sqrt(rand()); 40 - return 0; 41 - } 42 - 43 - int main() { 44 - switch (fork()) { 45 - case 0: 46 - return workload(); 47 - case -1: 48 - return 1; 49 - default: 50 - wait(NULL); 51 - } 52 - return 0; 53 - } 54 - EOF 55 - 56 - echo "Compiling test program..." 57 - CFLAGS="-lm" 58 - cc $TEST_PROGRAM_SOURCE $CFLAGS -o $TEST_PROGRAM || exit 1 59 33 60 34 echo "Recording workload..." 61 35 perf record -o ${PERF_DATA} -e arm_spe/period=65536/ -vvv -- $TEST_PROGRAM > ${PERF_RECORD_LOG} 2>&1 & ··· 38 78 39 79 kill $PERFPID 40 80 wait $PERFPID 41 - # test program may leave an orphan process running the workload 42 - killall $(basename $TEST_PROGRAM) 43 81 44 82 if [ "$log0" = "$log1" ]; 45 83 then