aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-11-08 11:01:01 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-11-08 11:16:19 -0500
commitd4fcf0a8b96b23a245a21065c9424e09c8080819 (patch)
treefb40366204b58719fa9a39f7077929a80984d4c6 /tools
parent580e338d7e9dc4947cba2e1021e78e76ebe0869e (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/tests/attr.py30
1 files changed, 16 insertions, 14 deletions
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index 9b25b33cf3e9..e702b82dcb86 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -228,24 +228,26 @@ class Test(object):
228 def run(self): 228 def run(self):
229 tempdir = tempfile.mkdtemp(); 229 tempdir = tempfile.mkdtemp();
230 230
231 # run the test script 231 try:
232 self.run_cmd(tempdir); 232 # run the test script
233 self.run_cmd(tempdir);
233 234
234 # load events expectation for the test 235 # load events expectation for the test
235 log.info(" loading result events"); 236 log.info(" loading result events");
236 for f in glob.glob(tempdir + '/event*'): 237 for f in glob.glob(tempdir + '/event*'):
237 self.load_events(f, self.result); 238 self.load_events(f, self.result);
238 239
239 # resolve group_fd to event names 240 # resolve group_fd to event names
240 self.resolve_groups(self.expect); 241 self.resolve_groups(self.expect);
241 self.resolve_groups(self.result); 242 self.resolve_groups(self.result);
242 243
243 # do the expectation - results matching - both ways 244 # do the expectation - results matching - both ways
244 self.compare(self.expect, self.result) 245 self.compare(self.expect, self.result)
245 self.compare(self.result, self.expect) 246 self.compare(self.result, self.expect)
246 247
247 # cleanup 248 finally:
248 shutil.rmtree(tempdir) 249 # cleanup
250 shutil.rmtree(tempdir)
249 251
250 252
251def run_tests(options): 253def run_tests(options):