Skip to contentSkip to conversation

perf tests: Move tests from builtin-test

PATCH In review Jiri Olsa 1 participant 25 messages Nov 10, 2012 – Dec 8, 2012 perf events

lore
Share & tools
lore
author
#3 lore raw

PATCH 2/12 perf tests: Move test__open_syscall_event into separate object

In reply to Jiri Olsa

Separating test__open_syscall_event test from
the builtin-test into open-syscall object.

Adding util object under tests directory to gather help functions common to more tests.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile             |  2 +
 tools/perf/tests/builtin-test.c | 84 -----------------------------------------
 tools/perf/tests/open-syscall.c | 66 ++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |  5 +++
 tools/perf/tests/util.c         | 30 +++++++++++++++
 5 files changed, 103 insertions(+), 84 deletions(-)
 create mode 100644 tools/perf/tests/open-syscall.c
 create mode 100644 tools/perf/tests/util.c
tools/perf/Makefile +2 -0
index 7c7ba4d..69f582c 100644
@@ -432,6 +432,8 @@ LIB_OBJS += $(OUTPUT)tests/parse-events.o
 LIB_OBJS += $(OUTPUT)tests/dso-data.o
 LIB_OBJS += $(OUTPUT)tests/attr.o
 LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
+LIB_OBJS += $(OUTPUT)tests/open-syscall.o
+LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
tools/perf/tests/builtin-test.c +0 -84

90 lines not on this page · raw message

tools/perf/tests/open-syscall.c new file +66 -0

66 lines not on this page · raw message

tools/perf/tests/tests.h +5 -0
index 2223de5..bac133e 100644
@@ -1,6 +1,11 @@
 #ifndef TESTS_H
 #define TESTS_H
 
+/* Tests */
 int test__vmlinux_matches_kallsyms(void);
+int test__open_syscall_event(void);
+
+/* Util */
+int trace_event__id(const char *evname);
 
 #endif /* TESTS_H */
tools/perf/tests/util.c new file +30 -0
new file mode 100644
index 0000000..748f2e8
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include "tests.h"
+#include "debugfs.h"
+
+int trace_event__id(const char *evname)
+{
+	char *filename;
+	int err = -1, fd;
+
+	if (asprintf(&filename,
+		     "%s/syscalls/%s/id",
+		     tracing_events_path, evname) < 0)
+		return -1;
+
+	fd = open(filename, O_RDONLY);
+	if (fd >= 0) {
+		char id[16];
+		if (read(fd, id, sizeof(id)) > 0)
+			err = atoi(id);
+		close(fd);
+	}
+
+	free(filename);
+	return err;
+}
Signature · 1 line
1.7.11.7
author
#1 lore raw

PATCH 1/12 perf tests: Move test__vmlinux_matches_kallsyms into separate object

In reply to Jiri Olsa

Separating test__vmlinux_matches_kallsyms test from the builtin-test into vmlinux-kallsyms object.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile                 |   1 +
 tools/perf/tests/builtin-test.c     | 223 +---------------------------------
 tools/perf/tests/tests.h            |   6 +
 tools/perf/tests/vmlinux-kallsyms.c | 230 ++++++++++++++++++++++++++++++++++++
 4 files changed, 239 insertions(+), 221 deletions(-)
 create mode 100644 tools/perf/tests/tests.h
 create mode 100644 tools/perf/tests/vmlinux-kallsyms.c
tools/perf/Makefile +1 -0
index cca5bb8..7c7ba4d 100644
@@ -431,6 +431,7 @@ LIB_OBJS += $(OUTPUT)arch/common.o
 LIB_OBJS += $(OUTPUT)tests/parse-events.o
 LIB_OBJS += $(OUTPUT)tests/dso-data.o
 LIB_OBJS += $(OUTPUT)tests/attr.o
+LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
tools/perf/tests/builtin-test.c +2 -221

233 lines not on this page · raw message

tools/perf/tests/tests.h new file +6 -0
new file mode 100644
index 0000000..2223de5
@@ -0,0 +1,6 @@
+#ifndef TESTS_H
+#define TESTS_H
+
+int test__vmlinux_matches_kallsyms(void);
+
+#endif /* TESTS_H */
tools/perf/tests/vmlinux-kallsyms.c new file +230 -0

230 lines not on this page · raw message

Signature · 1 line
1.7.11.7
author
#11 lore raw

PATCH 6/12 perf tests: Move test__rdpmc into separate object

In reply to Jiri Olsa

Separating test__rdpmc test from the builtin-test
into rdpmc object.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile             |   1 +
 tools/perf/tests/builtin-test.c | 168 --------------------------------------
 tools/perf/tests/rdpmc.c        | 175 ++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |   1 +
 4 files changed, 177 insertions(+), 168 deletions(-)
 create mode 100644 tools/perf/tests/rdpmc.c
tools/perf/Makefile +1 -0
index a2d6153..2e5197a 100644
@@ -436,6 +436,7 @@ LIB_OBJS += $(OUTPUT)tests/open-syscall.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
 LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
 LIB_OBJS += $(OUTPUT)tests/perf-record.o
+LIB_OBJS += $(OUTPUT)tests/rdpmc.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +0 -168

174 lines not on this page · raw message

tools/perf/tests/rdpmc.c new file +175 -0

175 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index 374b039..03d428d 100644
@@ -7,6 +7,7 @@ int test__open_syscall_event(void);
 int test__open_syscall_event_on_all_cpus(void);
 int test__basic_mmap(void);
 int test__PERF_RECORD(void);
+int test__rdpmc(void);
 
 /* Util */
 int trace_event__id(const char *evname);
Signature · 1 line
1.7.11.7
author
#13 lore raw

PATCH 7/12 perf tests: Move perf_evsel__roundtrip_name_test into separate object

In reply to Jiri Olsa

Separating perf_evsel__roundtrip_name_test test from the builtin-test into evsel-roundtrip-name object.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile                     |   1 +
 tools/perf/tests/builtin-test.c         | 112 +------------------------------
 tools/perf/tests/evsel-roundtrip-name.c | 114 ++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h                |   1 +
 4 files changed, 117 insertions(+), 111 deletions(-)
 create mode 100644 tools/perf/tests/evsel-roundtrip-name.c
tools/perf/Makefile +1 -0
index 2e5197a..ad6fcb5 100644
@@ -437,6 +437,7 @@ LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
 LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
 LIB_OBJS += $(OUTPUT)tests/perf-record.o
 LIB_OBJS += $(OUTPUT)tests/rdpmc.o
+LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +1 -111

124 lines not on this page · raw message

tools/perf/tests/evsel-roundtrip-name.c new file +114 -0

114 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index 03d428d..5897dd1 100644
@@ -8,6 +8,7 @@ int test__open_syscall_event_on_all_cpus(void);
 int test__basic_mmap(void);
 int test__PERF_RECORD(void);
 int test__rdpmc(void);
+int test__perf_evsel__roundtrip_name_test(void);
 
 /* Util */
 int trace_event__id(const char *evname);
Signature · 1 line
1.7.11.7
author
#19 lore raw

PATCH 10/12 perf tests: Move pmu tests into separate object

In reply to Jiri Olsa

Separating pmu's object tests into pmu object under tests directory.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile             |   1 +
 tools/perf/tests/builtin-test.c |   7 +-
 tools/perf/tests/pmu.c          | 178 ++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |   1 +
 tools/perf/util/pmu.c           | 185 ++--------------------------------------
 tools/perf/util/pmu.h           |   4 +
 6 files changed, 191 insertions(+), 185 deletions(-)
 create mode 100644 tools/perf/tests/pmu.c
tools/perf/Makefile +1 -0
index 1e50559..9af012f 100644
@@ -440,6 +440,7 @@ LIB_OBJS += $(OUTPUT)tests/perf-record.o
 LIB_OBJS += $(OUTPUT)tests/rdpmc.o
 LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
 LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
+LIB_OBJS += $(OUTPUT)tests/pmu.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +1 -6
index bab8490..d3b95e0 100644
@@ -30,11 +30,6 @@
 #include <sched.h>
 
 
