diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-06-26 11:39:21 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-06-26 11:39:21 +0100 |
commit | b00ebe6baee22bd79e3aeca38a3390a25fbc5e14 (patch) | |
tree | f5208d32d2a9f8a5a16255ee6de9a062ebad633a | |
parent | c2587cf3aac2e9c734e040de86f07e950042c112 (diff) | |
download | morph-b00ebe6baee22bd79e3aeca38a3390a25fbc5e14.tar.gz |
Fix test suite to deal with morph output changes
Also, some bug fixes.
Also, when handling a BaseException, log the exception (with traceback)
that we're handling, in case there is an error while handling it, because
the second error will otherwise mask the first one.
-rw-r--r-- | morphlib/builder2.py | 16 | ||||
-rwxr-xr-x | tests.as-root/arm-system-writes-kernel.script | 2 | ||||
-rwxr-xr-x | tests.as-root/setup | 2 | ||||
-rwxr-xr-x | tests.as-root/system-overlap.script | 2 | ||||
-rwxr-xr-x | tests.branching/setup | 1 | ||||
-rwxr-xr-x | tests/setup | 1 | ||||
-rwxr-xr-x | tests/stratum-overlap-warns.script | 3 | ||||
-rwxr-xr-x | tests/stratum-overlap-writes-overlap.script | 2 |
8 files changed, 18 insertions, 11 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py index aaff29d3..6bdf7cc3 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -21,6 +21,7 @@ import shutil import time from collections import defaultdict import tarfile +import traceback import morphlib from morphlib.artifactcachereference import ArtifactCacheReference @@ -485,6 +486,7 @@ class SystemBuilder(BuilderBase): # pragma: no cover self._unmount(mount_point) except BaseException, e: + logging.error(traceback.format_exc()) self.app.status(msg='Error while building system', error=True) self._unmount(mount_point) @@ -528,13 +530,13 @@ class SystemBuilder(BuilderBase): # pragma: no cover image_name) def _create_fs(self, partition): - self.app.status(msg='Creating filesystem on %(filename)s', - filename=image_name, chatty=True) + self.app.status(msg='Creating filesystem on %(partition)s', + partition=partition, chatty=True) with self.build_watch('create-filesystem'): morphlib.fsutils.create_fs(self.app.runcmd, partition) def _mount(self, partition, mount_point): - self.app.status(msg='Mounting %(partition) on %(mount_point)s', + self.app.status(msg='Mounting %(partition)s on %(mount_point)s', partition=partition, mount_point=mount_point, chatty=True) with self.build_watch('mount-filesystem'): @@ -581,8 +583,8 @@ class SystemBuilder(BuilderBase): # pragma: no cover for stratum_artifact in self.artifact.dependencies: f = self.local_artifact_cache.get(stratum_artifact) for chunk in (ArtifactCacheReference(a) for a in json.load(f)): - self.app.status(msg='Unpacking chunk %(chunk_name)s', - chunk_name=chunk.name, chatty=True) + self.app.status(msg='Unpacking chunk %(basename)s', + basename=chunk.basename(), chatty=True) chunk_handle = self.local_artifact_cache.get(chunk) morphlib.bins.unpack_binary_from_file(chunk_handle, path) chunk_handle.close() @@ -655,10 +657,10 @@ class SystemBuilder(BuilderBase): # pragma: no cover time.sleep(2) def _unmount(self, mount_point): - self.app.status(msg='Unmounting %(mount_point)s', - mount_point=mount_point, chatty=True) with self.build_watch('unmount-filesystem'): if mount_point is not None: + self.app.status(msg='Unmounting %(mount_point)s', + mount_point=mount_point, chatty=True) morphlib.fsutils.unmount(self.app.runcmd, mount_point) def _undo_device_mapping(self, image_name): diff --git a/tests.as-root/arm-system-writes-kernel.script b/tests.as-root/arm-system-writes-kernel.script index 7f9c79b2..500cedba 100755 --- a/tests.as-root/arm-system-writes-kernel.script +++ b/tests.as-root/arm-system-writes-kernel.script @@ -75,5 +75,5 @@ git add linux.morph git commit --quiet -m 'Make the kernel create a dummy zImage' "$SRCDIR/scripts/test-morph" \ - build test:morphs-repo arm arm-system.morph + build test:morphs-repo arm arm-system.morph > /dev/null [ -e "$cache"/*system.arm-system-kernel ] || find "$cache" diff --git a/tests.as-root/setup b/tests.as-root/setup index 59e4a944..1d32b14d 100755 --- a/tests.as-root/setup +++ b/tests.as-root/setup @@ -142,5 +142,7 @@ cachedir = $DATADIR/cache log = $DATADIR/morph.log keep-path = true no-distcc = true +quiet = true +log = /tmp/morph.log EOF diff --git a/tests.as-root/system-overlap.script b/tests.as-root/system-overlap.script index 28307301..71b55e24 100755 --- a/tests.as-root/system-overlap.script +++ b/tests.as-root/system-overlap.script @@ -118,7 +118,7 @@ git add overlap-*.morph git commit --quiet -m 'Add overlapping chunks' "$SRCDIR/scripts/test-morph" \ - build test:morphs-repo overlap overlap-system.morph + build test:morphs-repo overlap overlap-system.morph > /devN7ll "$SRCDIR/scripts/list-overlaps" groups \ "$cache"/*.system.overlap-system.overlaps | while IFS='\n' read overlaps; do diff --git a/tests.branching/setup b/tests.branching/setup index 5c0e9a04..714be9da 100755 --- a/tests.branching/setup +++ b/tests.branching/setup @@ -33,6 +33,7 @@ cachedir = $DATADIR/mine/.morph/cache log = $DATADIR/morph.log keep-path = true no-distcc = true +quiet = true EOF diff --git a/tests/setup b/tests/setup index 663f591e..5a6668a3 100755 --- a/tests/setup +++ b/tests/setup @@ -124,5 +124,6 @@ cachedir = $DATADIR/cache log = $DATADIR/morph.log keep-path = true no-distcc = true +quiet = true EOF diff --git a/tests/stratum-overlap-warns.script b/tests/stratum-overlap-warns.script index 2e9965fe..ab6c6de6 100755 --- a/tests/stratum-overlap-warns.script +++ b/tests/stratum-overlap-warns.script @@ -29,7 +29,8 @@ warning_mentions(){ } "$SRCDIR/scripts/test-morph" \ - build --log=$log test:morphs-repo overlap overlap-stratum.morph + build --log=$log test:morphs-repo overlap overlap-stratum.morph \ + > /dev/null grep WARNING "$log" >"$warnings" for str in overlap-stratum \ overlap-foo-baz overlap-foobar bin/bar \ diff --git a/tests/stratum-overlap-writes-overlap.script b/tests/stratum-overlap-writes-overlap.script index 28d3d044..d40d3ba5 100755 --- a/tests/stratum-overlap-writes-overlap.script +++ b/tests/stratum-overlap-writes-overlap.script @@ -24,7 +24,7 @@ cache="$DATADIR/cache/artifacts" "$SRCDIR/scripts/test-morph" \ - build test:morphs-repo overlap overlap-stratum.morph + build test:morphs-repo overlap overlap-stratum.morph > /dev/null "$SRCDIR/scripts/list-overlaps" groups \ "$cache"/*.stratum.overlap-stratum.overlaps | while IFS='\n' read overlaps; do |