[Fuego] [PATCH 2/3] OF: create a spec.json on each run
Daniel Sangorrin
daniel.sangorrin at toshiba.co.jp
Tue Sep 4 10:01:31 UTC 2018
This patch outputs the spec used in a run into a spec.json
file at the run's log folder. Although prolog.sh already
contains the variables from the spec, it is useful to have
a spec.json file that we can share. Also, this spec.json
file could be created by other means such as dynamic
variables instead of coming from a semi-permanent source.
Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
engine/scripts/ovgen.py | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/engine/scripts/ovgen.py b/engine/scripts/ovgen.py
index 7c1f05f..ef09e85 100755
--- a/engine/scripts/ovgen.py
+++ b/engine/scripts/ovgen.py
@@ -397,7 +397,7 @@ def generateProlog(logdir, ofcls, classes, testdir, testspec):
file.write(outfile, "\n")
- ts = parseSpec(testdir, testspec)
+ ts = parseSpec(logdir, testdir, testspec)
generateSpec(ts, outfile)
# generateSpec - generate shell output for the spec
@@ -431,9 +431,24 @@ def generateSpec(ts, fout):
fout.write(outPattern + "\n")
fout.write(outMessage + "\n")
-def parseSpec(testdir, testspec):
+def parseSpec(logdir, testdir, testspec):
# FIXTHIS: get fuego-core from env
- specpath = '/fuego-core/engine/tests/%s/spec.json' % (testdir)
+ specpath = logdir + '/spec.json'
+ if not os.path.exists(specpath):
+ # create a spec.json by stripping the test's spec.json
+ test_specpath = '/fuego-core/engine/tests/%s/spec.json' % (testdir)
+ with open(test_specpath) as f:
+ try:
+ test_spec_data = json.load(f)
+ except:
+ error_out("Error parsing spec file %s" % specpath)
+ for key in test_spec_data['specs'].keys():
+ if key != testspec:
+ del test_spec_data['specs'][key]
+ print "test spec data" + str(test_spec_data)
+ with open(specpath, 'w+') as spec_file:
+ json.dump(test_spec_data, spec_file)
+
ts = TestSpecs()
debug_print("Parsing %s spec file" % (specpath))
--
2.7.4
More information about the Fuego
mailing list