Skip to contentSkip to conversation

perf test: Adding an entry for the perftool-testsuite - CORRECT

PATCH In review Michael Petlan 1 participant 1 message Mar 16, 2016 1 message not in the archive perf events

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/9 perf test: Adding an entry for the perftool-testsuite - CORRECT

THIS SHOULD BE CORRECT, please ignore the previous "[PATCH 1/9]".
-----------------------------------------------------------------------

In order to be able to run the bash/subcommand-based testsuite directly from perf test a new perf-test entry has been created for it.

The driver (suite.c) runs all the tests that it finds in the testsuite
directory: tools/perf/testsuite/ (rather ./testsuite as it expects it
it being run from the perf's directory).

In case the testsuite is not found, the testcase is skipped. If this is not the desired behaviour, some packaging will be needed.

Usage:
./perf test suite

or
./perf test suite -v
./perf test suite -vv

(for the verbose output)

---
 tools/perf/tests/Build          |   1 +
 tools/perf/tests/builtin-test.c |   4 ++
 tools/perf/tests/suite.c        | 150 ++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/suite.h        |  30 ++++++++
 tools/perf/tests/tests.h        |   1 +
 5 files changed, 186 insertions(+)
 create mode 100644 tools/perf/tests/suite.c
 create mode 100644 tools/perf/tests/suite.h
tools/perf/tests/Build +1 -0
index 1ba628e..c26fd8b 100644
@@ -37,6 +37,7 @@ perf-y += topology.o
 perf-y += cpumap.o
 perf-y += stat.o
 perf-y += event_update.o
+perf-y += suite.o
 
 $(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c tests/Build
 	$(call rule_mkdir)
tools/perf/tests/builtin-test.c +4 -0
index f2b1dca..14246a1 100644
@@ -204,6 +204,10 @@ static struct test generic_tests[] = {
 		.func = test__event_update,
 	},
 	{
+		.desc = "Testsuite",
+		.func = test__suite,
+	},
+	{
 		.func = NULL,
 	},
 };
tools/perf/tests/suite.c new file +150 -0

150 lines not on this page · raw message

tools/perf/tests/suite.h new file +30 -0
new file mode 100644
index 0000000..53c768b
@@ -0,0 +1,30 @@
+#ifndef PERF_TEST_SUITE_H
+#define PERF_TEST_SUITE_H
+
+#include <linux/compiler.h>
+#include "tests.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <string.h>
+
+
+/* verbosity */
+extern int verbose;
+
+/* runs a shell script */
+int _run_shell(const char *script);
+
+/* checks for existence of a file and runs it */
+int run_shell(const char *script);
+
+/* if a script is available, run it, otherwise ignore it */
+int try_shell(const char *script);
+
+/* runs a group of tests ("base_something", ...) */
+int run_group(const char *path);
+
+#endif
tools/perf/tests/tests.h +1 -0
index 82b2b5e..af516de 100644
@@ -85,6 +85,7 @@ int test__synthesize_stat_config(int subtest);
 int test__synthesize_stat(int subtest);
 int test__synthesize_stat_round(int subtest);
 int test__event_update(int subtest);
+int test__suite(int subtest);
 
 #if defined(__arm__) || defined(__aarch64__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
Signature · 1 line
1.8.3.1