=== modified file 'lava_dispatcher/actions/lava_test_shell.py'
@@ -21,6 +21,7 @@
# with this program; if not, see <http://www.gnu.org/licenses>.
import json
+import yaml
import logging
import os
import pexpect
@@ -131,7 +132,7 @@
testdef_file = download_image(testdef_url, self.context, tmpdir)
with open(testdef_file, 'r') as f:
logging.info('loading test definition')
- return json.load(f)
+ return yaml.load(f)
def _copy_runner(self, mntdir, target):
runner = target.deployment_data['lava_test_runner']
@@ -197,22 +198,24 @@
f.write('cd %s\n' % targetdir)
# TODO how should we handle this for Android?
- if 'deps' in testdef['install']:
+ if 'deps' in testdef['install'] and \
+ testdef['install']['deps'] is not None:
f.write('sudo apt-get update\n')
f.write('sudo apt-get install -y ')
for dep in testdef['install']['deps']:
f.write('%s ' % dep)
f.write('\n')
- if 'steps' in testdef['install']:
+ if 'steps' in testdef['install'] and \
+ testdef['install']['steps'] is not None:
for cmd in testdef['install']['steps']:
f.write('%s\n' % cmd)
def _copy_test(self, hostdir, targetdir, testdef):
self._sw_sources = []
utils.ensure_directory(hostdir)
- with open('%s/testdef.json' % hostdir, 'w') as f:
- f.write(json.dumps(testdef))
+ with open('%s/testdef.yaml' % hostdir, 'w') as f:
+ f.write(yaml.dump(testdef))
if 'install' in testdef:
self._create_repos(testdef, hostdir)
@@ -221,8 +224,10 @@
with open('%s/run.sh' % hostdir, 'w') as f:
f.write('set -e\n')
f.write('cd %s\n' % targetdir)
- for cmd in testdef['run']['steps']:
- f.write('%s\n' % cmd)
+ if 'steps' in testdef['run'] \
+ and testdef['run']['steps'] is not None:
+ for cmd in testdef['run']['steps']:
+ f.write('%s\n' % cmd)
def _mk_runner_dirs(self, mntdir):
utils.ensure_directory('%s/bin' % mntdir)
@@ -243,8 +248,8 @@
# android mount the partition under /system, while ubuntu
# mounts under /, so we have hdir for where it is on the host
# and tdir for how the target will see the path
- hdir = '%s/tests/%d_%s' % (d, i, testdef['test_id'])
- tdir = '%s/tests/%d_%s' % (ldir, i, testdef['test_id'])
+ hdir = '%s/tests/%d_%s' % (d, i, testdef.get('metadata').get('name'))
+ tdir = '%s/tests/%d_%s' % (ldir, i, testdef.get('metadata').get('name'))
self._copy_test(hdir, tdir, testdef)
testdirs.append(tdir)
=== modified file 'lava_dispatcher/lava_test_shell.py'
@@ -21,6 +21,7 @@
import datetime
import errno
import json
+import yaml
import logging
import os
import re
@@ -119,7 +120,6 @@
pattern = re.compile(testdef['parse']['pattern'])
- fixupdict = {}
if 'fixupdict' in testdef['parse']:
fixupdict = testdef['parse']['fixupdict']
@@ -143,7 +143,7 @@
attachments = []
attachments.append(create_attachment('stdout.txt', stdout))
- attachments.append(create_attachment('testdef.json', testdef))
+ attachments.append(create_attachment('testdef.yaml', testdef))
for f in files:
fname = '%s/%s' % (dirname, f)
@@ -157,14 +157,14 @@
def _get_test_run(results_dir, dirname, hwcontext, swcontext):
now = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
- testdef = _get_content(results_dir, '%s/testdef.json' % dirname)
+ testdef = _get_content(results_dir, '%s/testdef.yaml' % dirname)
stdout = _get_content(results_dir, '%s/stdout.log' % dirname)
attachments = _get_attachments(results_dir, dirname, testdef, stdout)
- testdef = json.loads(testdef)
+ testdef = yaml.load(testdef)
return {
- 'test_id': testdef['test_id'],
+ 'test_id': testdef.get('metadata').get('name'),
'analyzer_assigned_date': now,
'analyzer_assigned_uuid': str(uuid4()),
'time_check_performed': False,
=== modified file 'lava_test_shell/lava-test-runner-android'
@@ -79,7 +79,7 @@
echo "${PREFIX} running ${test} under lava-test-shell..."
odir=${RESULTSDIR}/${test}-`date +%s`
mkdir ${odir}
- cp ${line}/testdef.json ${odir}/
+ cp ${line}/testdef.yaml ${odir}/
cp ${line}/run.sh ${odir}/
[ -f ${line}/install.sh ] && cp ${line}/install.sh ${odir}/
lava-test-shell --output_dir ${odir} /system/bin/sh -e "${line}/run.sh"
=== modified file 'lava_test_shell/lava-test-runner-ubuntu'
@@ -63,7 +63,7 @@
echo "${PREFIX} running ${test} under lava-test-shell..."
odir=${RESULTSDIR}/${test}-`date +%s`
mkdir ${odir}
- cp ${line}/testdef.json ${odir}/
+ cp ${line}/testdef.yaml ${odir}/
cp ${line}/run.sh ${odir}/
[ -f ${line}/install.sh ] && cp ${line}/install.sh ${odir}/
lava-test-shell --output_dir ${odir} /bin/sh -e "${line}/run.sh"