lkml.org 
[lkml]   [2012]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 13/13] perf test: Add attr tests under builtin test command
Date
The test attr suite is run only if it's run under perf source
directory, because test attr files are not installed.

If run elsewhere, tests are ommited (notification is displayed)
and finished as successfull.

Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/builtin-test.c | 4 ++++
tools/perf/perf.h | 1 +
tools/perf/util/test-attr.c | 14 ++++++++++++++
3 files changed, 19 insertions(+)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 381d5ab..f2d3c50 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -1135,6 +1135,10 @@ static struct test {
.func = dso__test_data,
},
{
+ .desc = "Test perf attr",
+ .func = test_attr__run,
+ },
+ {
.func = NULL,
},
};
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index a67bb75..2039774 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -174,6 +174,7 @@ void test_attr__init(void);
int test_attr__open(struct perf_event_attr *attr,
pid_t pid, int cpu, int group_fd,
unsigned long flags);
+int test_attr__run(void);

static inline int
sys_perf_event_open(struct perf_event_attr *attr,
diff --git a/tools/perf/util/test-attr.c b/tools/perf/util/test-attr.c
index dd83954..eb610f7 100644
--- a/tools/perf/util/test-attr.c
+++ b/tools/perf/util/test-attr.c
@@ -126,3 +126,17 @@ int test_attr__open(struct perf_event_attr *attr,

return fd;
}
+
+int test_attr__run(void)
+{
+ struct stat st;
+ const char *run;
+
+ run = "python ./util/test-attr.py -d ./util/test-attr/ -p ./perf";
+
+ if (!lstat("./util/", &st))
+ return system(run);
+
+ fprintf(stderr, " (ommitted)");
+ return 0;
+}
--
1.7.11.4


\
 
 \ /
  Last update: 2012-08-24 11:41    [W:0.081 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site