[oe-commits] Lucian Musat : oeqa/testimage: Remove absolute path to oeqa from json

git at git.openembedded.org git at git.openembedded.org
Sat Sep 26 17:14:31 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 37bee6f54484a02ea5a5185680378ce8b7dc9fa2
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=37bee6f54484a02ea5a5185680378ce8b7dc9fa2

Author: Lucian Musat <george.l.musat at intel.com>
Date:   Thu Sep 24 12:14:44 2015 +0300

oeqa/testimage: Remove absolute path to oeqa from json

In the json file the whole datastore is serialized which contains
absolute path to the oeqa folder. This breaks the functionality
when trying to run the tests from other machines.

Signed-off-by: Lucian Musat <george.l.musat at intel.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>

---

 meta/classes/testimage.bbclass | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index c62e391..2efab29 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -198,9 +198,18 @@ def exportTests(d,tc):
     savedata["host_dumper"]["parent_dir"] = tc.host_dumper.parent_dir
     savedata["host_dumper"]["cmds"] = tc.host_dumper.cmds
 
-    with open(os.path.join(exportpath, "testdata.json"), "w") as f:
+    json_file = os.path.join(exportpath, "testdata.json")
+    with open(json_file, "w") as f:
             json.dump(savedata, f, skipkeys=True, indent=4, sort_keys=True)
 
+    # Replace absolute path with relative in the file
+    exclude_path = os.path.join(d.getVar("COREBASE", True),'meta','lib','oeqa')
+    f1 = open(json_file,'r').read()
+    f2 = open(json_file,'w')
+    m = f1.replace(exclude_path,'oeqa')
+    f2.write(m)
+    f2.close()
+
     # now start copying files
     # we'll basically copy everything under meta/lib/oeqa, with these exceptions
     #  - oeqa/targetcontrol.py - not needed



More information about the Openembedded-commits mailing list