From 5305f8e97501e2f53348c8b703bd6f86e5fd517c Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez-Fernandez Date: Jul 03 2023 22:40:00 +0000 Subject: perf: run version, record, and report tests Signed-off-by: Carlos Rodriguez-Fernandez --- diff --git a/tests/p_perf/0_install_perf.sh b/tests/p_perf/0_install_perf.sh new file mode 100755 index 0000000..f146ff0 --- /dev/null +++ b/tests/p_perf/0_install_perf.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + +t_Log "Running $0 -installing libbpf-tools." +t_InstallPackage perf diff --git a/tests/p_perf/perf_tests.sh b/tests/p_perf/perf_tests.sh new file mode 100755 index 0000000..3cdec2a --- /dev/null +++ b/tests/p_perf/perf_tests.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + +t_Log "Running $0 - perf tests" + +tests_in_order=( + "perf version" + "perf record -F 49 -a -g -- sleep 1" + "perf report --stdio > /dev/null 2>&1" +) + +for cmd in "${tests_in_order[@]}"; do + t_Log "Running $0 - perf test: ${cmd}" + if ! eval "${cmd}" > /dev/null 2>&1; then + t_Log "FAIL: $0: perf test: ${cmd}" + exit 1 + else + t_Log "PASS: $0: perf test: ${cmd}" + fi +done + +t_Log "Cleaning up $0 - perf tests data" +rm -f perf.data