diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-05-14 16:23:39 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-05-14 16:23:39 +0000 |
commit | cd8170c8f7a6c8c82d43f8b992c07041fa22a31b (patch) | |
tree | 869549f6f2f4b0208c7dbfa17c035907e1b17404 /tests | |
parent | 3f687742106ed12b6ce174e6d2ca864c26b376c4 (diff) | |
download | morph-cd8170c8f7a6c8c82d43f8b992c07041fa22a31b.tar.gz |
tests: add checks for link behaviour
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/stratum-overlap-keeps-directory-links.script | 28 | ||||
l--------- | tests/stratum-overlap-keeps-directory-links.setup | 1 | ||||
-rw-r--r-- | tests/stratum-overlap-keeps-directory-links.stdout | 1 | ||||
-rwxr-xr-x | tests/stratum-overlap-stomps-file-links.script | 28 | ||||
l--------- | tests/stratum-overlap-stomps-file-links.setup | 1 | ||||
-rw-r--r-- | tests/stratum-overlap-stomps-file-links.stdout | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | tests/stratum-overlap-warns.setup | 22 | ||||
-rw-r--r-- | tests/stratum-overlap-warns.stdout | 3 |
8 files changed, 84 insertions, 1 deletions
diff --git a/tests/stratum-overlap-keeps-directory-links.script b/tests/stratum-overlap-keeps-directory-links.script new file mode 100755 index 00000000..96668708 --- /dev/null +++ b/tests/stratum-overlap-keeps-directory-links.script @@ -0,0 +1,28 @@ +#!/bin/sh +# +# If a stratum has symbolic links pointing to files, then the symlink +# should be removed and replaced by that file +# +# 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 +(cd "$cache" && for f in *.stratum.overlap-stratum; do tar -tvf "$f"; done | sed 's/^\(\S*\)[^.]*\./\1 /' | + LC_ALL=C sort) | grep '/usr -> /' diff --git a/tests/stratum-overlap-keeps-directory-links.setup b/tests/stratum-overlap-keeps-directory-links.setup new file mode 120000 index 00000000..255e9a74 --- /dev/null +++ b/tests/stratum-overlap-keeps-directory-links.setup @@ -0,0 +1 @@ +stratum-overlap-warns.setup
\ No newline at end of file diff --git a/tests/stratum-overlap-keeps-directory-links.stdout b/tests/stratum-overlap-keeps-directory-links.stdout new file mode 100644 index 00000000..a8c4be28 --- /dev/null +++ b/tests/stratum-overlap-keeps-directory-links.stdout @@ -0,0 +1 @@ +lrwxrwxrwx /usr -> / diff --git a/tests/stratum-overlap-stomps-file-links.script b/tests/stratum-overlap-stomps-file-links.script new file mode 100755 index 00000000..38c4e687 --- /dev/null +++ b/tests/stratum-overlap-stomps-file-links.script @@ -0,0 +1,28 @@ +#!/bin/sh +# +# If a stratum has symbolic links pointing to files, then the symlink +# should be removed and replaced by that file +# +# 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 +(cd "$cache" && for f in *.stratum.overlap-stratum; do tar -tvf "$f"; done | sed 's/^\(\S*\)[^.]*\./\1 /' | + LC_ALL=C sort) | grep '\s/bin/foo\s' diff --git a/tests/stratum-overlap-stomps-file-links.setup b/tests/stratum-overlap-stomps-file-links.setup new file mode 120000 index 00000000..255e9a74 --- /dev/null +++ b/tests/stratum-overlap-stomps-file-links.setup @@ -0,0 +1 @@ +stratum-overlap-warns.setup
\ No newline at end of file diff --git a/tests/stratum-overlap-stomps-file-links.stdout b/tests/stratum-overlap-stomps-file-links.stdout new file mode 100644 index 00000000..d63f9b80 --- /dev/null +++ b/tests/stratum-overlap-stomps-file-links.stdout @@ -0,0 +1 @@ +-rwxrwxrwx /bin/foo diff --git a/tests/stratum-overlap-warns.setup b/tests/stratum-overlap-warns.setup index 7b2aa630..678b2726 100644..100755 --- a/tests/stratum-overlap-warns.setup +++ b/tests/stratum-overlap-warns.setup @@ -31,6 +31,11 @@ cat <<EOF >overlap-stratum.morph "kind": "stratum", "sources": [ { + "name": "dirs", + "repo": "test:chunk-repo", + "ref": "overlap" + }, + { "name": "overlap-foo-baz", "repo": "test:chunk-repo", "ref": "overlap" @@ -53,6 +58,19 @@ git commit --quiet -m "add overlapping stratum" cd "$chunkrepo" git checkout --quiet -b overlap master + +cat <<EOF >dirs.morph +{ + "name": "dirs", + "kind": "chunk", + "install-commands": [ + "mkdir -p \$DESTDIR/bin", + "ln -s / \$DESTDIR/usr" + ] +} +EOF +git add dirs.morph + cat <<EOF >overlap-foo-baz.morph { "name": "overlap-foo-baz", @@ -63,6 +81,7 @@ cat <<EOF >overlap-foo-baz.morph ] } EOF +git add overlap-foo-baz.morph cat <<EOF >overlap-foobar.morph { @@ -76,6 +95,7 @@ cat <<EOF >overlap-foobar.morph ] } EOF +git add overlap-foobar.morph cat <<EOF >overlap-fooqux.morph { @@ -88,6 +108,6 @@ cat <<EOF >overlap-fooqux.morph ] } EOF -git add overlap-*.morph +git add overlap-fooqux.morph git commit --quiet -m 'Add overlapping chunks' diff --git a/tests/stratum-overlap-warns.stdout b/tests/stratum-overlap-warns.stdout index 90913dd4..9ee0e53c 100644 --- a/tests/stratum-overlap-warns.stdout +++ b/tests/stratum-overlap-warns.stdout @@ -4,7 +4,9 @@ Figuring out the right build order Cloning/updating test:chunk-repo Cloning/updating test:chunk-repo Cloning/updating test:chunk-repo +Cloning/updating test:chunk-repo Cloning/updating test:morphs-repo +Building dirs Building overlap-foo-baz Building overlap-foobar Building overlap-fooqux @@ -14,6 +16,7 @@ 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 + chunk.dirs chunk.overlap-foo-baz chunk.overlap-foobar chunk.overlap-fooqux |