summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Arteaga <andyspiros@gmail.com>2012-04-09 21:22:28 +0200
committerAndrea Arteaga <andyspiros@gmail.com>2012-04-09 21:22:28 +0200
commitc714fb08fdb4ec06d573bc9aa8647fa62fc182f1 (patch)
treea169774ea01fba695f8debc70c8c29c4a3683350
parentEnvironment files under (root)/etc/env.d are interpreted. (diff)
downloadauto-numerical-bench-c714fb08fdb4ec06d573bc9aa8647fa62fc182f1.tar.gz
auto-numerical-bench-c714fb08fdb4ec06d573bc9aa8647fa62fc182f1.tar.bz2
auto-numerical-bench-c714fb08fdb4ec06d573bc9aa8647fa62fc182f1.zip
Added -c / --clean switch.
-rw-r--r--numbench/benchconfig.py10
-rw-r--r--numbench/main.py4
2 files changed, 13 insertions, 1 deletions
diff --git a/numbench/benchconfig.py b/numbench/benchconfig.py
index c7ff33b..244ac63 100644
--- a/numbench/benchconfig.py
+++ b/numbench/benchconfig.py
@@ -50,11 +50,19 @@ if not locals().has_key('initialized'):
basedir = pjoin(curdir, passargs[i+1])
passargs = passargs[:i] + passargs[i+2:]
break
+
+ if a in ('-c', '--clean'):
+ clean = True
+ passargs = passargs[:i] + passargs[i+1:]
+
+ # Clean flag
+ if not locals().has_key('clean'):
+ clean = False
# Storage directories
if not locals().has_key('basedir'):
basedirb = pjoin(os.environ['HOME'], '.numbench') \
- + '/run_' + modulename + '_' + time.strftime('%Y-%m-%d')
+ + '/numbench_' + modulename + '_' + time.strftime('%Y-%m-%d')
if os.path.exists(basedirb):
n = 1
while True:
diff --git a/numbench/main.py b/numbench/main.py
index 6e9fb2c..acfe6d7 100644
--- a/numbench/main.py
+++ b/numbench/main.py
@@ -238,6 +238,10 @@ for tn,(name,test) in enumerate(cfg.tests.items(),1):
# Save the results
report.saveReport()
+# Clean up the directories
+if cfg.clean:
+ bu.rmdir(cfg.testsdir)
+ bu.rmdir(cfg.rootsdir)
# TODO: reintroduce the instructions feature (and remove "exit)