summaryrefslogtreecommitdiffstats
path: root/meta/classes/testimage.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/testimage.bbclass')
-rw-r--r--meta/classes/testimage.bbclass40
1 files changed, 14 insertions, 26 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index c709384b91..7c8b2b30a1 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -99,30 +99,9 @@ TESTIMAGE_DUMP_DIR ?= "${LOG_DIR}/runtime-hostdump/"
99TESTIMAGE_UPDATE_VARS ?= "DL_DIR WORKDIR DEPLOY_DIR" 99TESTIMAGE_UPDATE_VARS ?= "DL_DIR WORKDIR DEPLOY_DIR"
100 100
101testimage_dump_target () { 101testimage_dump_target () {
102 top -bn1
103 ps
104 free
105 df
106 # The next command will export the default gateway IP
107 export DEFAULT_GATEWAY=$(ip route | awk '/default/ { print $3}')
108 ping -c3 $DEFAULT_GATEWAY
109 dmesg
110 netstat -an
111 ip address
112 # Next command will dump logs from /var/log/
113 find /var/log/ -type f 2>/dev/null -exec echo "====================" \; -exec echo {} \; -exec echo "====================" \; -exec cat {} \; -exec echo "" \;
114} 102}
115 103
116testimage_dump_host () { 104testimage_dump_host () {
117 top -bn1
118 iostat -x -z -N -d -p ALL 20 2
119 ps -ef
120 free
121 df
122 memstat
123 dmesg
124 ip -s link
125 netstat -an
126} 105}
127 106
128python do_testimage() { 107python do_testimage() {
@@ -193,6 +172,7 @@ def testimage_main(d):
193 import json 172 import json
194 import signal 173 import signal
195 import logging 174 import logging
175 import shutil
196 176
197 from bb.utils import export_proxies 177 from bb.utils import export_proxies
198 from oeqa.core.utils.misc import updateTestData 178 from oeqa.core.utils.misc import updateTestData
@@ -228,9 +208,10 @@ def testimage_main(d):
228 208
229 tdname = "%s.testdata.json" % image_name 209 tdname = "%s.testdata.json" % image_name
230 try: 210 try:
231 td = json.load(open(tdname, "r")) 211 with open(tdname, "r") as f:
232 except (FileNotFoundError) as err: 212 td = json.load(f)
233 bb.fatal('File %s Not Found. Have you built the image with INHERIT+="testimage" in the conf/local.conf?' % tdname) 213 except FileNotFoundError as err:
214 bb.fatal('File %s not found (%s).\nHave you built the image with INHERIT += "testimage" in the conf/local.conf?' % (tdname, err))
234 215
235 # Some variables need to be updates (mostly paths) with the 216 # Some variables need to be updates (mostly paths) with the
236 # ones of the current environment because some tests require them. 217 # ones of the current environment because some tests require them.
@@ -397,10 +378,17 @@ def testimage_main(d):
397 get_testimage_result_id(configuration), 378 get_testimage_result_id(configuration),
398 dump_streams=d.getVar('TESTREPORT_FULLLOGS')) 379 dump_streams=d.getVar('TESTREPORT_FULLLOGS'))
399 results.logSummary(pn) 380 results.logSummary(pn)
381
382 # Copy additional logs to tmp/log/oeqa so it's easier to find them
383 targetdir = os.path.join(get_testimage_json_result_dir(d), d.getVar("PN"))
384 os.makedirs(targetdir, exist_ok=True)
385 os.symlink(bootlog, os.path.join(targetdir, os.path.basename(bootlog)))
386 os.symlink(d.getVar("BB_LOGFILE"), os.path.join(targetdir, os.path.basename(d.getVar("BB_LOGFILE") + "." + d.getVar('DATETIME'))))
387
400 if not results or not complete: 388 if not results or not complete:
401 bb.fatal('%s - FAILED - tests were interrupted during execution' % pn, forcelog=True) 389 bb.fatal('%s - FAILED - tests were interrupted during execution, check the logs in %s' % (pn, d.getVar("LOG_DIR")), forcelog=True)
402 if not results.wasSuccessful(): 390 if not results.wasSuccessful():
403 bb.fatal('%s - FAILED - check the task log and the ssh log' % pn, forcelog=True) 391 bb.fatal('%s - FAILED - also check the logs in %s' % (pn, d.getVar("LOG_DIR")), forcelog=True)
404 392
405def get_runtime_paths(d): 393def get_runtime_paths(d):
406 """ 394 """