diff --git a/skipped-tests.list b/skipped-tests.list index 55c0125..ce3167e 100644 --- a/skipped-tests.list +++ b/skipped-tests.list @@ -7,6 +7,4 @@ # Separated by | 8|tests/p_gzip/30-gzexe-test|https://apps.centos.org/kanboard/project/23/task/833 8|tests/p_diffutils/10-cmp-tests|https://bugzilla.redhat.com/show_bug.cgi?id=1732960 -9|tests/p_perf/perf_tests.sh| -8|tests/p_perf/perf_tests.sh| -7|tests/p_perf/perf_tests.sh| + diff --git a/tests/p_perf/00_install_perf.sh b/tests/p_perf/00_install_perf.sh new file mode 100755 index 0000000..ed9381b --- /dev/null +++ b/tests/p_perf/00_install_perf.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + +t_Log "Running $0 -installing perf" +t_InstallPackage perf diff --git a/tests/p_perf/01_perf_version.sh b/tests/p_perf/01_perf_version.sh new file mode 100755 index 0000000..dc515d8 --- /dev/null +++ b/tests/p_perf/01_perf_version.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + + +t_Log "Running $0" + +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + +if ! perf version > ${output_file} 2>&1; then + cat ${output_file} + t_CheckExitStatus 1 +fi + +t_CheckExitStatus 0 diff --git a/tests/p_perf/02_perf_functionality.sh b/tests/p_perf/02_perf_functionality.sh new file mode 100755 index 0000000..4837617 --- /dev/null +++ b/tests/p_perf/02_perf_functionality.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + + +t_Log "Running $0" + +output_file=$(mktemp) +trap "rm -f ${output_file}; rm -f perf.data" EXIT + +t_Log "Running $0: perf record" +if ! perf record -F 49 -a -g -- sleep 1 > ${output_file} 2>&1; then + cat ${output_file} + t_CheckExitStatus 1 +fi + +t_Log "Running $0: perf report" +if ! perf report --stats > ${output_file} 2>&1; then + cat ${output_file} + t_CheckExitStatus 1 +fi + +t_CheckExitStatus 0 diff --git a/tests/p_perf/0_install_perf.sh b/tests/p_perf/0_install_perf.sh deleted file mode 100755 index f146ff0..0000000 --- a/tests/p_perf/0_install_perf.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/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 deleted file mode 100755 index 2db8f35..0000000 --- a/tests/p_perf/perf_tests.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 --stats" -) - -output_file=$(mktemp) -trap "rm -f ${output_file}" EXIT - -for cmd in "${tests_in_order[@]}"; do - t_Log "Running $0 - perf test: ${cmd}" - if ! eval "${cmd}" > ${output_file} 2>&1; then - t_Log "FAIL: $0: ${cmd}" - cat ${output_file} - exit 1 - else - t_Log "PASS: $0: perf test: ${cmd}" - fi -done - -t_Log "Cleaning up $0 - perf tests data" -rm -f perf.data