Skip to contentSkip to conversation

perf test: Adding an entry for the perftool-testsuite

PATCH In review Michael Petlan 2 participants 4 messages Dec 4, 2015 – Dec 7, 2015 perf events

lore
Share & tools
lore
#0 lore raw

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

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

(for the verbose output)

---
 tools/perf/tests/Build          |   1 +
 tools/perf/tests/builtin-test.c |   4 ++
 tools/perf/tests/suite.c        | 143 ++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/suite.h        |  30 +++++++++
 tools/perf/tests/tests.h        |   1 +
 5 files changed, 179 insertions(+)
 create mode 100644 tools/perf/tests/suite.c
 create mode 100644 tools/perf/tests/suite.h
tools/perf/tests/Build +1 -0
index f41ebf8..af3bb23 100644
@@ -34,6 +34,7 @@ perf-y += thread-map.o
 perf-y += llvm.o llvm-src-base.o llvm-src-kbuild.o
 perf-y += bpf.o
 perf-y += topology.o
+perf-y += suite.o
 
 $(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c
 	$(call rule_mkdir)
tools/perf/tests/builtin-test.c +4 -0
index 80c442e..f98e1ed 100644
@@ -170,6 +170,10 @@ static struct test generic_tests[] = {
 		.func = test__bpf,
 	},
 	{
+		.desc = "Testsuite",
+		.func = test__suite,
+	},
+	{
 		.func = NULL,
 	},
 };
tools/perf/tests/suite.c new file +143 -0

143 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 3c8734a..754ade3 100644
@@ -68,6 +68,7 @@ int test__thread_map(void);
 int test__llvm(void);
 int test__bpf(void);
 int test_session_topology(void);
+int test__suite(void);
 
 #if defined(__arm__) || defined(__aarch64__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
#1 lore raw
Quoted 13 lines · Michael Petlan

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

Quoted 6 lines

or
./perf test suite -v

(for the verbose output)

I can't get this applied on latest acme's perf/core

[jolsa@krava perf]$ git am /tmp/w/
Applying: perf test: Adding an entry for the perftool-testsuite
error: patch failed: tools/perf/tests/Build:34
error: tools/perf/tests/Build: patch does not apply
error: patch failed: tools/perf/tests/builtin-test.c:170
error: tools/perf/tests/builtin-test.c: patch does not apply
error: patch failed: tools/perf/tests/tests.h:68
error: tools/perf/tests/tests.h: patch does not apply
Patch failed at 0001 perf test: Adding an entry for the perftool-testsuite The copy of the patch that failed is found in:
/home/jolsa/kernel/linux-perf/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

jirka

#2 lore raw
Quoted 2 lines · Jiri Olsa

I can't get this applied on latest acme's perf/core

Hi, I send patches that apply to latest Linus' tree:

https://github.com/torvalds/linux.git

Should I use some different tree? Arnaldo's? What is the URL of the proper tree I should send patches against?

Thanks.
Michael

Quoted 21 lines

[jolsa@krava perf]$ git am /tmp/w/
Applying: perf test: Adding an entry for the perftool-testsuite
error: patch failed: tools/perf/tests/Build:34
error: tools/perf/tests/Build: patch does not apply
error: patch failed: tools/perf/tests/builtin-test.c:170
error: tools/perf/tests/builtin-test.c: patch does not apply
error: patch failed: tools/perf/tests/tests.h:68
error: tools/perf/tests/tests.h: patch does not apply
Patch failed at 0001 perf test: Adding an entry for the perftool-testsuite The copy of the patch that failed is found in:
/home/jolsa/kernel/linux-perf/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 11 lines · Michael Petlan
Quoted 2 lines · Jiri Olsa

I can't get this applied on latest acme's perf/core

Hi, I send patches that apply to latest Linus' tree:

https://github.com/torvalds/linux.git

Should I use some different tree? Arnaldo's? What is the URL of the proper tree I should send patches against?

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
perf/core branch

jirka