-static int test__perf_pmu(void)
-{
-	return perf_pmu__test();
-}
-
 static struct test {
 	const char *desc;
 	int (*func)(void);
@@ -71,7 +66,7 @@ static struct test {
 	},
 	{
 		.desc = "Test perf pmu format parsing",
-		.func = test__perf_pmu,
+		.func = test__pmu,
 	},
 	{
 		.desc = "Test dso data interface",
tools/perf/tests/pmu.c new file +178 -0

178 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index f70f998..88a55df 100644
@@ -11,6 +11,7 @@ int test__rdpmc(void);
 int test__perf_evsel__roundtrip_name_test(void);
 int test__perf_evsel__tp_sched_test(void);
 int test__syscall_open_tp_fields(void);
+int test__pmu(void);
 
 /* Util */
 int trace_event__id(const char *evname);
tools/perf/util/pmu.c +6 -179

212 lines not on this page · raw message

tools/perf/util/pmu.h +4 -0
index 39f3aba..07d553f 100644
@@ -37,6 +37,9 @@ struct perf_pmu {
 struct perf_pmu *perf_pmu__find(char *name);
 int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr,
 		     struct list_head *head_terms);
+int perf_pmu__config_terms(struct list_head *formats,
+			   struct perf_event_attr *attr,
+			   struct list_head *head_terms);
 int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms);
 struct list_head *perf_pmu__alias(struct perf_pmu *pmu,
 				struct list_head *head_terms);
@@ -46,6 +49,7 @@ void perf_pmu_error(struct list_head *list, char *name, char const *msg);
 int perf_pmu__new_format(struct list_head *list, char *name,
 			 int config, unsigned long *bits);
 void perf_pmu__set_format(unsigned long *bits, long from, long to);
+int perf_pmu__format_parse(char *dir, struct list_head *head);
 
 struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
 
Signature · 1 line
1.7.11.7
author
#15 lore raw

PATCH 8/12 perf tests: Move perf_evsel__tp_sched_test into separate object

In reply to Jiri Olsa

Separating perf_evsel__tp_sched_test test from the builtin-test into evsel-tp-sched object.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile               |  1 +
 tools/perf/tests/builtin-test.c   | 83 +-------------------------------------
 tools/perf/tests/evsel-tp-sched.c | 84 +++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h          |  1 +
 4 files changed, 87 insertions(+), 82 deletions(-)
 create mode 100644 tools/perf/tests/evsel-tp-sched.c
tools/perf/Makefile +1 -0
index ad6fcb5..e510b53 100644
@@ -438,6 +438,7 @@ LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
 LIB_OBJS += $(OUTPUT)tests/perf-record.o
 LIB_OBJS += $(OUTPUT)tests/rdpmc.o
 LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
+LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +1 -82

95 lines not on this page · raw message

tools/perf/tests/evsel-tp-sched.c new file +84 -0

84 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index 5897dd1..1ef265d 100644
@@ -9,6 +9,7 @@ int test__basic_mmap(void);
 int test__PERF_RECORD(void);
 int test__rdpmc(void);
 int test__perf_evsel__roundtrip_name_test(void);
+int test__perf_evsel__tp_sched_test(void);
 
 /* Util */
 int trace_event__id(const char *evname);
Signature · 1 line
1.7.11.7
author
#17 lore raw

PATCH 9/12 perf tests: Move test__syscall_open_tp_fields into separate object

In reply to Jiri Olsa

Separating test__syscall_open_tp_fields test from the builtin-test into open-syscall-tp-fields object.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile                       |   1 +
 tools/perf/tests/builtin-test.c           | 112 ----------------------------
 tools/perf/tests/open-syscall-tp-fields.c | 117 ++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h                  |   1 +
 4 files changed, 119 insertions(+), 112 deletions(-)
 create mode 100644 tools/perf/tests/open-syscall-tp-fields.c
tools/perf/Makefile +1 -0
index e510b53..1e50559 100644
@@ -434,6 +434,7 @@ LIB_OBJS += $(OUTPUT)tests/attr.o
 LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
+LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o
 LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
 LIB_OBJS += $(OUTPUT)tests/perf-record.o
 LIB_OBJS += $(OUTPUT)tests/rdpmc.o
tools/perf/tests/builtin-test.c +0 -112

118 lines not on this page · raw message

tools/perf/tests/open-syscall-tp-fields.c new file +117 -0

117 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index 1ef265d..f70f998 100644
@@ -10,6 +10,7 @@ int test__PERF_RECORD(void);
 int test__rdpmc(void);
 int test__perf_evsel__roundtrip_name_test(void);
 int test__perf_evsel__tp_sched_test(void);
+int test__syscall_open_tp_fields(void);
 
 /* Util */
 int trace_event__id(const char *evname);
Signature · 1 line
1.7.11.7
author
#7 lore raw

PATCH 4/12 perf tests: Move test__basic_mmap into separate object

In reply to Jiri Olsa

Separating test__basic_mmap test from the builtin-test into mmap-basic object.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile             |   1 +
 tools/perf/tests/builtin-test.c | 157 --------------------------------------
 tools/perf/tests/mmap-basic.c   | 162 ++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |   1 +
 4 files changed, 164 insertions(+), 157 deletions(-)
 create mode 100644 tools/perf/tests/mmap-basic.c
tools/perf/Makefile +1 -0
index d413e89..337489e 100644
@@ -434,6 +434,7 @@ LIB_OBJS += $(OUTPUT)tests/attr.o
 LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
+LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +0 -157

163 lines not on this page · raw message

tools/perf/tests/mmap-basic.c new file +162 -0

162 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index c2887f2..1a925dd 100644
@@ -5,6 +5,7 @@
 int test__vmlinux_matches_kallsyms(void);
 int test__open_syscall_event(void);
 int test__open_syscall_event_on_all_cpus(void);
+int test__basic_mmap(void);
 
 /* Util */
 int trace_event__id(const char *evname);
Signature · 1 line
1.7.11.7
author
#5 lore raw

PATCH 3/12 perf tests: Move test__open_syscall_event_on_all_cpus into separate object

In reply to Jiri Olsa

Separating test__open_syscall_event_on_all_cpus test from the builtin-test into open-syscall-all-cpus object.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile                      |   1 +
 tools/perf/tests/builtin-test.c          | 114 -----------------------------
 tools/perf/tests/open-syscall-all-cpus.c | 120 +++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h                 |   1 +
 4 files changed, 122 insertions(+), 114 deletions(-)
 create mode 100644 tools/perf/tests/open-syscall-all-cpus.c
tools/perf/Makefile +1 -0
index 69f582c..d413e89 100644
@@ -433,6 +433,7 @@ LIB_OBJS += $(OUTPUT)tests/dso-data.o
 LIB_OBJS += $(OUTPUT)tests/attr.o
 LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall.o
+LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +0 -114

120 lines not on this page · raw message

tools/perf/tests/open-syscall-all-cpus.c new file +120 -0

120 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index bac133e..c2887f2 100644
@@ -4,6 +4,7 @@
 /* Tests */
 int test__vmlinux_matches_kallsyms(void);
 int test__open_syscall_event(void);
+int test__open_syscall_event_on_all_cpus(void);
 
 /* Util */
 int trace_event__id(const char *evname);
Signature · 1 line
1.7.11.7
author
#23 lore raw

PATCH 12/12 perf tests: Check for mkstemp return value in dso-data test

In reply to Jiri Olsa

Adding check for mkstemp return error value in dso-data test.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/tests/dso-data.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/perf/tests/dso-data.c +4 -0
index b5198f5..5eaffa2 100644
@@ -26,6 +26,10 @@ static char *test_file(int size)
 	unsigned char *buf;
 
 	fd = mkstemp(templ);
+	if (fd < 0) {
+		perror("mkstemp failed");
+		return NULL;
+	}
 
 	buf = malloc(size);
 	if (!buf) {
Signature · 1 line
1.7.11.7
author
#9 lore raw

PATCH 5/12 perf tests: Move test__PERF_RECORD into separate object

In reply to Jiri Olsa

Separating test__PERF_RECORD test from the builtin-test into perf-record object.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile             |   1 +
 tools/perf/tests/builtin-test.c | 307 ---------------------------------------
 tools/perf/tests/perf-record.c  | 314 ++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |   1 +
 4 files changed, 316 insertions(+), 307 deletions(-)
 create mode 100644 tools/perf/tests/perf-record.c
tools/perf/Makefile +1 -0
index 337489e..a2d6153 100644
@@ -435,6 +435,7 @@ LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
 LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
+LIB_OBJS += $(OUTPUT)tests/perf-record.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +0 -307

313 lines not on this page · raw message

tools/perf/tests/perf-record.c new file +314 -0

314 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index 1a925dd..374b039 100644
@@ -6,6 +6,7 @@ int test__vmlinux_matches_kallsyms(void);
 int test__open_syscall_event(void);
 int test__open_syscall_event_on_all_cpus(void);
 int test__basic_mmap(void);
+int test__PERF_RECORD(void);
 
 /* Util */
 int trace_event__id(const char *evname);
Signature · 1 line
1.7.11.7

Jiri Olsa

author
#0 lore raw

cover perf tests: Move tests from builtin-test

hi,
I discussed with Arnaldo of moving tests from builtin-test into separated objects.. here it is. I swear not to touch test code for a while after this one ;-)

Attached patches:
01/12 perf tests: Move test__vmlinux_matches_kallsyms into separate object 02/12 perf tests: Move test__open_syscall_event into separate object 03/12 perf tests: Move test__open_syscall_event_on_all_cpus into separate object 04/12 perf tests: Move test__basic_mmap into separate object
05/12 perf tests: Move test__PERF_RECORD into separate object
06/12 perf tests: Move test__rdpmc into separate object
07/12 perf tests: Move perf_evsel__roundtrip_name_test into separate object 08/12 perf tests: Move perf_evsel__tp_sched_test into separate object 09/12 perf tests: Move test__syscall_open_tp_fields into separate object 10/12 perf tests: Move pmu tests into separate object
11/12 perf tests: Final cleanup for builtin-test move
12/12 perf tests: Check for mkstemp return value in dso-data test

Also available here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/linux.git
perf/tests

thanks,
jirka

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile                       |   11 +
 tools/perf/perf.h                         |    1 -
 tools/perf/tests/attr.c                   |    3 +-
 tools/perf/tests/builtin-test.c           | 1399 +----------------------------------------------------------
 tools/perf/tests/dso-data.c               |    7 +-
 tools/perf/tests/evsel-roundtrip-name.c   |  114 +++++
 tools/perf/tests/evsel-tp-sched.c         |   84 ++++
 tools/perf/tests/mmap-basic.c             |  162 +++++++
 tools/perf/tests/open-syscall-all-cpus.c  |  120 +++++
 tools/perf/tests/open-syscall-tp-fields.c |  117 +++++
 tools/perf/tests/open-syscall.c           |   66 +++
 tools/perf/tests/parse-events.c           |    3 +-
 tools/perf/tests/perf-record.c            |  314 ++++++++++++++
 tools/perf/tests/pmu.c                    |  178 ++++++++
 tools/perf/tests/rdpmc.c                  |  175 ++++++++
 tools/perf/tests/tests.h                  |   22 +
 tools/perf/tests/util.c                   |   30 ++
 tools/perf/tests/vmlinux-kallsyms.c       |  230 ++++++++++
 tools/perf/util/parse-events.h            |    1 -
 tools/perf/util/pmu.c                     |  185 +-------
 tools/perf/util/pmu.h                     |    4 +
 tools/perf/util/symbol.h                  |    1 -
 22 files changed, 1654 insertions(+), 1573 deletions(-)
author
#21 lore raw

PATCH 11/12 perf tests: Final cleanup for builtin-test move

Final function renames to match test__* style and include cleanup.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/perf.h               |  1 -
 tools/perf/tests/attr.c         |  3 ++-
 tools/perf/tests/builtin-test.c | 34 +++++++---------------------------
 tools/perf/tests/dso-data.c     |  3 ++-
 tools/perf/tests/parse-events.c |  3 ++-
 tools/perf/tests/tests.h        |  3 +++
 tools/perf/util/parse-events.h  |  1 -
 tools/perf/util/symbol.h        |  1 -
 8 files changed, 16 insertions(+), 33 deletions(-)
tools/perf/perf.h +0 -1
index 054182e..0047264 100644
@@ -178,7 +178,6 @@ extern bool test_attr__enabled;
 void test_attr__init(void);
 void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
 		     int fd, int group_fd, unsigned long flags);
