diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-06-14 16:12:40 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-06-14 16:12:40 +0000 |
commit | 79cb73283231dca550a647edcfeff5466037d776 (patch) | |
tree | e22e1597256f36e4fb4821f096b2f0bf888437da /tests | |
parent | 945d85def198d417de3f5436800e7efa3e9a540e (diff) | |
parent | d9c8acc730ecc7ea203fb0950a7f461f2822ef4f (diff) | |
download | morph-79cb73283231dca550a647edcfeff5466037d776.tar.gz |
Merge branch 'richardmaw/strata-chunk-lists'
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/build-stratum-with-submodules.script | 6 | ||||
-rwxr-xr-x | tests/build-stratum.script | 6 | ||||
-rwxr-xr-x | tests/name-clash.script | 5 | ||||
-rwxr-xr-x | tests/rebuild-cached-stratum.script | 4 | ||||
-rwxr-xr-x | tests/stratum-overlap-keeps-directory-links.script | 4 | ||||
-rwxr-xr-x | tests/stratum-overlap-stomps-file-links.script | 4 | ||||
-rwxr-xr-x | tests/stratum-overlap-warns.script | 12 | ||||
-rw-r--r-- | tests/stratum-overlap-warns.stdout | 5 | ||||
-rwxr-xr-x | tests/stratum-overlap-writes-overlap.script | 34 | ||||
l--------- | tests/stratum-overlap-writes-overlap.setup | 1 | ||||
-rw-r--r-- | tests/stratum-overlap-writes-overlap.stdout | 4 |
11 files changed, 70 insertions, 15 deletions
diff --git a/tests/build-stratum-with-submodules.script b/tests/build-stratum-with-submodules.script index 9f226068..7d44caf6 100755 --- a/tests/build-stratum-with-submodules.script +++ b/tests/build-stratum-with-submodules.script @@ -65,6 +65,8 @@ EOF # No build and verify we got a stratum. "$SRCDIR/scripts/test-morph" build test:morphs-repo master submod-stratum.morph -tar -tf "$DATADIR/cache/artifacts/"*.stratum.* | LC_ALL=C sort \ - | sed '/^\.\/./s:^\./::' +"$SRCDIR/scripts/assemble-stratum" --cachedir "$DATADIR/cache" \ + "$DATADIR/cache/artifacts/"*submod-stratum \ + "$DATADIR/stratum.tar" submod-stratum +tar -tf "$DATADIR/stratum.tar" | LC_ALL=C sort | sed '/^\.\/./s:^\./::' diff --git a/tests/build-stratum.script b/tests/build-stratum.script index 994c4077..f4fa15a1 100755 --- a/tests/build-stratum.script +++ b/tests/build-stratum.script @@ -20,6 +20,8 @@ set -eu "$SRCDIR/scripts/test-morph" build test:morphs-repo master hello-stratum.morph -tar -tf "$DATADIR/cache/artifacts/"*.stratum.* | LC_ALL=C sort \ - | sed '/^\.\/./s:^\./::' +"$SRCDIR/scripts/assemble-stratum" --cachedir "$DATADIR/cache" \ + "$DATADIR/cache/artifacts/"*.hello-stratum \ + "$DATADIR/stratum.tar" hello-stratum +tar -tf "$DATADIR/stratum.tar" | LC_ALL=C sort | sed '/^\.\/./s:^\./::' diff --git a/tests/name-clash.script b/tests/name-clash.script index 669949ed..dcc04a8a 100755 --- a/tests/name-clash.script +++ b/tests/name-clash.script @@ -56,5 +56,8 @@ EOF # unpack it and check the contents INSTDIR="$DATADIR"/unpack mkdir -p "$INSTDIR" -tar -C "$INSTDIR" -xhf "$DATADIR/cache/artifacts/"*hello-stratum* +"$SRCDIR/scripts/assemble-stratum" --cachedir "$DATADIR/cache" \ + "$DATADIR/cache/artifacts/"*hello-stratum \ + "$DATADIR/stratum.tar" hello-stratum +tar -C "$INSTDIR" -xhf "$DATADIR/stratum.tar" test "$("$INSTDIR"/bin/hello)" = "hello, world" diff --git a/tests/rebuild-cached-stratum.script b/tests/rebuild-cached-stratum.script index c0022ba6..1bea1ae6 100755 --- a/tests/rebuild-cached-stratum.script +++ b/tests/rebuild-cached-stratum.script @@ -40,7 +40,7 @@ cache="$DATADIR/cache/artifacts" "$SRCDIR/scripts/test-morph" \ build test:morphs-repo rebuild-cached-stratum hello-stratum.morph echo "first build:" -(cd "$cache" && ls *.chunk.* *.stratum.* | sed 's/^[^.]*\./ /' | +(cd "$cache" && ls *.chunk.* *hello-stratum | sed 's/^[^.]*\./ /' | LC_ALL=C sort) # Change the chunk. @@ -52,6 +52,6 @@ echo "first build:" "$SRCDIR/scripts/test-morph" \ build test:morphs-repo rebuild-cached-stratum hello-stratum.morph echo "second build:" -(cd "$cache" && ls *.chunk.* *.stratum.* | sed 's/^[^.]*\./ /' | +(cd "$cache" && ls *.chunk.* *hello-stratum | sed 's/^[^.]*\./ /' | LC_ALL=C sort) diff --git a/tests/stratum-overlap-keeps-directory-links.script b/tests/stratum-overlap-keeps-directory-links.script index a995194f..2c5916aa 100755 --- a/tests/stratum-overlap-keeps-directory-links.script +++ b/tests/stratum-overlap-keeps-directory-links.script @@ -27,6 +27,8 @@ mkdir -p "$extracted" "$SRCDIR/scripts/test-morph" \ build test:morphs-repo overlap overlap-stratum.morph for f in "$cache"/*.stratum.overlap-stratum; do - tar -xf "$f" -C "$extracted" + "$SRCDIR/scripts/assemble-stratum" --cachedir "$DATADIR/cache" \ + "$f" "$DATADIR/stratum.tar" overlap-stratum + tar -xf "$DATADIR/stratum.tar" -C "$extracted" done test -h "$extracted/usr" diff --git a/tests/stratum-overlap-stomps-file-links.script b/tests/stratum-overlap-stomps-file-links.script index 0d429bbf..202e1f09 100755 --- a/tests/stratum-overlap-stomps-file-links.script +++ b/tests/stratum-overlap-stomps-file-links.script @@ -27,6 +27,8 @@ mkdir -p "$extracted" "$SRCDIR/scripts/test-morph" \ build test:morphs-repo overlap overlap-stratum.morph for f in "$cache"/*.stratum.overlap-stratum; do - tar -xf "$f" -C "$extracted" + "$SRCDIR/scripts/assemble-stratum" --cachedir "$DATADIR/cache" \ + "$f" "$DATADIR/stratum.tar" overlap-stratum + tar -xf "$DATADIR/stratum.tar" -C "$extracted" done test -f "$extracted/bin/foo" diff --git a/tests/stratum-overlap-warns.script b/tests/stratum-overlap-warns.script index edb1d855..2e9965fe 100755 --- a/tests/stratum-overlap-warns.script +++ b/tests/stratum-overlap-warns.script @@ -21,8 +21,18 @@ set -eu log="$DATADIR/morph.log" +warnings="$DATADIR/warnings" cache="$DATADIR/cache/artifacts" +warning_mentions(){ + grep -F "$1" <"$warnings" >/dev/null 2>/dev/null +} + "$SRCDIR/scripts/test-morph" \ build --log=$log test:morphs-repo overlap overlap-stratum.morph -grep WARNING $log | sed 's/^.*WARNING/WARNING/' +grep WARNING "$log" >"$warnings" +for str in overlap-stratum \ + overlap-foo-baz overlap-foobar bin/bar \ + overlap-fooqux bin/foo; do + warning_mentions 'overlap-stratum' || exit $? +done diff --git a/tests/stratum-overlap-warns.stdout b/tests/stratum-overlap-warns.stdout deleted file mode 100644 index eaddf9c1..00000000 --- a/tests/stratum-overlap-warns.stdout +++ /dev/null @@ -1,5 +0,0 @@ -WARNING Overlaps in artifact overlap-stratum detected -WARNING Artifacts overlap-foo-baz, overlap-foobar overlap with files: -WARNING bin/bar -WARNING Artifacts overlap-foo-baz, overlap-foobar, overlap-fooqux overlap with files: -WARNING bin/foo diff --git a/tests/stratum-overlap-writes-overlap.script b/tests/stratum-overlap-writes-overlap.script new file mode 100755 index 00000000..28d3d044 --- /dev/null +++ b/tests/stratum-overlap-writes-overlap.script @@ -0,0 +1,34 @@ +#!/bin/sh +# +# If a stratum has multiple chunks that have the same files in them, +# then the overlaps must be written to the cache +# +# Copyright (C) 2011, 2012 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +set -eu + +cache="$DATADIR/cache/artifacts" + + +"$SRCDIR/scripts/test-morph" \ + build test:morphs-repo overlap overlap-stratum.morph +"$SRCDIR/scripts/list-overlaps" groups \ + "$cache"/*.stratum.overlap-stratum.overlaps | +while IFS='\n' read overlaps; do + echo $overlaps + "$SRCDIR/scripts/list-overlaps" list-files \ + "$cache"/*.stratum.overlap-stratum.overlaps $overlaps +done diff --git a/tests/stratum-overlap-writes-overlap.setup b/tests/stratum-overlap-writes-overlap.setup new file mode 120000 index 00000000..255e9a74 --- /dev/null +++ b/tests/stratum-overlap-writes-overlap.setup @@ -0,0 +1 @@ +stratum-overlap-warns.setup
\ No newline at end of file diff --git a/tests/stratum-overlap-writes-overlap.stdout b/tests/stratum-overlap-writes-overlap.stdout new file mode 100644 index 00000000..40485659 --- /dev/null +++ b/tests/stratum-overlap-writes-overlap.stdout @@ -0,0 +1,4 @@ +overlap-foo-baz overlap-foobar overlap-fooqux +bin/foo +overlap-foo-baz overlap-foobar +bin/bar |