@@ -67,6 +67,7 @@ TARGETS += net/openvswitch
TARGETS += net/tcp_ao
TARGETS += net/netfilter
TARGETS += nsfs
+TARGETS += perf
TARGETS += perf_events
TARGETS += pidfd
TARGETS += pid_namespace
new file mode 100644
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+
+TEST_PROGS := perf_test.sh
+
+include ../lib.mk
new file mode 100755
@@ -0,0 +1,30 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+skip() {
+ echo "SKIP: $1"
+ exit 4
+}
+
+fail() {
+ echo "FAIL: $1"
+ exit 255
+}
+
+if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
+ [ "$(id -u)" -ne 0 ] && \
+ skip "this test must be run as root."
+ which perf >/dev/null 2>&1 || \
+ skip "perf is not installed."
+
+ cmd_output=$(perf test -vv 2>&1)
+ perf_ret=$?
+
+ if [ $perf_ret -ne 0 ]; then
+ (IFS='\n'; echo $cmd_output)
+ fail "perf command returns non-zero."
+ elif [[ $cmd_output == *"FAILED!"* ]]; then
+ (IFS='\n'; echo $cmd_output)
+ fail "perf test got FAILED!"
+ fi
+fi
new file mode 100644
@@ -0,0 +1 @@
+timeout=600
The perf test supports testing many functions and includes a way to detect the prerequisites for each test case. Add a script to launch the perf test. Signed-off-by: Jeremy Szu <jszu@nvidia.com> --- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/perf/Makefile | 5 ++++ tools/testing/selftests/perf/perf_test.sh | 30 +++++++++++++++++++++++ tools/testing/selftests/perf/settings | 1 + 4 files changed, 37 insertions(+) create mode 100644 tools/testing/selftests/perf/Makefile create mode 100755 tools/testing/selftests/perf/perf_test.sh create mode 100644 tools/testing/selftests/perf/settings