-int  test_attr__run(void);
 
 static inline int
 sys_perf_event_open(struct perf_event_attr *attr,
tools/perf/tests/attr.c +2 -1
index 6e2feee..25638a9 100644
@@ -27,6 +27,7 @@
 #include "../perf.h"
 #include "util.h"
 #include "exec_cmd.h"
+#include "tests.h"
 
 #define ENV "PERF_TEST_ATTR"
 
@@ -151,7 +152,7 @@ static int run_dir(const char *d, const char *perf)
 	return system(cmd);
 }
 
-int test_attr__run(void)
+int test__attr(void)
 {
 	struct stat st;
 	char path_perf[PATH_MAX];
tools/perf/tests/builtin-test.c +7 -27
index d3b95e0..186f675 100644
@@ -4,31 +4,11 @@
  * Builtin regression testing command: ever growing number of sanity tests
  */
 #include "builtin.h"
-
-#include "util/cache.h"
-#include "util/color.h"
-#include "util/debug.h"
-#include "util/debugfs.h"
-#include "util/evlist.h"
-#include "util/machine.h"
-#include "util/parse-options.h"
-#include "util/parse-events.h"
-#include "util/symbol.h"
-#include "util/thread_map.h"
-#include "util/pmu.h"
-#include "event-parse.h"
-#include "../../include/linux/hw_breakpoint.h"
-
-#include <sys/mman.h>
-
-#include "util/cpumap.h"
-#include "util/evsel.h"
-#include <sys/types.h>
-
 #include "tests.h"
-
-#include <sched.h>
-
+#include "debug.h"
+#include "color.h"
+#include "parse-options.h"
+#include "symbol.h"
 
 static struct test {
 	const char *desc;
@@ -52,7 +32,7 @@ static struct test {
 	},
 	{
 		.desc = "parse events tests",
-		.func = parse_events__test,
+		.func = test__parse_events,
 	},
 #if defined(__x86_64__) || defined(__i386__)
 	{
@@ -70,7 +50,7 @@ static struct test {
 	},
 	{
 		.desc = "Test dso data interface",
-		.func = dso__test_data,
+		.func = test__dso_data,
 	},
 	{
 		.desc = "roundtrip evsel->name check",
@@ -86,7 +66,7 @@ static struct test {
 	},
 	{
 		.desc = "struct perf_event_attr setup",
-		.func = test_attr__run,
+		.func = test__attr,
 	},
 	{
 		.func = NULL,
tools/perf/tests/dso-data.c +2 -1
index 0cd42fc..b5198f5 100644
@@ -8,6 +8,7 @@
 
 #include "machine.h"
 #include "symbol.h"
+#include "tests.h"
 
 #define TEST_ASSERT_VAL(text, cond) \
 do { \
@@ -95,7 +96,7 @@ struct test_data_offset offsets[] = {
 	},
 };
 
-int dso__test_data(void)
+int test__dso_data(void)
 {
 	struct machine machine;
 	struct dso *dso;
tools/perf/tests/parse-events.c +2 -1
index b49c2ee..f2a82d0 100644
@@ -4,6 +4,7 @@
 #include "evlist.h"
 #include "sysfs.h"
 #include "../../../include/linux/hw_breakpoint.h"
+#include "tests.h"
 
 #define TEST_ASSERT_VAL(text, cond) \
 do { \
@@ -1086,7 +1087,7 @@ static int test_pmu_events(void)
 	return ret;
 }
 
-int parse_events__test(void)
+int test__parse_events(void)
 {
 	int ret1, ret2 = 0;
 
tools/perf/tests/tests.h +3 -0
index 88a55df..fc121ed 100644
@@ -12,6 +12,9 @@ int test__perf_evsel__roundtrip_name_test(void);
 int test__perf_evsel__tp_sched_test(void);
 int test__syscall_open_tp_fields(void);
 int test__pmu(void);
+int test__attr(void);
+int test__dso_data(void);
+int test__parse_events(void);
 
 /* Util */
 int trace_event__id(const char *evname);
tools/perf/util/parse-events.h +0 -1
index ac9a6aa..f639937 100644
@@ -99,7 +99,6 @@ void parse_events__set_leader(char *name, struct list_head *list);
 void parse_events_update_lists(struct list_head *list_event,
 			       struct list_head *list_all);
 void parse_events_error(void *data, void *scanner, char const *msg);
-int parse_events__test(void);
 
 void print_events(const char *event_glob, bool name_only);
 void print_events_type(u8 type);
tools/perf/util/symbol.h +0 -1
index 04ccf29..de68f98 100644
@@ -224,7 +224,6 @@ size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp);
 size_t symbol__fprintf(struct symbol *sym, FILE *fp);
 bool symbol_type__is_a(char symbol_type, enum map_type map_type);
 
-int dso__test_data(void);
 int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
 		  struct symsrc *runtime_ss, symbol_filter_t filter,
 		  int kmodule);
Signature · 1 line
1.7.11.7
#2 lore raw

[tip:perf/core] perf tests: Move test__vmlinux_matches_kallsyms into separate object

In reply to Jiri Olsa
Commit-ID:  0a4e1ae6808a28a92573550603121b146b11312e
Gitweb:     http://git.kernel.org/tip/0a4e1ae6808a28a92573550603121b146b11312e
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:41 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:48:35 -0300

perf tests: Move test__vmlinux_matches_kallsyms into separate object

Separating test__vmlinux_matches_kallsyms test from the builtin-test into vmlinux-kallsyms object.

---
 tools/perf/Makefile                 |   1 +
 tools/perf/tests/builtin-test.c     | 223 +---------------------------------
 tools/perf/tests/tests.h            |   6 +
 tools/perf/tests/vmlinux-kallsyms.c | 230 ++++++++++++++++++++++++++++++++++++
 4 files changed, 239 insertions(+), 221 deletions(-)
tools/perf/Makefile +1 -0
index cca5bb8..7c7ba4d 100644
@@ -431,6 +431,7 @@ LIB_OBJS += $(OUTPUT)arch/common.o
 LIB_OBJS += $(OUTPUT)tests/parse-events.o
 LIB_OBJS += $(OUTPUT)tests/dso-data.o
 LIB_OBJS += $(OUTPUT)tests/attr.o
+LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
tools/perf/tests/builtin-test.c +2 -221

233 lines not on this page · raw message

tools/perf/tests/tests.h new file +6 -0
new file mode 100644
index 0000000..2223de5
@@ -0,0 +1,6 @@
+#ifndef TESTS_H
+#define TESTS_H
+
+int test__vmlinux_matches_kallsyms(void);
+
+#endif /* TESTS_H */
tools/perf/tests/vmlinux-kallsyms.c new file +230 -0

230 lines not on this page · raw message

#4 lore raw

[tip:perf/core] perf tests: Move test__open_syscall_event into separate object

In reply to Jiri Olsa
Commit-ID:  d3b59a38bcdab4248134023c2c5dfabee5a4878e
Gitweb:     http://git.kernel.org/tip/d3b59a38bcdab4248134023c2c5dfabee5a4878e
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:42 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:49:17 -0300

perf tests: Move test__open_syscall_event into separate object

Separating test__open_syscall_event test from the builtin-test into open-syscall object.

Adding util object under tests directory to gather help functions common to more tests.

---
 tools/perf/Makefile             |  2 +
 tools/perf/tests/builtin-test.c | 84 -----------------------------------------
 tools/perf/tests/open-syscall.c | 66 ++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |  5 +++
 tools/perf/tests/util.c         | 30 +++++++++++++++
 5 files changed, 103 insertions(+), 84 deletions(-)
tools/perf/Makefile +2 -0
index 7c7ba4d..69f582c 100644
@@ -432,6 +432,8 @@ LIB_OBJS += $(OUTPUT)tests/parse-events.o
 LIB_OBJS += $(OUTPUT)tests/dso-data.o
 LIB_OBJS += $(OUTPUT)tests/attr.o
 LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
+LIB_OBJS += $(OUTPUT)tests/open-syscall.o
+LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
tools/perf/tests/builtin-test.c +0 -84

90 lines not on this page · raw message

tools/perf/tests/open-syscall.c new file +66 -0

66 lines not on this page · raw message

tools/perf/tests/tests.h +5 -0
index 2223de5..bac133e 100644
@@ -1,6 +1,11 @@
 #ifndef TESTS_H
 #define TESTS_H
 
+/* Tests */
 int test__vmlinux_matches_kallsyms(void);
+int test__open_syscall_event(void);
+
+/* Util */
+int trace_event__id(const char *evname);
 
 #endif /* TESTS_H */
tools/perf/tests/util.c new file +30 -0
new file mode 100644
index 0000000..748f2e8
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include "tests.h"
+#include "debugfs.h"
+
+int trace_event__id(const char *evname)
+{
+	char *filename;
+	int err = -1, fd;
+
+	if (asprintf(&filename,
+		     "%s/syscalls/%s/id",
+		     tracing_events_path, evname) < 0)
+		return -1;
+
+	fd = open(filename, O_RDONLY);
+	if (fd >= 0) {
+		char id[16];
+		if (read(fd, id, sizeof(id)) > 0)
+			err = atoi(id);
+		close(fd);
+	}
+
+	free(filename);
+	return err;
+}
#6 lore raw

[tip:perf/core] perf tests: Move test__open_syscall_event_on_all_cpus into separate object

In reply to Jiri Olsa
Commit-ID:  bd90517b374b1d6381a5509f55df1a9b7c33a6b1
Gitweb:     http://git.kernel.org/tip/bd90517b374b1d6381a5509f55df1a9b7c33a6b1
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:43 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:49:25 -0300

perf tests: Move test__open_syscall_event_on_all_cpus into separate object

Separating test__open_syscall_event_on_all_cpus test from the builtin-test into open-syscall-all-cpus object.

---
 tools/perf/Makefile                      |   1 +
 tools/perf/tests/builtin-test.c          | 114 -----------------------------
 tools/perf/tests/open-syscall-all-cpus.c | 120 +++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h                 |   1 +
 4 files changed, 122 insertions(+), 114 deletions(-)
tools/perf/Makefile +1 -0
index 69f582c..d413e89 100644
@@ -433,6 +433,7 @@ LIB_OBJS += $(OUTPUT)tests/dso-data.o
 LIB_OBJS += $(OUTPUT)tests/attr.o
 LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall.o
+LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +0 -114

120 lines not on this page · raw message

tools/perf/tests/open-syscall-all-cpus.c new file +120 -0

120 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index bac133e..c2887f2 100644
@@ -4,6 +4,7 @@
 /* Tests */
 int test__vmlinux_matches_kallsyms(void);
 int test__open_syscall_event(void);
+int test__open_syscall_event_on_all_cpus(void);
 
 /* Util */
 int trace_event__id(const char *evname);
#8 lore raw

[tip:perf/core] perf tests: Move test__basic_mmap into separate object

In reply to Jiri Olsa
Commit-ID:  a65b9c62be044b7956022e2823c5f079cf35b069
Gitweb:     http://git.kernel.org/tip/a65b9c62be044b7956022e2823c5f079cf35b069
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:44 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:49:32 -0300

perf tests: Move test__basic_mmap into separate object

Separating test__basic_mmap test from the builtin-test into mmap-basic object.

---
 tools/perf/Makefile             |   1 +
 tools/perf/tests/builtin-test.c | 157 --------------------------------------
 tools/perf/tests/mmap-basic.c   | 162 ++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |   1 +
 4 files changed, 164 insertions(+), 157 deletions(-)
tools/perf/Makefile +1 -0
index d413e89..337489e 100644
@@ -434,6 +434,7 @@ LIB_OBJS += $(OUTPUT)tests/attr.o
 LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
+LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +0 -157

163 lines not on this page · raw message

tools/perf/tests/mmap-basic.c new file +162 -0

162 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index c2887f2..1a925dd 100644
@@ -5,6 +5,7 @@
 int test__vmlinux_matches_kallsyms(void);
 int test__open_syscall_event(void);
 int test__open_syscall_event_on_all_cpus(void);
+int test__basic_mmap(void);
 
 /* Util */
 int trace_event__id(const char *evname);
#10 lore raw

[tip:perf/core] perf tests: Move test__PERF_RECORD into separate object

In reply to Jiri Olsa
Commit-ID:  16d00fee703866c61c9006eff097952289335479
Gitweb:     http://git.kernel.org/tip/16d00fee703866c61c9006eff097952289335479
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:45 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:49:43 -0300

perf tests: Move test__PERF_RECORD into separate object

Separating test__PERF_RECORD test from the builtin-test into perf-record object.

---
 tools/perf/Makefile             |   1 +
 tools/perf/tests/builtin-test.c | 307 ---------------------------------------
 tools/perf/tests/perf-record.c  | 312 ++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |   1 +
 4 files changed, 314 insertions(+), 307 deletions(-)
tools/perf/Makefile +1 -0
index 337489e..a2d6153 100644
@@ -435,6 +435,7 @@ LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
 LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
+LIB_OBJS += $(OUTPUT)tests/perf-record.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +0 -307

313 lines not on this page · raw message

tools/perf/tests/perf-record.c new file +312 -0

312 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index 1a925dd..374b039 100644
@@ -6,6 +6,7 @@ int test__vmlinux_matches_kallsyms(void);
 int test__open_syscall_event(void);
 int test__open_syscall_event_on_all_cpus(void);
 int test__basic_mmap(void);
+int test__PERF_RECORD(void);
 
 /* Util */
 int trace_event__id(const char *evname);
#12 lore raw

[tip:perf/core] perf tests: Move test__rdpmc into separate object

In reply to Jiri Olsa
Commit-ID:  bacf7e5d4055b65506292cf6412ec71e7948a9cf
Gitweb:     http://git.kernel.org/tip/bacf7e5d4055b65506292cf6412ec71e7948a9cf
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:46 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:49:50 -0300

perf tests: Move test__rdpmc into separate object

Separating test__rdpmc test from the builtin-test
into rdpmc object.

---
 tools/perf/Makefile             |   1 +
 tools/perf/tests/builtin-test.c | 168 --------------------------------------
 tools/perf/tests/rdpmc.c        | 175 ++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |   1 +
 4 files changed, 177 insertions(+), 168 deletions(-)
tools/perf/Makefile +1 -0
index a2d6153..2e5197a 100644
@@ -436,6 +436,7 @@ LIB_OBJS += $(OUTPUT)tests/open-syscall.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
 LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
 LIB_OBJS += $(OUTPUT)tests/perf-record.o
+LIB_OBJS += $(OUTPUT)tests/rdpmc.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +0 -168

174 lines not on this page · raw message

tools/perf/tests/rdpmc.c new file +175 -0

175 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index 374b039..03d428d 100644
@@ -7,6 +7,7 @@ int test__open_syscall_event(void);
 int test__open_syscall_event_on_all_cpus(void);
 int test__basic_mmap(void);
 int test__PERF_RECORD(void);
+int test__rdpmc(void);
 
 /* Util */
 int trace_event__id(const char *evname);
#14 lore raw

[tip:perf/core] perf tests: Move perf_evsel__roundtrip_name_test into separate object

In reply to Jiri Olsa
Commit-ID:  cfffae2ef7029d38e71d337fbc2a9c6cf1fa5aaf
Gitweb:     http://git.kernel.org/tip/cfffae2ef7029d38e71d337fbc2a9c6cf1fa5aaf
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:47 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:49:56 -0300

perf tests: Move perf_evsel__roundtrip_name_test into separate object

Separating perf_evsel__roundtrip_name_test test from the builtin-test into evsel-roundtrip-name object.

---
 tools/perf/Makefile                     |   1 +
 tools/perf/tests/builtin-test.c         | 112 +------------------------------
 tools/perf/tests/evsel-roundtrip-name.c | 114 ++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h                |   1 +
 4 files changed, 117 insertions(+), 111 deletions(-)
tools/perf/Makefile +1 -0
index 2e5197a..ad6fcb5 100644
@@ -437,6 +437,7 @@ LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
 LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
 LIB_OBJS += $(OUTPUT)tests/perf-record.o
 LIB_OBJS += $(OUTPUT)tests/rdpmc.o
+LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +1 -111

124 lines not on this page · raw message

tools/perf/tests/evsel-roundtrip-name.c new file +114 -0

114 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index 03d428d..5897dd1 100644
@@ -8,6 +8,7 @@ int test__open_syscall_event_on_all_cpus(void);
 int test__basic_mmap(void);
 int test__PERF_RECORD(void);
 int test__rdpmc(void);
+int test__perf_evsel__roundtrip_name_test(void);
 
 /* Util */
 int trace_event__id(const char *evname);
#16 lore raw

[tip:perf/core] perf tests: Move perf_evsel__tp_sched_test into separate object

In reply to Jiri Olsa
Commit-ID:  5e24a0904ed4029f6778a214b6fe41b9265fd620
Gitweb:     http://git.kernel.org/tip/5e24a0904ed4029f6778a214b6fe41b9265fd620
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:48 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:50:02 -0300

perf tests: Move perf_evsel__tp_sched_test into separate object

Separating perf_evsel__tp_sched_test test from the builtin-test into evsel-tp-sched object.

---
 tools/perf/Makefile               |  1 +
 tools/perf/tests/builtin-test.c   | 83 +-------------------------------------
 tools/perf/tests/evsel-tp-sched.c | 84 +++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h          |  1 +
 4 files changed, 87 insertions(+), 82 deletions(-)
tools/perf/Makefile +1 -0
index ad6fcb5..e510b53 100644
@@ -438,6 +438,7 @@ LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
 LIB_OBJS += $(OUTPUT)tests/perf-record.o
 LIB_OBJS += $(OUTPUT)tests/rdpmc.o
 LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
+LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +1 -82

95 lines not on this page · raw message

tools/perf/tests/evsel-tp-sched.c new file +84 -0

84 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index 5897dd1..1ef265d 100644
@@ -9,6 +9,7 @@ int test__basic_mmap(void);
 int test__PERF_RECORD(void);
 int test__rdpmc(void);
 int test__perf_evsel__roundtrip_name_test(void);
+int test__perf_evsel__tp_sched_test(void);
 
 /* Util */
 int trace_event__id(const char *evname);
#18 lore raw

[tip:perf/core] perf tests: Move test__syscall_open_tp_fields into separate object

In reply to Jiri Olsa
Commit-ID:  dc447eed59037c1c65feab9c72d372b6249af978
Gitweb:     http://git.kernel.org/tip/dc447eed59037c1c65feab9c72d372b6249af978
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:49 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:50:09 -0300

perf tests: Move test__syscall_open_tp_fields into separate object

Separating test__syscall_open_tp_fields test from the builtin-test into open-syscall-tp-fields object.

---
 tools/perf/Makefile                       |   1 +
 tools/perf/tests/builtin-test.c           | 112 ----------------------------
 tools/perf/tests/open-syscall-tp-fields.c | 117 ++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h                  |   1 +
 4 files changed, 119 insertions(+), 112 deletions(-)
tools/perf/Makefile +1 -0
index e510b53..1e50559 100644
@@ -434,6 +434,7 @@ LIB_OBJS += $(OUTPUT)tests/attr.o
 LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall.o
 LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
+LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o
 LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
 LIB_OBJS += $(OUTPUT)tests/perf-record.o
 LIB_OBJS += $(OUTPUT)tests/rdpmc.o
tools/perf/tests/builtin-test.c +0 -112

118 lines not on this page · raw message

tools/perf/tests/open-syscall-tp-fields.c new file +117 -0

117 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index 1ef265d..f70f998 100644
@@ -10,6 +10,7 @@ int test__PERF_RECORD(void);
 int test__rdpmc(void);
 int test__perf_evsel__roundtrip_name_test(void);
 int test__perf_evsel__tp_sched_test(void);
+int test__syscall_open_tp_fields(void);
 
 /* Util */
 int trace_event__id(const char *evname);
#20 lore raw

[tip:perf/core] perf tests: Move pmu tests into separate object

In reply to Jiri Olsa
Commit-ID:  cff7f956ec4a1ede9b752cfae3c12f588292ad80
Gitweb:     http://git.kernel.org/tip/cff7f956ec4a1ede9b752cfae3c12f588292ad80
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:50 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:50:19 -0300

perf tests: Move pmu tests into separate object

Separating pmu's object tests into pmu object under tests directory.

---
 tools/perf/Makefile             |   1 +
 tools/perf/tests/builtin-test.c |   7 +-
 tools/perf/tests/pmu.c          | 178 ++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |   1 +
 tools/perf/util/pmu.c           | 185 ++--------------------------------------
 tools/perf/util/pmu.h           |   4 +
 6 files changed, 191 insertions(+), 185 deletions(-)
tools/perf/Makefile +1 -0
index 1e50559..9af012f 100644
@@ -440,6 +440,7 @@ LIB_OBJS += $(OUTPUT)tests/perf-record.o
 LIB_OBJS += $(OUTPUT)tests/rdpmc.o
 LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
 LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
+LIB_OBJS += $(OUTPUT)tests/pmu.o
 LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
tools/perf/tests/builtin-test.c +1 -6
index bab8490..d3b95e0 100644
@@ -30,11 +30,6 @@
 #include <sched.h>
 
 
-static int test__perf_pmu(void)
-{
-	return perf_pmu__test();
-}
-
 static struct test {
 	const char *desc;
 	int (*func)(void);
@@ -71,7 +66,7 @@ static struct test {
 	},
 	{
 		.desc = "Test perf pmu format parsing",
-		.func = test__perf_pmu,
+		.func = test__pmu,
 	},
 	{
 		.desc = "Test dso data interface",
tools/perf/tests/pmu.c new file +178 -0

178 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index f70f998..88a55df 100644
@@ -11,6 +11,7 @@ int test__rdpmc(void);
 int test__perf_evsel__roundtrip_name_test(void);
 int test__perf_evsel__tp_sched_test(void);
 int test__syscall_open_tp_fields(void);
+int test__pmu(void);
 
 /* Util */
 int trace_event__id(const char *evname);
tools/perf/util/pmu.c +6 -179

212 lines not on this page · raw message

tools/perf/util/pmu.h +4 -0
index 39f3aba..07d553f 100644
@@ -37,6 +37,9 @@ struct perf_pmu {
 struct perf_pmu *perf_pmu__find(char *name);
 int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr,
 		     struct list_head *head_terms);
+int perf_pmu__config_terms(struct list_head *formats,
+			   struct perf_event_attr *attr,
+			   struct list_head *head_terms);
 int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms);
 struct list_head *perf_pmu__alias(struct perf_pmu *pmu,
 				struct list_head *head_terms);
@@ -46,6 +49,7 @@ void perf_pmu_error(struct list_head *list, char *name, char const *msg);
 int perf_pmu__new_format(struct list_head *list, char *name,
 			 int config, unsigned long *bits);
 void perf_pmu__set_format(unsigned long *bits, long from, long to);
+int perf_pmu__format_parse(char *dir, struct list_head *head);
 
 struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
 
#22 lore raw

[tip:perf/core] perf tests: Final cleanup for builtin-test move

In reply to Jiri Olsa
Commit-ID:  c81251e808fe2386e71990ecd49c408bb7cb4666
Gitweb:     http://git.kernel.org/tip/c81251e808fe2386e71990ecd49c408bb7cb4666
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:51 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:50:24 -0300

perf tests: Final cleanup for builtin-test move

Final function renames to match test__* style and include cleanup.

---
 tools/perf/perf.h               |  1 -
 tools/perf/tests/attr.c         |  3 ++-
 tools/perf/tests/builtin-test.c | 34 +++++++---------------------------
 tools/perf/tests/dso-data.c     |  3 ++-
 tools/perf/tests/parse-events.c |  3 ++-
 tools/perf/tests/tests.h        |  3 +++
 tools/perf/util/parse-events.h  |  1 -
 tools/perf/util/symbol.h        |  1 -
 8 files changed, 16 insertions(+), 33 deletions(-)
tools/perf/perf.h +0 -1
index 054182e..0047264 100644
@@ -178,7 +178,6 @@ extern bool test_attr__enabled;
 void test_attr__init(void);
 void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
 		     int fd, int group_fd, unsigned long flags);
-int  test_attr__run(void);
 
 static inline int
 sys_perf_event_open(struct perf_event_attr *attr,
tools/perf/tests/attr.c +2 -1
index 6e2feee..25638a9 100644
@@ -27,6 +27,7 @@
 #include "../perf.h"
 #include "util.h"
 #include "exec_cmd.h"
+#include "tests.h"
 
 #define ENV "PERF_TEST_ATTR"
 
@@ -151,7 +152,7 @@ static int run_dir(const char *d, const char *perf)
 	return system(cmd);
 }
 
-int test_attr__run(void)
+int test__attr(void)
 {
 	struct stat st;
 	char path_perf[PATH_MAX];
tools/perf/tests/builtin-test.c +7 -27
index d3b95e0..186f675 100644
@@ -4,31 +4,11 @@
  * Builtin regression testing command: ever growing number of sanity tests
  */
 #include "builtin.h"
-
-#include "util/cache.h"
-#include "util/color.h"
-#include "util/debug.h"
-#include "util/debugfs.h"
-#include "util/evlist.h"
-#include "util/machine.h"
-#include "util/parse-options.h"
-#include "util/parse-events.h"
-#include "util/symbol.h"
-#include "util/thread_map.h"
-#include "util/pmu.h"
-#include "event-parse.h"
-#include "../../include/linux/hw_breakpoint.h"
-
-#include <sys/mman.h>
-
-#include "util/cpumap.h"
-#include "util/evsel.h"
-#include <sys/types.h>
-
 #include "tests.h"
-
-#include <sched.h>
-
+#include "debug.h"
+#include "color.h"
+#include "parse-options.h"
+#include "symbol.h"
 
 static struct test {
 	const char *desc;
@@ -52,7 +32,7 @@ static struct test {
 	},
 	{
 		.desc = "parse events tests",
-		.func = parse_events__test,
+		.func = test__parse_events,
 	},
 #if defined(__x86_64__) || defined(__i386__)
 	{
@@ -70,7 +50,7 @@ static struct test {
 	},
 	{
 		.desc = "Test dso data interface",
-		.func = dso__test_data,
+		.func = test__dso_data,
 	},
 	{
 		.desc = "roundtrip evsel->name check",
@@ -86,7 +66,7 @@ static struct test {
 	},
 	{
 		.desc = "struct perf_event_attr setup",
-		.func = test_attr__run,
+		.func = test__attr,
 	},
 	{
 		.func = NULL,
tools/perf/tests/dso-data.c +2 -1
index 0cd42fc..b5198f5 100644
@@ -8,6 +8,7 @@
 
 #include "machine.h"
 #include "symbol.h"
+#include "tests.h"
 
 #define TEST_ASSERT_VAL(text, cond) \
 do { \
@@ -95,7 +96,7 @@ struct test_data_offset offsets[] = {
 	},
 };
 
-int dso__test_data(void)
+int test__dso_data(void)
 {
 	struct machine machine;
 	struct dso *dso;
tools/perf/tests/parse-events.c +2 -1
index b49c2ee..f2a82d0 100644
@@ -4,6 +4,7 @@
 #include "evlist.h"
 #include "sysfs.h"
 #include "../../../include/linux/hw_breakpoint.h"
+#include "tests.h"
 
 #define TEST_ASSERT_VAL(text, cond) \
 do { \
@@ -1086,7 +1087,7 @@ static int test_pmu_events(void)
 	return ret;
 }
 
-int parse_events__test(void)
+int test__parse_events(void)
 {
 	int ret1, ret2 = 0;
 
tools/perf/tests/tests.h +3 -0
index 88a55df..fc121ed 100644
@@ -12,6 +12,9 @@ int test__perf_evsel__roundtrip_name_test(void);
 int test__perf_evsel__tp_sched_test(void);
 int test__syscall_open_tp_fields(void);
 int test__pmu(void);
+int test__attr(void);
+int test__dso_data(void);
+int test__parse_events(void);
 
 /* Util */
 int trace_event__id(const char *evname);
tools/perf/util/parse-events.h +0 -1
index ac9a6aa..f639937 100644
@@ -99,7 +99,6 @@ void parse_events__set_leader(char *name, struct list_head *list);
 void parse_events_update_lists(struct list_head *list_event,
 			       struct list_head *list_all);
 void parse_events_error(void *data, void *scanner, char const *msg);
-int parse_events__test(void);
 
 void print_events(const char *event_glob, bool name_only);
 void print_events_type(u8 type);
tools/perf/util/symbol.h +0 -1
index 04ccf29..de68f98 100644
@@ -224,7 +224,6 @@ size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp);
 size_t symbol__fprintf(struct symbol *sym, FILE *fp);
 bool symbol_type__is_a(char symbol_type, enum map_type map_type);
 
-int dso__test_data(void);
 int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
 		  struct symsrc *runtime_ss, symbol_filter_t filter,
 		  int kmodule);
#24 lore raw

[tip:perf/core] perf tests: Check for mkstemp return value in dso-data test

In reply to Jiri Olsa
Commit-ID:  f95e0818cbd026a8f2277895c65fcc9cc5b28cf6
Gitweb:     http://git.kernel.org/tip/f95e0818cbd026a8f2277895c65fcc9cc5b28cf6
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 10 Nov 2012 01:46:52 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:50:30 -0300

perf tests: Check for mkstemp return value in dso-data test

Adding check for mkstemp return error value in dso-data test.

---
 tools/perf/tests/dso-data.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/perf/tests/dso-data.c +4 -0
index b5198f5..5eaffa2 100644
@@ -26,6 +26,10 @@ static char *test_file(int size)
 	unsigned char *buf;
 
 	fd = mkstemp(templ);
+	if (fd < 0) {
+		perror("mkstemp failed");
+		return NULL;
+	}
 
 	buf = malloc(size);
 	if (!buf) {