=== modified file 'lava_dispatcher/actions/lava_test.py'
@@ -95,6 +95,10 @@
logging.exception("killing test failed, rebooting")
self.client.boot_linaro_image()
raise
+ finally:
+ # try to make sure the test bundle is safely written to disk
+ session.run('sync', timeout=60)
+
if rc is None:
raise OperationFailed("test case getting return value failed")
elif rc != 0:
=== modified file 'lava_dispatcher/device/fastmodel.py'
@@ -185,17 +185,8 @@
return ("%s --image=%s --block-device=%s --network=nat %s") % (
self._sim_binary, self._axf, self._sd_image, options)
- def _power_off(self, proc):
- if proc is not None:
- # attempt to turn off cleanly. lava-test-shell for ubuntu builds
- # require this or the result files don't get flushed (even with
- # the "sync" being called in self.power_off
- try:
- proc.sendline('halt')
- proc.expect('Will now halt', timeout=20)
- except:
- logging.warn('timed out while trying to halt cleanly')
- proc.close()
+ def power_off(self, proc):
+ super(FastModelTarget, self).power_off(proc)
if self._sim_proc is not None:
self._sim_proc.close()
=== modified file 'lava_dispatcher/device/master.py'
@@ -90,7 +90,7 @@
self._boot_linaro_image()
return self.proc
- def _power_off(self, proc):
+ def power_off(self, proc):
# we always leave master image devices powered on
pass
=== modified file 'lava_dispatcher/device/qemu.py'
@@ -69,10 +69,6 @@
tb = download_image(tarball_url, self.context, decompress=False)
extract_targz(tb, '%s/%s' % (mntdir, directory))
- def _power_off(self, proc):
- if proc is not None:
- proc.close()
-
def power_on(self):
qemu_cmd = ('%s -M %s -drive if=%s,cache=writeback,file=%s '
'-clock unix -device usb-kbd -device usb-mouse -usb '
=== modified file 'lava_dispatcher/device/target.py'
@@ -86,11 +86,6 @@
"""
raise NotImplementedError('power_on')
- def _power_off(self, proc):
- """ responsible for powering off the target device.
- """
- raise NotImplementedError('_power_off')
-
def deploy_linaro(self, hwpack, rfs):
raise NotImplementedError('deploy_image')
@@ -101,16 +96,8 @@
raise NotImplementedError('deploy_linaro_prebuilt')
def power_off(self, proc):
- """ tries to safely power off the device by running a sync
- operation first
- """
- runner = self._get_runner(proc)
- try:
- logging.info('attempting a filesystem sync before power_off')
- runner.run('sync', timeout=20)
- except:
- logging.exception('calling sync failed')
- self._power_off(proc)
+ if proc is not None:
+ proc.close()
@contextlib.contextmanager
def file_system(self, partition, directory):
=== modified file 'lava_test_shell/lava-test-runner-android'
@@ -35,8 +35,19 @@
[ -f ${pkgs} ] || pm list packages -v > ${pkgs}
}
+cleanup()
+{
+ # just adds a little handy debugging
+ ls ${RESULTSDIR}
+ echo "${PREFIX} calling sync"
+ sync
+ echo "${PREFIX} exiting"
+}
+
# in background, since we don't have this working as a proper android service
{
+ trap cleanup INT TERM EXIT
+
export PATH=${BINDIR}:${PATH}
echo "${PREFIX} started"
[ -d ${RESULTSDIR} ] || mkdir -p ${RESULTSDIR}
@@ -85,11 +96,5 @@
lava-test-shell --output_dir ${odir} /system/bin/sh -e "${line}/run.sh"
echo "${PREFIX} ${test} exited with: `cat ${odir}/return_code`"
done < ${WORKFILE}
-
- # just adds a little handy debugging as to what result the target
- # thinks exists
- ls /data/lava/results
-
- echo "${PREFIX} exiting"
} &
=== modified file 'lava_test_shell/lava-test-runner-ubuntu'
@@ -28,6 +28,17 @@
[ -f ${pkgs} ] || dpkg-query -W -f '${status} ${package} : ${version}\n' | sed -n 's/^install ok installed/package:/p' > ${pkgs}
}
+
+cleanup()
+{
+ # just adds a little handy debugging
+ ls ${RESULTSDIR}
+ echo "${PREFIX} calling sync"
+ sync
+ echo "${PREFIX} exiting"
+}
+trap cleanup INT TERM EXIT
+
export PATH=${BINDIR}:${PATH}
echo "${PREFIX} started"
[ -d ${RESULTSDIR} ] || mkdir -p ${RESULTSDIR}
@@ -70,8 +81,3 @@
echo "${PREFIX} ${test} exited with: `cat ${odir}/return_code`"
done < ${WORKFILE}
-# just adds a little handy debugging as to what result the target thinks exist
-ls /lava/results
-
-echo "${PREFIX} exiting"
-