提交 d4fcf0a8 编写于 作者: J Jiri Olsa 提交者: Arnaldo Carvalho de Melo

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: NJiri 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.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 580e338d
...@@ -228,24 +228,26 @@ class Test(object): ...@@ -228,24 +228,26 @@ class Test(object):
def run(self): def run(self):
tempdir = tempfile.mkdtemp(); tempdir = tempfile.mkdtemp();
# run the test script try:
self.run_cmd(tempdir); # run the test script
self.run_cmd(tempdir);
# load events expectation for the test # load events expectation for the test
log.info(" loading result events"); log.info(" loading result events");
for f in glob.glob(tempdir + '/event*'): for f in glob.glob(tempdir + '/event*'):
self.load_events(f, self.result); self.load_events(f, self.result);
# resolve group_fd to event names # resolve group_fd to event names
self.resolve_groups(self.expect); self.resolve_groups(self.expect);
self.resolve_groups(self.result); self.resolve_groups(self.result);
# do the expectation - results matching - both ways # do the expectation - results matching - both ways
self.compare(self.expect, self.result) self.compare(self.expect, self.result)
self.compare(self.result, self.expect) self.compare(self.result, self.expect)
# cleanup finally:
shutil.rmtree(tempdir) # cleanup
shutil.rmtree(tempdir)
def run_tests(options): def run_tests(options):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册