summaryrefslogtreecommitdiffstats
path: root/meta/classes/imagetest-qemu.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-09 15:00:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-10 11:51:19 +0000
commitc8dee9b92dfd545852ecac8dc2adfc95ac02e957 (patch)
tree5f1b86954646a0f3bb914407994388a6a4346769 /meta/classes/imagetest-qemu.bbclass
parent5d3860f4a8abb8e95442b04f8b84a333af362fcd (diff)
downloadpoky-c8dee9b92dfd545852ecac8dc2adfc95ac02e957.tar.gz
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata: sed \ -e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \ -e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -i `grep -ril bb.data *` (From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/imagetest-qemu.bbclass')
-rw-r--r--meta/classes/imagetest-qemu.bbclass56
1 files changed, 28 insertions, 28 deletions
diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass
index 4ea86c04fe..de142bc0fb 100644
--- a/meta/classes/imagetest-qemu.bbclass
+++ b/meta/classes/imagetest-qemu.bbclass
@@ -35,12 +35,12 @@ def qemuimagetest_main(d):
35 35
36 casestr = re.compile(r'(?P<scen>\w+\b):(?P<case>\S+$)') 36 casestr = re.compile(r'(?P<scen>\w+\b):(?P<case>\S+$)')
37 resultstr = re.compile(r'\s*(?P<case>\w+)\s*(?P<pass>\d+)\s*(?P<fail>\d+)\s*(?P<noresult>\d+)') 37 resultstr = re.compile(r'\s*(?P<case>\w+)\s*(?P<pass>\d+)\s*(?P<fail>\d+)\s*(?P<noresult>\d+)')
38 machine = bb.data.getVar('MACHINE', d, 1) 38 machine = d.getVar('MACHINE', 1)
39 pname = bb.data.getVar('PN', d, 1) 39 pname = d.getVar('PN', 1)
40 40
41 """function to save test cases running status""" 41 """function to save test cases running status"""
42 def teststatus(test, status, index, length): 42 def teststatus(test, status, index, length):
43 test_status = bb.data.getVar('TEST_STATUS', d, 1) 43 test_status = d.getVar('TEST_STATUS', 1)
44 if not os.path.exists(test_status): 44 if not os.path.exists(test_status):
45 raise bb.build.FuncFailed("No test status file existing under TEST_TMP") 45 raise bb.build.FuncFailed("No test status file existing under TEST_TMP")
46 46
@@ -51,30 +51,30 @@ def qemuimagetest_main(d):
51 51
52 """funtion to run each case under scenario""" 52 """funtion to run each case under scenario"""
53 def runtest(scen, case, fulltestpath): 53 def runtest(scen, case, fulltestpath):
54 resultpath = bb.data.getVar('TEST_RESULT', d, 1) 54 resultpath = d.getVar('TEST_RESULT', 1)
55 tmppath = bb.data.getVar('TEST_TMP', d, 1) 55 tmppath = d.getVar('TEST_TMP', 1)
56 56
57 """initialize log file for testcase""" 57 """initialize log file for testcase"""
58 logpath = bb.data.getVar('TEST_LOG', d, 1) 58 logpath = d.getVar('TEST_LOG', 1)
59 bb.utils.mkdirhier("%s/%s" % (logpath, scen)) 59 bb.utils.mkdirhier("%s/%s" % (logpath, scen))
60 caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, bb.data.getVar('DATETIME', d, 1))) 60 caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, d.getVar('DATETIME', 1)))
61 os.system("touch %s" % caselog) 61 os.system("touch %s" % caselog)
62 62
63 """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH""" 63 """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH"""
64 os.environ["PATH"] = bb.data.getVar("PATH", d, True) 64 os.environ["PATH"] = d.getVar("PATH", True)
65 os.environ["TEST_TMP"] = tmppath 65 os.environ["TEST_TMP"] = tmppath
66 os.environ["TEST_RESULT"] = resultpath 66 os.environ["TEST_RESULT"] = resultpath
67 os.environ["DEPLOY_DIR"] = bb.data.getVar("DEPLOY_DIR", d, True) 67 os.environ["DEPLOY_DIR"] = d.getVar("DEPLOY_DIR", True)
68 os.environ["QEMUARCH"] = machine 68 os.environ["QEMUARCH"] = machine
69 os.environ["QEMUTARGET"] = pname 69 os.environ["QEMUTARGET"] = pname
70 os.environ["DISPLAY"] = bb.data.getVar("DISPLAY", d, True) 70 os.environ["DISPLAY"] = d.getVar("DISPLAY", True)
71 os.environ["COREBASE"] = bb.data.getVar("COREBASE", d, True) 71 os.environ["COREBASE"] = d.getVar("COREBASE", True)
72 os.environ["TOPDIR"] = bb.data.getVar("TOPDIR", d, True) 72 os.environ["TOPDIR"] = d.getVar("TOPDIR", True)
73 os.environ["OE_TMPDIR"] = bb.data.getVar("TMPDIR", d, True) 73 os.environ["OE_TMPDIR"] = d.getVar("TMPDIR", True)
74 os.environ["TEST_STATUS"] = bb.data.getVar("TEST_STATUS", d, True) 74 os.environ["TEST_STATUS"] = d.getVar("TEST_STATUS", True)
75 os.environ["TARGET_IPSAVE"] = bb.data.getVar("TARGET_IPSAVE", d, True) 75 os.environ["TARGET_IPSAVE"] = d.getVar("TARGET_IPSAVE", True)
76 os.environ["TEST_SERIALIZE"] = bb.data.getVar("TEST_SERIALIZE", d, True) 76 os.environ["TEST_SERIALIZE"] = d.getVar("TEST_SERIALIZE", True)
77 os.environ["SDK_NAME"] = bb.data.getVar("SDK_NAME", d, True) 77 os.environ["SDK_NAME"] = d.getVar("SDK_NAME", True)
78 78
79 """run Test Case""" 79 """run Test Case"""
80 bb.note("Run %s test in scenario %s" % (case, scen)) 80 bb.note("Run %s test in scenario %s" % (case, scen))
@@ -92,13 +92,13 @@ def qemuimagetest_main(d):
92 if n: 92 if n:
93 item = n.group('scen') 93 item = n.group('scen')
94 casefile = n.group('case') 94 casefile = n.group('case')
95 for dir in bb.data.getVar("QEMUIMAGETESTS", d, True).split(): 95 for dir in d.getVar("QEMUIMAGETESTS", True).split():
96 fulltestcase = os.path.join(dir, item, casefile) 96 fulltestcase = os.path.join(dir, item, casefile)
97 if not os.path.isfile(fulltestcase): 97 if not os.path.isfile(fulltestcase):
98 raise bb.build.FuncFailed("Testcase %s not found" % fulltestcase) 98 raise bb.build.FuncFailed("Testcase %s not found" % fulltestcase)
99 list.append((item, casefile, fulltestcase)) 99 list.append((item, casefile, fulltestcase))
100 else: 100 else:
101 for dir in bb.data.getVar("QEMUIMAGETESTS", d, True).split(): 101 for dir in d.getVar("QEMUIMAGETESTS", True).split():
102 scenlist = os.path.join(dir, "scenario", machine, pname) 102 scenlist = os.path.join(dir, "scenario", machine, pname)
103 if not os.path.isfile(scenlist): 103 if not os.path.isfile(scenlist):
104 raise bb.build.FuncFailed("No scenario list file named %s found" % scenlist) 104 raise bb.build.FuncFailed("No scenario list file named %s found" % scenlist)
@@ -118,7 +118,7 @@ def qemuimagetest_main(d):
118 118
119 """Clean tmp folder for testing""" 119 """Clean tmp folder for testing"""
120 def clean_tmp(): 120 def clean_tmp():
121 tmppath = bb.data.getVar('TEST_TMP', d, 1) 121 tmppath = d.getVar('TEST_TMP', 1)
122 122
123 if os.path.isdir(tmppath): 123 if os.path.isdir(tmppath):
124 for f in os.listdir(tmppath): 124 for f in os.listdir(tmppath):
@@ -132,28 +132,28 @@ def qemuimagetest_main(d):
132 clean_tmp() 132 clean_tmp()
133 133
134 """check testcase folder and create test log folder""" 134 """check testcase folder and create test log folder"""
135 testpath = bb.data.getVar('TEST_DIR', d, 1) 135 testpath = d.getVar('TEST_DIR', 1)
136 bb.utils.mkdirhier(testpath) 136 bb.utils.mkdirhier(testpath)
137 137
138 logpath = bb.data.getVar('TEST_LOG', d, 1) 138 logpath = d.getVar('TEST_LOG', 1)
139 bb.utils.mkdirhier(logpath) 139 bb.utils.mkdirhier(logpath)
140 140
141 tmppath = bb.data.getVar('TEST_TMP', d, 1) 141 tmppath = d.getVar('TEST_TMP', 1)
142 bb.utils.mkdirhier(tmppath) 142 bb.utils.mkdirhier(tmppath)
143 143
144 """initialize test status file""" 144 """initialize test status file"""
145 test_status = bb.data.getVar('TEST_STATUS', d, 1) 145 test_status = d.getVar('TEST_STATUS', 1)
146 if os.path.exists(test_status): 146 if os.path.exists(test_status):
147 os.remove(test_status) 147 os.remove(test_status)
148 os.system("touch %s" % test_status) 148 os.system("touch %s" % test_status)
149 149
150 """initialize result file""" 150 """initialize result file"""
151 resultpath = bb.data.getVar('TEST_RESULT', d, 1) 151 resultpath = d.getVar('TEST_RESULT', 1)
152 bb.utils.mkdirhier(resultpath) 152 bb.utils.mkdirhier(resultpath)
153 resultfile = os.path.join(resultpath, "testresult.%s" % bb.data.getVar('DATETIME', d, 1)) 153 resultfile = os.path.join(resultpath, "testresult.%s" % d.getVar('DATETIME', 1))
154 sresultfile = os.path.join(resultpath, "testresult.log") 154 sresultfile = os.path.join(resultpath, "testresult.log")
155 155
156 machine = bb.data.getVar('MACHINE', d, 1) 156 machine = d.getVar('MACHINE', 1)
157 157
158 if os.path.exists(sresultfile): 158 if os.path.exists(sresultfile):
159 os.remove(sresultfile) 159 os.remove(sresultfile)
@@ -165,7 +165,7 @@ def qemuimagetest_main(d):
165 f.close() 165 f.close()
166 166
167 """generate pre-defined testcase list""" 167 """generate pre-defined testcase list"""
168 testlist = bb.data.getVar('TEST_SCEN', d, 1) 168 testlist = d.getVar('TEST_SCEN', 1)
169 fulllist = generate_list(testlist) 169 fulllist = generate_list(testlist)
170 170
171 """Begin testing""" 171 """Begin testing"""