summaryrefslogtreecommitdiffstats
path: root/meta/classes/testexport.bbclass
diff options
context:
space:
mode:
authorJoshua Lock <joshua.g.lock@intel.com>2016-12-14 21:13:04 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-16 10:23:23 +0000
commitc4e2c59088765d1f1de7ec57cde91980f887c2ff (patch)
treea2fda8ac5916fb59a711e9220c2177008cca9347 /meta/classes/testexport.bbclass
parentd5e67725ac11e3296cad104470931ffa16824b90 (diff)
downloadpoky-c4e2c59088765d1f1de7ec57cde91980f887c2ff.tar.gz
meta: remove True option to getVar calls
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) (From OE-Core rev: 7c552996597faaee2fbee185b250c0ee30ea3b5f) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/testexport.bbclass')
-rw-r--r--meta/classes/testexport.bbclass40
1 files changed, 20 insertions, 20 deletions
diff --git a/meta/classes/testexport.bbclass b/meta/classes/testexport.bbclass
index 5147020820..3f7b2de71d 100644
--- a/meta/classes/testexport.bbclass
+++ b/meta/classes/testexport.bbclass
@@ -49,19 +49,19 @@ def exportTests(d,tc):
49 import re 49 import re
50 import oe.path 50 import oe.path
51 51
52 exportpath = d.getVar("TEST_EXPORT_DIR", True) 52 exportpath = d.getVar("TEST_EXPORT_DIR")
53 53
54 savedata = {} 54 savedata = {}
55 savedata["d"] = {} 55 savedata["d"] = {}
56 savedata["target"] = {} 56 savedata["target"] = {}
57 savedata["target"]["ip"] = tc.target.ip or d.getVar("TEST_TARGET_IP", True) 57 savedata["target"]["ip"] = tc.target.ip or d.getVar("TEST_TARGET_IP")
58 savedata["target"]["server_ip"] = tc.target.server_ip or d.getVar("TEST_SERVER_IP", True) 58 savedata["target"]["server_ip"] = tc.target.server_ip or d.getVar("TEST_SERVER_IP")
59 59
60 keys = [ key for key in d.keys() if not key.startswith("_") and not key.startswith("BB") \ 60 keys = [ key for key in d.keys() if not key.startswith("_") and not key.startswith("BB") \
61 and not key.startswith("B_pn") and not key.startswith("do_") and not d.getVarFlag(key, "func", True)] 61 and not key.startswith("B_pn") and not key.startswith("do_") and not d.getVarFlag(key, "func", True)]
62 for key in keys: 62 for key in keys:
63 try: 63 try:
64 savedata["d"][key] = d.getVar(key, True) 64 savedata["d"][key] = d.getVar(key)
65 except bb.data_smart.ExpansionError: 65 except bb.data_smart.ExpansionError:
66 # we don't care about those anyway 66 # we don't care about those anyway
67 pass 67 pass
@@ -71,7 +71,7 @@ def exportTests(d,tc):
71 json.dump(savedata, f, skipkeys=True, indent=4, sort_keys=True) 71 json.dump(savedata, f, skipkeys=True, indent=4, sort_keys=True)
72 72
73 # Replace absolute path with relative in the file 73 # Replace absolute path with relative in the file
74 exclude_path = os.path.join(d.getVar("COREBASE", True),'meta','lib','oeqa') 74 exclude_path = os.path.join(d.getVar("COREBASE"),'meta','lib','oeqa')
75 f1 = open(json_file,'r').read() 75 f1 = open(json_file,'r').read()
76 f2 = open(json_file,'w') 76 f2 = open(json_file,'w')
77 m = f1.replace(exclude_path,'oeqa') 77 m = f1.replace(exclude_path,'oeqa')
@@ -90,7 +90,7 @@ def exportTests(d,tc):
90 bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/runtime/files")) 90 bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/runtime/files"))
91 bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/utils")) 91 bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/utils"))
92 # copy test modules, this should cover tests in other layers too 92 # copy test modules, this should cover tests in other layers too
93 bbpath = d.getVar("BBPATH", True).split(':') 93 bbpath = d.getVar("BBPATH").split(':')
94 for t in tc.testslist: 94 for t in tc.testslist:
95 isfolder = False 95 isfolder = False
96 if re.search("\w+\.\w+\.test_\S+", t): 96 if re.search("\w+\.\w+\.test_\S+", t):
@@ -111,7 +111,7 @@ def exportTests(d,tc):
111 if os.path.isfile(json_file): 111 if os.path.isfile(json_file):
112 shutil.copy2(json_file, os.path.join(exportpath, "oeqa/runtime")) 112 shutil.copy2(json_file, os.path.join(exportpath, "oeqa/runtime"))
113 # Get meta layer 113 # Get meta layer
114 for layer in d.getVar("BBLAYERS", True).split(): 114 for layer in d.getVar("BBLAYERS").split():
115 if os.path.basename(layer) == "meta": 115 if os.path.basename(layer) == "meta":
116 meta_layer = layer 116 meta_layer = layer
117 break 117 break
@@ -130,28 +130,28 @@ def exportTests(d,tc):
130 shutil.copy2(os.path.join(root, f), os.path.join(exportpath, "oeqa/runtime/files")) 130 shutil.copy2(os.path.join(root, f), os.path.join(exportpath, "oeqa/runtime/files"))
131 131
132 # Create tar file for common parts of testexport 132 # Create tar file for common parts of testexport
133 create_tarball(d, "testexport.tar.gz", d.getVar("TEST_EXPORT_DIR", True)) 133 create_tarball(d, "testexport.tar.gz", d.getVar("TEST_EXPORT_DIR"))
134 134
135 # Copy packages needed for runtime testing 135 # Copy packages needed for runtime testing
136 test_pkg_dir = d.getVar("TEST_NEEDED_PACKAGES_DIR", True) 136 test_pkg_dir = d.getVar("TEST_NEEDED_PACKAGES_DIR")
137 if os.listdir(test_pkg_dir): 137 if os.listdir(test_pkg_dir):
138 export_pkg_dir = os.path.join(d.getVar("TEST_EXPORT_DIR", True), "packages") 138 export_pkg_dir = os.path.join(d.getVar("TEST_EXPORT_DIR"), "packages")
139 oe.path.copytree(test_pkg_dir, export_pkg_dir) 139 oe.path.copytree(test_pkg_dir, export_pkg_dir)
140 # Create tar file for packages needed by the DUT 140 # Create tar file for packages needed by the DUT
141 create_tarball(d, "testexport_packages_%s.tar.gz" % d.getVar("MACHINE", True), export_pkg_dir) 141 create_tarball(d, "testexport_packages_%s.tar.gz" % d.getVar("MACHINE"), export_pkg_dir)
142 142
143 # Copy SDK 143 # Copy SDK
144 if d.getVar("TEST_EXPORT_SDK_ENABLED", True) == "1": 144 if d.getVar("TEST_EXPORT_SDK_ENABLED") == "1":
145 sdk_deploy = d.getVar("SDK_DEPLOY", True) 145 sdk_deploy = d.getVar("SDK_DEPLOY")
146 tarball_name = "%s.sh" % d.getVar("TEST_EXPORT_SDK_NAME", True) 146 tarball_name = "%s.sh" % d.getVar("TEST_EXPORT_SDK_NAME")
147 tarball_path = os.path.join(sdk_deploy, tarball_name) 147 tarball_path = os.path.join(sdk_deploy, tarball_name)
148 export_sdk_dir = os.path.join(d.getVar("TEST_EXPORT_DIR", True), 148 export_sdk_dir = os.path.join(d.getVar("TEST_EXPORT_DIR"),
149 d.getVar("TEST_EXPORT_SDK_DIR", True)) 149 d.getVar("TEST_EXPORT_SDK_DIR"))
150 bb.utils.mkdirhier(export_sdk_dir) 150 bb.utils.mkdirhier(export_sdk_dir)
151 shutil.copy2(tarball_path, export_sdk_dir) 151 shutil.copy2(tarball_path, export_sdk_dir)
152 152
153 # Create tar file for the sdk 153 # Create tar file for the sdk
154 create_tarball(d, "testexport_sdk_%s.tar.gz" % d.getVar("SDK_ARCH", True), export_sdk_dir) 154 create_tarball(d, "testexport_sdk_%s.tar.gz" % d.getVar("SDK_ARCH"), export_sdk_dir)
155 155
156 bb.plain("Exported tests to: %s" % exportpath) 156 bb.plain("Exported tests to: %s" % exportpath)
157 157
@@ -161,8 +161,8 @@ def testexport_main(d):
161 from oeqa.utils.dump import get_host_dumper 161 from oeqa.utils.dump import get_host_dumper
162 162
163 test_create_extract_dirs(d) 163 test_create_extract_dirs(d)
164 export_dir = d.getVar("TEST_EXPORT_DIR", True) 164 export_dir = d.getVar("TEST_EXPORT_DIR")
165 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR", True)) 165 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
166 bb.utils.remove(export_dir, recurse=True) 166 bb.utils.remove(export_dir, recurse=True)
167 bb.utils.mkdirhier(export_dir) 167 bb.utils.mkdirhier(export_dir)
168 168
@@ -188,7 +188,7 @@ def create_tarball(d, tar_name, src_dir):
188 188
189 import tarfile 189 import tarfile
190 190
191 tar_path = os.path.join(d.getVar("TEST_EXPORT_DIR", True), tar_name) 191 tar_path = os.path.join(d.getVar("TEST_EXPORT_DIR"), tar_name)
192 current_dir = os.getcwd() 192 current_dir = os.getcwd()
193 src_dir = src_dir.rstrip('/') 193 src_dir = src_dir.rstrip('/')
194 dir_name = os.path.dirname(src_dir) 194 dir_name = os.path.dirname(src_dir)