linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 00/13] perf test: Add perf_event_attr tests
@ 2012-08-24  9:00 Jiri Olsa
  2012-08-24  9:00 ` [PATCH 01/13] perf test: Add framework for atomated " Jiri Olsa
                   ` (13 more replies)
  0 siblings, 14 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

hi,
this code tests the link between perf stat/record command line
options and final perf_event_attr struct values. Also it tests
the group fd linkage.

It's probably missing many command line option combinations
worth testing. I wanted to check with others for more ideas
before diving into this.

You can check this also here:

git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/linux.git
perf/attr_tests4

thanks,
jirka


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/Makefile                                 |   1 +
 tools/perf/builtin-test.c                           |   4 +
 tools/perf/perf.c                                   |   2 +
 tools/perf/perf.h                                   |  11 ++
 tools/perf/util/test-attr.c                         | 142 ++++++++++++++++++++++++++
 tools/perf/util/test-attr.py                        | 272 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/test-attr/base-record               |  39 ++++++++
 tools/perf/util/test-attr/base-stat                 |  39 ++++++++
 tools/perf/util/test-attr/test-record-basic         |   5 +
 tools/perf/util/test-attr/test-record-count         |   8 ++
 tools/perf/util/test-attr/test-record-freq          |   6 ++
 tools/perf/util/test-attr/test-record-graph-default |   6 ++
 tools/perf/util/test-attr/test-record-graph-dwarf   |   6 ++
 tools/perf/util/test-attr/test-record-graph-fp      |   6 ++
 tools/perf/util/test-attr/test-record-group         |  17 ++++
 tools/perf/util/test-attr/test-record-no-inherit    |   7 ++
 tools/perf/util/test-attr/test-record-no-samples    |   6 ++
 tools/perf/util/test-attr/test-record-period        |   7 ++
 tools/perf/util/test-attr/test-stat-basic           |   6 ++
 tools/perf/util/test-attr/test-stat-group           |  15 +++
 tools/perf/util/test-attr/test-stat-no-inherit      |   7 ++
 21 files changed, 612 insertions(+)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 01/13] perf test: Add framework for atomated perf_event_attr tests
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 02/13] perf test: Add perf_event_attr record basic test Jiri Olsa
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding automated test to check event's perf_event_attr values.

The idea is run perf session with kidnaping sys_perf_event_open
function. For each sys_perf_event_open call we store the
perf_event_attr data to the file to be checked later against what
we expect.

You can run this by:
  # python ./util/test-attr.py -d ./util/test-attr/ -p ./perf -v

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/Makefile          |   1 +
 tools/perf/perf.c            |   2 +
 tools/perf/perf.h            |  10 ++
 tools/perf/util/test-attr.c  | 128 ++++++++++++++++++++
 tools/perf/util/test-attr.py | 272 +++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 413 insertions(+)
 create mode 100644 tools/perf/util/test-attr.c
 create mode 100644 tools/perf/util/test-attr.py

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 722ddee..746375d 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -405,6 +405,7 @@ LIB_OBJS += $(OUTPUT)util/rblist.o
 LIB_OBJS += $(OUTPUT)util/intlist.o
 LIB_OBJS += $(OUTPUT)ui/helpline.o
 LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
+LIB_OBJS += $(OUTPUT)util/test-attr.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index e7840e5..94092eb13 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -477,6 +477,8 @@ int main(int argc, const char **argv)
 	}
 	cmd = argv[0];
 
+	test_attr__init();
+
 	/*
 	 * We use PATH to find perf commands, but we prepend some higher
 	 * precedence paths: the "--exec-path" option, the PERF_EXEC_PATH
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 87f4ec6..a67bb75 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -5,6 +5,7 @@ struct winsize;
 
 void get_term_dimensions(struct winsize *ws);
 
+
 #if defined(__i386__)
 #include "../../arch/x86/include/asm/unistd.h"
 #define rmb()		asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
@@ -168,11 +169,20 @@ static inline unsigned long long rdclock(void)
 	(void) (&_min1 == &_min2);		\
 	_min1 < _min2 ? _min1 : _min2; })
 
+extern bool test_attr__enabled;
+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);
+
 static inline int
 sys_perf_event_open(struct perf_event_attr *attr,
 		      pid_t pid, int cpu, int group_fd,
 		      unsigned long flags)
 {
+	if (unlikely(test_attr__enabled))
+		return test_attr__open(attr, pid, cpu, group_fd, flags);
+
 	return syscall(__NR_perf_event_open, attr, pid, cpu,
 		       group_fd, flags);
 }
diff --git a/tools/perf/util/test-attr.c b/tools/perf/util/test-attr.c
new file mode 100644
index 0000000..dd83954
--- /dev/null
+++ b/tools/perf/util/test-attr.c
@@ -0,0 +1,128 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <linux/types.h>
+#include "../perf.h"
+#include "util.h"
+
+#define ENV "PERF_TEST_ATTR"
+
+bool test_attr__enabled;
+
+static char *dir;
+
+void test_attr__init(void)
+{
+	dir = getenv(ENV);
+	test_attr__enabled = (dir != NULL);
+}
+
+#define BUFSIZE 1024
+
+#define WRITE_ASS(str, fmt, data)					\
+do {									\
+	char buf[BUFSIZE];						\
+	size_t size;							\
+									\
+	size = snprintf(buf, BUFSIZE, #str "=%"fmt "\n", data);		\
+	if (1 != fwrite(buf, size, 1, file)) {				\
+		perror("test attr - failed to write event file");	\
+		return -1;						\
+	}								\
+									\
+} while (0)
+
+static int store_event(int fd, struct perf_event_attr *attr,
+		       pid_t pid, int cpu, int group_fd,
+		       unsigned long flags)
+{
+	FILE *file;
+	char path[PATH_MAX];
+
+	snprintf(path, PATH_MAX, "%s/event-%d", dir, fd);
+
+	file = fopen(path, "w+");
+	if (!file) {
+		perror("test attr - failed to open event file");
+		return -1;
+	}
+
+#define HEADER "[event]\n"
+	if (1 != fwrite(HEADER, sizeof(HEADER) - 1, 1, file)) {
+		perror("test attr - failed to write event file");
+		return -1;
+	}
+#undef HEADER
+
+	/* syscall arguments */
+	WRITE_ASS(fd,       "d", fd);
+	WRITE_ASS(group_fd, "d", group_fd);
+	WRITE_ASS(cpu,      "d", cpu);
+	WRITE_ASS(pid,      "d", pid);
+	WRITE_ASS(flags,   "lu", flags);
+
+	/* struct perf_event_attr */
+
+	WRITE_ASS(type,   PRIu32,  attr->type);
+	WRITE_ASS(size,   PRIu32,  attr->size);
+	WRITE_ASS(config,  "llu",  attr->config);
+
+	WRITE_ASS(sample_period, "llu", attr->sample_period);
+	WRITE_ASS(sample_type,   "llu", attr->sample_type);
+	WRITE_ASS(read_format,   "llu", attr->read_format);
+
+	WRITE_ASS(disabled,       "d", attr->disabled);
+	WRITE_ASS(inherit,        "d", attr->inherit);
+	WRITE_ASS(pinned,         "d", attr->pinned);
+	WRITE_ASS(exclusive,      "d", attr->exclusive);
+	WRITE_ASS(exclude_user,   "d", attr->exclude_user);
+	WRITE_ASS(exclude_kernel, "d", attr->exclude_kernel);
+	WRITE_ASS(exclude_hv,     "d", attr->exclude_hv);
+	WRITE_ASS(exclude_idle,   "d", attr->exclude_idle);
+	WRITE_ASS(mmap,           "d", attr->mmap);
+	WRITE_ASS(comm,           "d", attr->comm);
+	WRITE_ASS(freq,           "d", attr->freq);
+	WRITE_ASS(inherit_stat,   "d", attr->inherit_stat);
+	WRITE_ASS(enable_on_exec, "d", attr->enable_on_exec);
+	WRITE_ASS(task,           "d", attr->task);
+	WRITE_ASS(watermask,      "d", attr->watermark);
+	WRITE_ASS(precise_ip,     "d", attr->precise_ip);
+	WRITE_ASS(mmap_data,      "d", attr->mmap_data);
+	WRITE_ASS(sample_id_all,  "d", attr->sample_id_all);
+	WRITE_ASS(exclude_host,   "d", attr->exclude_host);
+	WRITE_ASS(exclude_guest,  "d", attr->exclude_guest);
+	WRITE_ASS(exclude_callchain_kernel, "d",
+		  attr->exclude_callchain_kernel);
+	WRITE_ASS(exclude_callchain_user, "d",
+		  attr->exclude_callchain_user);
+
+	WRITE_ASS(wakeup_events, PRIu32, attr->wakeup_events);
+
+	WRITE_ASS(bp_type, PRIu32, attr->bp_type);
+
+	WRITE_ASS(config1, "llu", attr->config1);
+	WRITE_ASS(config2, "llu", attr->config2);
+
+	WRITE_ASS(branch_sample_type, "llu", attr->branch_sample_type);
+	WRITE_ASS(sample_regs_user,   "llu", attr->sample_regs_user);
+	WRITE_ASS(sample_stack_user,  PRIu32, attr->sample_stack_user);
+
+	fclose(file);
+	return 0;
+}
+
+int test_attr__open(struct perf_event_attr *attr,
+		    pid_t pid, int cpu, int group_fd,
+		    unsigned long flags)
+{
+	int fd;
+
+	fd = syscall(__NR_perf_event_open, attr, pid, cpu,
+		     group_fd, flags);
+
+	if (store_event(fd, attr, pid, cpu, group_fd, flags))
+		die("test attr FAILED");
+
+	return fd;
+}
diff --git a/tools/perf/util/test-attr.py b/tools/perf/util/test-attr.py
new file mode 100644
index 0000000..55d538c
--- /dev/null
+++ b/tools/perf/util/test-attr.py
@@ -0,0 +1,272 @@
+#! /usr/bin/python
+
+import os
+import sys
+import glob
+import optparse
+import tempfile
+import logging
+import shutil
+import ConfigParser
+
+class Fail(Exception):
+    def __init__(self, test, msg):
+        self.msg = msg
+        self.test = test
+    def getMsg(self):
+        return 'Test \'%s\' - %s' % (self.test.path, self.msg)
+
+class Unsup(Exception):
+    def __init__(self, test):
+        self.test = test
+    def getMsg(self):
+        return 'Test \'%s\'' % self.test.path
+
+class Event(dict):
+    terms = [
+        'flags',
+        'type',
+        'size',
+        'config',
+        'sample_period',
+        'sample_type',
+        'read_format',
+        'disabled',
+        'inherit',
+        'pinned',
+        'exclusive',
+        'exclude_user',
+        'exclude_kernel',
+        'exclude_hv',
+        'exclude_idle',
+        'mmap',
+        'comm',
+        'freq',
+        'inherit_stat',
+        'enable_on_exec',
+        'task',
+        'watermask',
+        'precise_ip',
+        'mmap_data',
+        'sample_id_all',
+        'exclude_host',
+        'exclude_guest',
+        'exclude_callchain_kernel',
+        'exclude_callchain_user',
+        'wakeup_events',
+        'bp_type',
+        'config1',
+        'config2',
+        'branch_sample_type',
+        'sample_regs_user',
+        'sample_stack_user',
+    ]
+
+    def add(self, data):
+        for key, val in data:
+            log.debug("      %s = %s" % (key, val))
+            self[key] = val
+
+    def __init__(self, data, base):
+        log.debug("    Event");
+        self.add(base)
+        self.add(data)
+
+    def compare_data(self, a, b):
+        if (a == b):
+            return True
+        elif (a == '*'):
+            return True
+        return False
+
+    def equal(self, other):
+        for t in Event.terms:
+            log.debug("      [%s] %s %s" % (t, self[t], other[t]));
+            if not self.has_key(t) or not other.has_key(t):
+                return False
+            if not self.compare_data(self[t], other[t]):
+                return False
+        return True
+
+class Test(object):
+    def __init__(self, path, options):
+        parser = ConfigParser.SafeConfigParser()
+        parser.read(path)
+
+        log.info("running test '%s'" % path)
+
+        self.path     = path
+        self.test_dir = options.test_dir
+        self.perf     = options.perf
+        self.command  = parser.get('config', 'command')
+        self.args     = parser.get('config', 'args')
+
+        try:
+            self.ret  = parser.get('config', 'ret')
+        except:
+            self.ret  = 0
+
+        self.expect   = {}
+        self.result   = {}
+        log.debug("  loading expected events");
+        self.load_events(path, self.expect)
+
+    def is_event(self, name):
+        if name.find("event") == -1:
+            return False
+        else:
+            return True
+
+    def load_events(self, path, events):
+        parser_event = ConfigParser.SafeConfigParser()
+        parser_event.read(path)
+
+        for section in filter(self.is_event, parser_event.sections()):
+
+            parser_items = parser_event.items(section);
+            base_items   = {}
+
+            if (':' in section):
+                base = section[section.index(':') + 1:]
+                parser_base = ConfigParser.SafeConfigParser()
+                parser_base.read(self.test_dir + '/' + base)
+                base_items = parser_base.items('event')
+
+            e = Event(parser_items, base_items)
+            events[ e['fd'] ] = e
+
+    def run_cmd(self, tempdir):
+        cmd = "PERF_TEST_ATTR=%s %s %s -o %s/perf.data %s" % (tempdir, self.perf, self.command, tempdir, self.args)
+        ret = os.WEXITSTATUS(os.system(cmd))
+
+        log.debug("  running '%s' ret %d " % (cmd, ret))
+
+        if ret != int(self.ret):
+            raise Unsup(self)
+
+    def compare(self):
+        match = {}
+
+        # For each expected event find all matching
+        # events in result. Fail if there's not any.
+        for exp_fd, exp_event in self.expect.items():
+            exp_fd_list = []
+            log.debug("  matching expected event fd %s" % exp_fd)
+            for res_fd, res_event in self.result.items():
+                log.debug("    result event fd %s" % res_fd)
+                if (exp_event.equal(res_event)):
+                    log.debug("      ok");
+                    exp_fd_list.append(res_fd)
+                else:
+                    log.debug("      fail");
+
+            log.debug("  fd %s matches fds %s" % (exp_fd, str(exp_fd_list)))
+            # we did not any matching event - fail
+            if not exp_fd_list:
+                raise Fail(self, 'match failure');
+
+            match[exp_fd] = exp_fd_list
+
+        # For each defined group in the expected events
+        # check we match the same group in the result.
+        for exp_fd, exp_event in self.expect.items():
+            exp_group_fd = exp_event['group_fd'];
+            if exp_group_fd == '-1':
+                continue;
+
+            for res_fd in match[exp_fd]:
+                res_group_fd = self.result[res_fd]['group_fd']
+                if res_group_fd not in match[exp_group_fd]:
+                    raise Fail(self, 'group failure')
+
+                log.debug("  result [fd %s group_fd %s] matches expected [fd %s group_fd %s]" %
+                         (res_fd, res_group_fd, exp_fd, exp_group_fd))
+
+        log.debug("  matched")
+
+    def run(self):
+        tempdir = tempfile.mkdtemp();
+
+        # run the test script
+        self.run_cmd(tempdir);
+
+        # load events expectation for the test
+        log.debug("  loading result events");
+        for f in glob.glob(tempdir + '/event*'):
+            self.load_events(f, self.result);
+
+        # do the expectation - results matching
+        self.compare()
+
+        # cleanup
+        shutil.rmtree(tempdir)
+
+
+def run_tests(options):
+    for f in glob.glob(options.test_dir + '/' + options.test):
+        try:
+            Test(f, options).run()
+        except Unsup, obj:
+            print "unsupp  %s" % obj.getMsg();
+
+def setup_log(verbose):
+    global log
+    level = logging.CRITICAL
+
+    if verbose == 1:
+        level = logging.INFO
+    if verbose >= 2:
+        level = logging.DEBUG
+
+    log = logging.getLogger('test')
+    log.setLevel(level)
+    ch  = logging.StreamHandler()
+    ch.setLevel(level)
+    formatter = logging.Formatter('%(message)s')
+    ch.setFormatter(formatter)
+    log.addHandler(ch)
+
+USAGE = '''%s [OPTIONS]
+  -d dir  # tests dir
+  -p path # perf binary
+  -t test # single test
+  -v      # verbose level
+''' % sys.argv[0]
+
+def main():
+    parser = optparse.OptionParser(usage=USAGE)
+
+    parser.add_option("-t", "--test",
+                      action="store", type="string", dest="test")
+    parser.add_option("-d", "--test-dir",
+                      action="store", type="string", dest="test_dir")
+    parser.add_option("-p", "--perf",
+                      action="store", type="string", dest="perf")
+    parser.add_option("-v", "--verbose",
+                      action="count", dest="verbose")
+
+    options, args = parser.parse_args()
+    if args:
+        parser.error('FAILED wrong arguments %s' %  ' '.join(args))
+        return -1
+
+    setup_log(options.verbose)
+
+    if not options.test_dir:
+        print 'FAILED no -d option specified'
+        sys.exit(-1)
+
+    if not options.test:
+        options.test = 'test*'
+
+    try:
+        run_tests(options)
+
+    except Fail, obj:
+        print "FAILED %s" % obj.getMsg();
+        sys.exit(-1)
+
+    sys.exit(0)
+
+if __name__ == '__main__':
+    main()
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 02/13] perf test: Add perf_event_attr record basic test
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
  2012-08-24  9:00 ` [PATCH 01/13] perf test: Add framework for atomated " Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 03/13] perf test: Add perf_event_attr record group test Jiri Olsa
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding test to validate perf_event_attr data for command:
  'record'

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/util/test-attr/base-record       | 39 +++++++++++++++++++++++++++++
 tools/perf/util/test-attr/test-record-basic |  5 ++++
 2 files changed, 44 insertions(+)
 create mode 100644 tools/perf/util/test-attr/base-record
 create mode 100644 tools/perf/util/test-attr/test-record-basic

diff --git a/tools/perf/util/test-attr/base-record b/tools/perf/util/test-attr/base-record
new file mode 100644
index 0000000..ea2d3c5
--- /dev/null
+++ b/tools/perf/util/test-attr/base-record
@@ -0,0 +1,39 @@
+[event]
+fd=1
+group_fd=-1
+flags=0
+type=0
+size=96
+config=0
+sample_period=4000
+sample_type=263
+read_format=7
+disabled=1
+inherit=1
+pinned=0
+exclusive=0
+exclude_user=0
+exclude_kernel=0
+exclude_hv=0
+exclude_idle=0
+mmap=1
+comm=1
+freq=1
+inherit_stat=0
+enable_on_exec=1
+task=0
+watermask=0
+precise_ip=0
+mmap_data=0
+sample_id_all=1
+exclude_host=0
+exclude_guest=1
+exclude_callchain_kernel=0
+exclude_callchain_user=0
+wakeup_events=0
+bp_type=0
+config1=0
+config2=0
+branch_sample_type=0
+sample_regs_user=0
+sample_stack_user=0
diff --git a/tools/perf/util/test-attr/test-record-basic b/tools/perf/util/test-attr/test-record-basic
new file mode 100644
index 0000000..55c0428
--- /dev/null
+++ b/tools/perf/util/test-attr/test-record-basic
@@ -0,0 +1,5 @@
+[config]
+command = record
+args    = kill >/dev/null 2>&1
+
+[event:base-record]
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 03/13] perf test: Add perf_event_attr record group test
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
  2012-08-24  9:00 ` [PATCH 01/13] perf test: Add framework for atomated " Jiri Olsa
  2012-08-24  9:00 ` [PATCH 02/13] perf test: Add perf_event_attr record basic test Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 04/13] perf test: Add perf_event_attr record freq test Jiri Olsa
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding test to validate perf_event_attr data for command:
  'record --group -e cycles,instructions'

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/util/test-attr/test-record-group | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 tools/perf/util/test-attr/test-record-group

diff --git a/tools/perf/util/test-attr/test-record-group b/tools/perf/util/test-attr/test-record-group
new file mode 100644
index 0000000..6cff60f
--- /dev/null
+++ b/tools/perf/util/test-attr/test-record-group
@@ -0,0 +1,17 @@
+[config]
+command = record
+args    = --group -e cycles,instructions kill 2>/dev/null
+
+[event-1:base-record]
+fd=1
+group_fd=-1
+sample_type=327
+
+[event-2:base-record]
+fd=2
+group_fd=1
+config=1
+sample_type=327
+mmap=0
+comm=0
+enable_on_exec=0
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 04/13] perf test: Add perf_event_attr record freq test
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
                   ` (2 preceding siblings ...)
  2012-08-24  9:00 ` [PATCH 03/13] perf test: Add perf_event_attr record group test Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 05/13] perf test: Add perf_event_attr record count test Jiri Olsa
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding test to validate perf_event_attr data for command:
  'record -F 100'

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/util/test-attr/test-record-freq | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 tools/perf/util/test-attr/test-record-freq

diff --git a/tools/perf/util/test-attr/test-record-freq b/tools/perf/util/test-attr/test-record-freq
new file mode 100644
index 0000000..600d0f8
--- /dev/null
+++ b/tools/perf/util/test-attr/test-record-freq
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -F 100 kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=100
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 05/13] perf test: Add perf_event_attr record count test
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
                   ` (3 preceding siblings ...)
  2012-08-24  9:00 ` [PATCH 04/13] perf test: Add perf_event_attr record freq test Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 06/13] perf test: Add perf_event_attr record graph test Jiri Olsa
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding test to validate perf_event_attr data for command:
  'record -c 123'

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/util/test-attr/test-record-count | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 tools/perf/util/test-attr/test-record-count

diff --git a/tools/perf/util/test-attr/test-record-count b/tools/perf/util/test-attr/test-record-count
new file mode 100644
index 0000000..2f841de
--- /dev/null
+++ b/tools/perf/util/test-attr/test-record-count
@@ -0,0 +1,8 @@
+[config]
+command = record
+args    = -c 123 kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=123
+sample_type=7
+freq=0
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 06/13] perf test: Add perf_event_attr record graph test
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
                   ` (4 preceding siblings ...)
  2012-08-24  9:00 ` [PATCH 05/13] perf test: Add perf_event_attr record count test Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 07/13] perf test: Add perf_event_attr record period test Jiri Olsa
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding tests to validate perf_event_attr data for commands:
  'record -g --'
  'record -g fp
  'record -g dwarf

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>

graph
---
 tools/perf/util/test-attr/test-record-graph-default | 6 ++++++
 tools/perf/util/test-attr/test-record-graph-dwarf   | 6 ++++++
 tools/perf/util/test-attr/test-record-graph-fp      | 6 ++++++
 3 files changed, 18 insertions(+)
 create mode 100644 tools/perf/util/test-attr/test-record-graph-default
 create mode 100644 tools/perf/util/test-attr/test-record-graph-dwarf
 create mode 100644 tools/perf/util/test-attr/test-record-graph-fp

diff --git a/tools/perf/util/test-attr/test-record-graph-default b/tools/perf/util/test-attr/test-record-graph-default
new file mode 100644
index 0000000..833d184
--- /dev/null
+++ b/tools/perf/util/test-attr/test-record-graph-default
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -g -- kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=295
diff --git a/tools/perf/util/test-attr/test-record-graph-dwarf b/tools/perf/util/test-attr/test-record-graph-dwarf
new file mode 100644
index 0000000..41f3f67
--- /dev/null
+++ b/tools/perf/util/test-attr/test-record-graph-dwarf
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -g dwarf -- kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=295
diff --git a/tools/perf/util/test-attr/test-record-graph-fp b/tools/perf/util/test-attr/test-record-graph-fp
new file mode 100644
index 0000000..7cef374
--- /dev/null
+++ b/tools/perf/util/test-attr/test-record-graph-fp
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -g fp kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=295
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 07/13] perf test: Add perf_event_attr record period test
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
                   ` (5 preceding siblings ...)
  2012-08-24  9:00 ` [PATCH 06/13] perf test: Add perf_event_attr record graph test Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 08/13] perf test: Add perf_event_attr record no samples test Jiri Olsa
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding test to validate perf_event_attr data for command:
  'record -c 100 -P'

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/util/test-attr/test-record-period | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tools/perf/util/test-attr/test-record-period

diff --git a/tools/perf/util/test-attr/test-record-period b/tools/perf/util/test-attr/test-record-period
new file mode 100644
index 0000000..8abc531
--- /dev/null
+++ b/tools/perf/util/test-attr/test-record-period
@@ -0,0 +1,7 @@
+[config]
+command = record
+args    = -c 100 -P kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=100
+freq=0
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 08/13] perf test: Add perf_event_attr record no samples test
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
                   ` (6 preceding siblings ...)
  2012-08-24  9:00 ` [PATCH 07/13] perf test: Add perf_event_attr record period test Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 09/13] perf test: Add perf_event_attr record no-inherit test Jiri Olsa
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding test to validate perf_event_attr data for command:
  'record -n'

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/util/test-attr/test-record-no-samples | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 tools/perf/util/test-attr/test-record-no-samples

diff --git a/tools/perf/util/test-attr/test-record-no-samples b/tools/perf/util/test-attr/test-record-no-samples
new file mode 100644
index 0000000..d0141b2
--- /dev/null
+++ b/tools/perf/util/test-attr/test-record-no-samples
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -n kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=0
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 09/13] perf test: Add perf_event_attr record no-inherit test
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
                   ` (7 preceding siblings ...)
  2012-08-24  9:00 ` [PATCH 08/13] perf test: Add perf_event_attr record no samples test Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 10/13] perf test: Add perf_event_attr stat basic test Jiri Olsa
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding test to validate perf_event_attr data for command:
  'record -i'

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/util/test-attr/test-record-no-inherit | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tools/perf/util/test-attr/test-record-no-inherit

diff --git a/tools/perf/util/test-attr/test-record-no-inherit b/tools/perf/util/test-attr/test-record-no-inherit
new file mode 100644
index 0000000..9079a25
--- /dev/null
+++ b/tools/perf/util/test-attr/test-record-no-inherit
@@ -0,0 +1,7 @@
+[config]
+command = record
+args    = -i kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=259
+inherit=0
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/13] perf test: Add perf_event_attr stat basic test
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
                   ` (8 preceding siblings ...)
  2012-08-24  9:00 ` [PATCH 09/13] perf test: Add perf_event_attr record no-inherit test Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 11/13] perf test: Add perf_event_attr stat no-inherit test Jiri Olsa
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding test to validate perf_event_attr data for command:
  'stat'

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/util/test-attr/base-stat       | 39 +++++++++++++++++++++++++++++++
 tools/perf/util/test-attr/test-stat-basic |  6 +++++
 2 files changed, 45 insertions(+)
 create mode 100644 tools/perf/util/test-attr/base-stat
 create mode 100644 tools/perf/util/test-attr/test-stat-basic

diff --git a/tools/perf/util/test-attr/base-stat b/tools/perf/util/test-attr/base-stat
new file mode 100644
index 0000000..f46db90
--- /dev/null
+++ b/tools/perf/util/test-attr/base-stat
@@ -0,0 +1,39 @@
+[event]
+fd=1
+group_fd=-1
+flags=0
+type=0
+size=96
+config=0
+sample_period=0
+sample_type=0
+read_format=3
+disabled=1
+inherit=1
+pinned=0
+exclusive=0
+exclude_user=0
+exclude_kernel=0
+exclude_hv=0
+exclude_idle=0
+mmap=0
+comm=0
+freq=0
+inherit_stat=0
+enable_on_exec=1
+task=0
+watermask=0
+precise_ip=0
+mmap_data=0
+sample_id_all=0
+exclude_host=0
+exclude_guest=1
+exclude_callchain_kernel=0
+exclude_callchain_user=0
+wakeup_events=0
+bp_type=0
+config1=0
+config2=0
+branch_sample_type=0
+sample_regs_user=0
+sample_stack_user=0
diff --git a/tools/perf/util/test-attr/test-stat-basic b/tools/perf/util/test-attr/test-stat-basic
new file mode 100644
index 0000000..74e1788
--- /dev/null
+++ b/tools/perf/util/test-attr/test-stat-basic
@@ -0,0 +1,6 @@
+[config]
+command = stat
+args    = -e cycles kill >/dev/null 2>&1
+ret     = 1
+
+[event:base-stat]
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 11/13] perf test: Add perf_event_attr stat no-inherit test
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
                   ` (9 preceding siblings ...)
  2012-08-24  9:00 ` [PATCH 10/13] perf test: Add perf_event_attr stat basic test Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 12/13] perf test: Add perf_event_attr stat group test Jiri Olsa
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding test to validate perf_event_attr data for command:
'stat -i'

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/util/test-attr/test-stat-no-inherit | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tools/perf/util/test-attr/test-stat-no-inherit

diff --git a/tools/perf/util/test-attr/test-stat-no-inherit b/tools/perf/util/test-attr/test-stat-no-inherit
new file mode 100644
index 0000000..d54b2a1e
--- /dev/null
+++ b/tools/perf/util/test-attr/test-stat-no-inherit
@@ -0,0 +1,7 @@
+[config]
+command = stat
+args    = -i -e cycles kill >/dev/null 2>&1
+ret     = 1
+
+[event:base-stat]
+inherit=0
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 12/13] perf test: Add perf_event_attr stat group test
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
                   ` (10 preceding siblings ...)
  2012-08-24  9:00 ` [PATCH 11/13] perf test: Add perf_event_attr stat no-inherit test Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24  9:00 ` [PATCH 13/13] perf test: Add attr tests under builtin test command Jiri Olsa
  2012-08-24 13:07 ` [RFC 00/13] perf test: Add perf_event_attr tests Arnaldo Carvalho de Melo
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

Adding test to validate perf_event_attr data for command:
  'stat --group -e cycles,instructions'

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/util/test-attr/test-stat-group | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 tools/perf/util/test-attr/test-stat-group

diff --git a/tools/perf/util/test-attr/test-stat-group b/tools/perf/util/test-attr/test-stat-group
new file mode 100644
index 0000000..fdc1596
--- /dev/null
+++ b/tools/perf/util/test-attr/test-stat-group
@@ -0,0 +1,15 @@
+[config]
+command = stat
+args    = --group -e cycles,instructions kill >/dev/null 2>&1
+ret     = 1
+
+[event-1:base-stat]
+fd=1
+group_fd=-1
+
+[event-2:base-stat]
+fd=2
+group_fd=1
+config=1
+disabled=0
+enable_on_exec=0
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 13/13] perf test: Add attr tests under builtin test command
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
                   ` (11 preceding siblings ...)
  2012-08-24  9:00 ` [PATCH 12/13] perf test: Add perf_event_attr stat group test Jiri Olsa
@ 2012-08-24  9:00 ` Jiri Olsa
  2012-08-24 13:07 ` [RFC 00/13] perf test: Add perf_event_attr tests Arnaldo Carvalho de Melo
  13 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2012-08-24  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Jiri Olsa

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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [RFC 00/13] perf test: Add perf_event_attr tests
  2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
                   ` (12 preceding siblings ...)
  2012-08-24  9:00 ` [PATCH 13/13] perf test: Add attr tests under builtin test command Jiri Olsa
@ 2012-08-24 13:07 ` Arnaldo Carvalho de Melo
  2012-08-24 18:12   ` Ingo Molnar
  13 siblings, 1 reply; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-08-24 13:07 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Peter Zijlstra, Ingo Molnar, Paul Mackerras,
	Corey Ashford, Frederic Weisbecker

Em Fri, Aug 24, 2012 at 11:00:31AM +0200, Jiri Olsa escreveu:

>  tools/perf/util/test-attr.c                         | 142 ++++++++++++++++++++++++++
>  tools/perf/util/test-attr.py                        | 272 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  tools/perf/util/test-attr/base-record               |  39 ++++++++

I suggest we move all this to:

  tools/perf/tests/attr/

>  tools/perf/util/test-attr/base-stat                 |  39 ++++++++
>  tools/perf/util/test-attr/test-record-basic         |   5 +
>  tools/perf/util/test-attr/test-record-count         |   8 ++
>  tools/perf/util/test-attr/test-record-freq          |   6 ++
>  tools/perf/util/test-attr/test-record-graph-default |   6 ++
>  tools/perf/util/test-attr/test-record-graph-dwarf   |   6 ++
>  tools/perf/util/test-attr/test-record-graph-fp      |   6 ++
>  tools/perf/util/test-attr/test-record-group         |  17 ++++
>  tools/perf/util/test-attr/test-record-no-inherit    |   7 ++
>  tools/perf/util/test-attr/test-record-no-samples    |   6 ++
>  tools/perf/util/test-attr/test-record-period        |   7 ++
>  tools/perf/util/test-attr/test-stat-basic           |   6 ++
>  tools/perf/util/test-attr/test-stat-group           |  15 +++
>  tools/perf/util/test-attr/test-stat-no-inherit      |   7 ++
>  21 files changed, 612 insertions(+)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC 00/13] perf test: Add perf_event_attr tests
  2012-08-24 13:07 ` [RFC 00/13] perf test: Add perf_event_attr tests Arnaldo Carvalho de Melo
@ 2012-08-24 18:12   ` Ingo Molnar
  0 siblings, 0 replies; 16+ messages in thread
From: Ingo Molnar @ 2012-08-24 18:12 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, linux-kernel, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker


* Arnaldo Carvalho de Melo <acme@ghostprotocols.net> wrote:

> Em Fri, Aug 24, 2012 at 11:00:31AM +0200, Jiri Olsa escreveu:
> 
> >  tools/perf/util/test-attr.c                         | 142 ++++++++++++++++++++++++++
> >  tools/perf/util/test-attr.py                        | 272 ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tools/perf/util/test-attr/base-record               |  39 ++++++++
> 
> I suggest we move all this to:
> 
>   tools/perf/tests/attr/

Yes!

I'd even strongly suggest increasing perf test's prominence 
within the project: if the tests are quick enough to run we 
could run them during the build of perf and warn if perf test 
fails in an unexpected way with the new perf binary.

( Running new perf on older kernel should never cause an 
  unexpected failure and thus a build warning. )

So as people are working on new perf patches, the default build 
will run perf test and will catch some errors. As the number of 
testcases grows it might catch a wide range of bugs. It will 
also help us find regressions sooner, when users/testers build 
perf they'll always run perf test as well and report new 
warnings/failures.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-08-24 18:12 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-24  9:00 [RFC 00/13] perf test: Add perf_event_attr tests Jiri Olsa
2012-08-24  9:00 ` [PATCH 01/13] perf test: Add framework for atomated " Jiri Olsa
2012-08-24  9:00 ` [PATCH 02/13] perf test: Add perf_event_attr record basic test Jiri Olsa
2012-08-24  9:00 ` [PATCH 03/13] perf test: Add perf_event_attr record group test Jiri Olsa
2012-08-24  9:00 ` [PATCH 04/13] perf test: Add perf_event_attr record freq test Jiri Olsa
2012-08-24  9:00 ` [PATCH 05/13] perf test: Add perf_event_attr record count test Jiri Olsa
2012-08-24  9:00 ` [PATCH 06/13] perf test: Add perf_event_attr record graph test Jiri Olsa
2012-08-24  9:00 ` [PATCH 07/13] perf test: Add perf_event_attr record period test Jiri Olsa
2012-08-24  9:00 ` [PATCH 08/13] perf test: Add perf_event_attr record no samples test Jiri Olsa
2012-08-24  9:00 ` [PATCH 09/13] perf test: Add perf_event_attr record no-inherit test Jiri Olsa
2012-08-24  9:00 ` [PATCH 10/13] perf test: Add perf_event_attr stat basic test Jiri Olsa
2012-08-24  9:00 ` [PATCH 11/13] perf test: Add perf_event_attr stat no-inherit test Jiri Olsa
2012-08-24  9:00 ` [PATCH 12/13] perf test: Add perf_event_attr stat group test Jiri Olsa
2012-08-24  9:00 ` [PATCH 13/13] perf test: Add attr tests under builtin test command Jiri Olsa
2012-08-24 13:07 ` [RFC 00/13] perf test: Add perf_event_attr tests Arnaldo Carvalho de Melo
2012-08-24 18:12   ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).