* [PATCH] perf tests: Move attr.py temp dir cleanup into finally section
@ 2012-11-08 16:01 Jiri Olsa
2012-11-14 7:32 ` [tip:perf/core] perf tests: Move attr. py " tip-bot for Jiri Olsa
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Olsa @ 2012-11-08 16:01 UTC (permalink / raw)
To: linux-kernel
Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
Paul Mackerras, Peter Zijlstra, Arnaldo Carvalho de Melo
Currently if there's 'Unsup' exception raised, we do not clean
up the temp directory. Solving this by adding 'finally' to
make the cleanup in any case.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/attr.py | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index 9b25b33c..e702b82 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -228,24 +228,26 @@ class Test(object):
def run(self):
tempdir = tempfile.mkdtemp();
- # run the test script
- self.run_cmd(tempdir);
+ try:
+ # run the test script
+ self.run_cmd(tempdir);
- # load events expectation for the test
- log.info(" loading result events");
- for f in glob.glob(tempdir + '/event*'):
- self.load_events(f, self.result);
+ # load events expectation for the test
+ log.info(" loading result events");
+ for f in glob.glob(tempdir + '/event*'):
+ self.load_events(f, self.result);
- # resolve group_fd to event names
- self.resolve_groups(self.expect);
- self.resolve_groups(self.result);
+ # resolve group_fd to event names
+ self.resolve_groups(self.expect);
+ self.resolve_groups(self.result);
- # do the expectation - results matching - both ways
- self.compare(self.expect, self.result)
- self.compare(self.result, self.expect)
+ # do the expectation - results matching - both ways
+ self.compare(self.expect, self.result)
+ self.compare(self.result, self.expect)
- # cleanup
- shutil.rmtree(tempdir)
+ finally:
+ # cleanup
+ shutil.rmtree(tempdir)
def run_tests(options):
--
1.7.11.7
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tip:perf/core] perf tests: Move attr. py temp dir cleanup into finally section
2012-11-08 16:01 [PATCH] perf tests: Move attr.py temp dir cleanup into finally section Jiri Olsa
@ 2012-11-14 7:32 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Jiri Olsa @ 2012-11-14 7:32 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, jolsa,
fweisbec, tglx, cjashfor, mingo
Commit-ID: d4fcf0a8b96b23a245a21065c9424e09c8080819
Gitweb: http://git.kernel.org/tip/d4fcf0a8b96b23a245a21065c9424e09c8080819
Author: Jiri Olsa <jolsa@redhat.com>
AuthorDate: Thu, 8 Nov 2012 17:01:01 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 8 Nov 2012 13:16:19 -0300
perf tests: Move attr.py temp dir cleanup into finally section
Currently if there's 'Unsup' exception raised, we do not clean up the
temp directory. Solving this by adding 'finally' to make the cleanup in
any case.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1352390461-15404-1-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/attr.py | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index 9b25b33c..e702b82 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -228,24 +228,26 @@ class Test(object):
def run(self):
tempdir = tempfile.mkdtemp();
- # run the test script
- self.run_cmd(tempdir);
+ try:
+ # run the test script
+ self.run_cmd(tempdir);
- # load events expectation for the test
- log.info(" loading result events");
- for f in glob.glob(tempdir + '/event*'):
- self.load_events(f, self.result);
+ # load events expectation for the test
+ log.info(" loading result events");
+ for f in glob.glob(tempdir + '/event*'):
+ self.load_events(f, self.result);
- # resolve group_fd to event names
- self.resolve_groups(self.expect);
- self.resolve_groups(self.result);
+ # resolve group_fd to event names
+ self.resolve_groups(self.expect);
+ self.resolve_groups(self.result);
- # do the expectation - results matching - both ways
- self.compare(self.expect, self.result)
- self.compare(self.result, self.expect)
+ # do the expectation - results matching - both ways
+ self.compare(self.expect, self.result)
+ self.compare(self.result, self.expect)
- # cleanup
- shutil.rmtree(tempdir)
+ finally:
+ # cleanup
+ shutil.rmtree(tempdir)
def run_tests(options):
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-14 7:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-08 16:01 [PATCH] perf tests: Move attr.py temp dir cleanup into finally section Jiri Olsa
2012-11-14 7:32 ` [tip:perf/core] perf tests: Move attr. py " tip-bot for Jiri Olsa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome