1 |
commit: 9cab8166f1276536155f96fb66b8d362ab1d85aa |
2 |
Author: Andrea Arteaga <andyspiros <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Sep 27 11:18:48 2012 +0000 |
4 |
Commit: Andrea Arteaga <andyspiros <AT> gmail <DOT> com> |
5 |
CommitDate: Thu Sep 27 11:18:48 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=9cab8166 |
7 |
|
8 |
Added initial support for copying the reports at the end (working for |
9 |
local copy). |
10 |
|
11 |
--- |
12 |
numbench/benchconfig.py | 8 +++++++- |
13 |
numbench/main.py | 16 +++++++++++----- |
14 |
2 files changed, 18 insertions(+), 6 deletions(-) |
15 |
|
16 |
diff --git a/numbench/benchconfig.py b/numbench/benchconfig.py |
17 |
index 56ef304..ffdedba 100644 |
18 |
--- a/numbench/benchconfig.py |
19 |
+++ b/numbench/benchconfig.py |
20 |
@@ -38,6 +38,7 @@ rootsdir = None |
21 |
pkgsdir = None |
22 |
reportdir = None |
23 |
logdir = None |
24 |
+copyreport = None |
25 |
|
26 |
# Module |
27 |
module = None |
28 |
@@ -50,7 +51,7 @@ tests = None |
29 |
|
30 |
|
31 |
def parseArguments(): |
32 |
- global arguments, inputfile, clean, imageformat, basedir |
33 |
+ global arguments, inputfile, clean, imageformat, basedir, copyreport |
34 |
|
35 |
arguments = [] |
36 |
clean = False |
37 |
@@ -82,6 +83,11 @@ def parseArguments(): |
38 |
imageformat = sys.argv[i + 1] |
39 |
skipargs += 1 |
40 |
continue |
41 |
+ |
42 |
+ if a in ('-r', '--copy-report'): |
43 |
+ copyreport = sys.argv[i + 1] |
44 |
+ skipargs += 1 |
45 |
+ continue |
46 |
|
47 |
arguments.append(a) |
48 |
|
49 |
|
50 |
diff --git a/numbench/main.py b/numbench/main.py |
51 |
index cfeece5..cd0d3d7 100644 |
52 |
--- a/numbench/main.py |
53 |
+++ b/numbench/main.py |
54 |
@@ -39,14 +39,16 @@ Usage: numbench conffile [options] |
55 |
numbench [ -h | --help ] |
56 |
|
57 |
Options: |
58 |
- - h, - -help Displays an help message. |
59 |
- - d, - -directory < dir > Stores the data in the given directory. If |
60 |
+ -h, --help Displays an help message. |
61 |
+ -d, --directory <dir> Store the data in the given directory. If |
62 |
not given, a directory in ~/.numbench |
63 |
is chosen. |
64 |
- - c, - -clean Removes the temporary data at the end. |
65 |
- - i, - -imageformat < format > Selects the given format for the resulting |
66 |
+ -c, --clean Remove the temporary data at the end. |
67 |
+ -i, --imageformat <format> Select the given format for the resulting |
68 |
images. Available are png, svg, eps, ps, |
69 |
pdf. Default is svg. |
70 |
+ -r, --copy-report <URI> Transfer the report directory to the given |
71 |
+ path. Local paths are currently supported. |
72 |
""" |
73 |
modnames = modules.getModulesNames() |
74 |
|
75 |
@@ -71,7 +73,7 @@ if len(sys.argv) < 2 or sys.argv[1] in ('-h', '--help'): |
76 |
## BEGIN THE TRUE SCRIPT |
77 |
|
78 |
# Import the packages |
79 |
-import re |
80 |
+import re, shutil |
81 |
from fnmatch import fnmatch |
82 |
from os.path import join as pjoin |
83 |
|
84 |
@@ -251,6 +253,10 @@ report.saveReport() |
85 |
if cfg.clean: |
86 |
bu.rmdir(cfg.testsdir) |
87 |
bu.rmdir(cfg.rootsdir) |
88 |
+ |
89 |
+# Copy results |
90 |
+if cfg.copyreport: |
91 |
+ shutil.copytree(cfg.reportdir, cfg.copyreport, True) |
92 |
|
93 |
|
94 |
# TODO: reintroduce the instructions feature (and remove "exit) |