[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1345798844-27423-14-git-send-email-jolsa@redhat.com>
Date: Fri, 24 Aug 2012 11:00:44 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...e.hu>, Paul Mackerras <paulus@...ba.org>,
Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Jiri Olsa <jolsa@...hat.com>
Subject: [PATCH 13/13] perf test: Add attr tests under builtin test command
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@...stprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Signed-off-by: Jiri Olsa <jolsa@...hat.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists