From 79c44a07a7112bd2e568782f3b0ed6ef288a08d8 Mon Sep 17 00:00:00 2001 From: Adam Coldrick Date: Tue, 14 Apr 2015 15:08:52 +0000 Subject: Fix the cmdtests to understand the OSTree artifact cache This commit also disables the cross-bootstrap test, as the cross-bootstrap plugin needs rewriting to use OSTree. Change-Id: I6183b1a396525f2e60dcbc2dbf5730acfb9df30b --- tests.build/build-chunk-writes-log.script | 16 +++++++--------- tests.build/build-stratum-with-submodules.script | 13 +++++++++++-- tests.build/build-stratum-with-submodules.stdout | 3 +-- tests.build/build-system-autotools.script | 12 ++++++++++-- tests.build/build-system-autotools.stdout | 4 ++-- tests.build/build-system-cmake.script | 13 +++++++++++-- tests.build/build-system-cmake.stdout | 2 +- tests.build/build-system-cpan.script | 13 +++++++++++-- tests.build/build-system-python-distutils.script | 17 +++++++++++++---- tests.build/build-system-python-distutils.stdout | 10 +++++----- tests.build/build-system.script | 13 +++++++++++-- tests.build/build-system.stdout | 5 +---- tests.build/cross-bootstrap.script | 3 +++ tests.build/morphless-chunks.script | 14 +++++++++++--- tests.build/prefix.script | 13 +++++++++++-- tests.build/rebuild-cached-stratum.script | 4 ++-- tests.build/rebuild-cached-stratum.stdout | 12 ------------ 17 files changed, 111 insertions(+), 56 deletions(-) diff --git a/tests.build/build-chunk-writes-log.script b/tests.build/build-chunk-writes-log.script index e636924e..5f257571 100755 --- a/tests.build/build-chunk-writes-log.script +++ b/tests.build/build-chunk-writes-log.script @@ -22,16 +22,14 @@ set -eu "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo master hello-system -SOURCES="$DATADIR/cached-sources" -find "$DATADIR/cache/artifacts" -name '*.chunk.*' | - sed 's|\.chunk\..*||' | sort -u >"$SOURCES" - +refsdir="$DATADIR/cache/artifacts/repo/refs/heads" +chunks=$(find "$refsdir" -name '*-misc' | sed -e "s:$refsdir::" -e "s:-misc::") found=false -# list of sources in cache is not piped because while loop changes variable -while read source; do - [ -e "$source".build-log ] || continue + +for chunk in $chunks; +do + [ -e "$DATADIR/cache/artifacts/$chunk".build-log ] || continue found=true break -done <"$SOURCES" +done "$found" - diff --git a/tests.build/build-stratum-with-submodules.script b/tests.build/build-stratum-with-submodules.script index bd6b97ce..d1daa292 100755 --- a/tests.build/build-stratum-with-submodules.script +++ b/tests.build/build-stratum-with-submodules.script @@ -61,6 +61,15 @@ EOF "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo master hello-system -system=$(ls "$DATADIR/cache/artifacts/"*hello-system-rootfs) -tar tf $system | LC_ALL=C sort | sed '/^\.\/./s:^\./::' | grep -v '^baserock/' +cd "$DATADIR" +"$SRCDIR/scripts/test-morph" init workspace +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master +cd "$DATADIR/workspace/master/test/morphs-repo" + +ref=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph` +ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \ + "$ref" "$DATADIR/$ref" +find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::" | LC_ALL=C sort | +sed '/^\.\/./s:^\./::' | grep -v '^baserock' diff --git a/tests.build/build-stratum-with-submodules.stdout b/tests.build/build-stratum-with-submodules.stdout index d4d03e13..864f253f 100644 --- a/tests.build/build-stratum-with-submodules.stdout +++ b/tests.build/build-stratum-with-submodules.stdout @@ -1,3 +1,2 @@ -./ -etc/ +etc etc/os-release diff --git a/tests.build/build-system-autotools.script b/tests.build/build-system-autotools.script index 710a8f98..7ecb31be 100755 --- a/tests.build/build-system-autotools.script +++ b/tests.build/build-system-autotools.script @@ -47,7 +47,15 @@ git commit --quiet -m "Convert hello to an autotools project" "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo master hello-system -for chunk in "$DATADIR/cache/artifacts/"*.chunk.* +cd "$DATADIR" +"$SRCDIR/scripts/test-morph" init workspace +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master +cd "$DATADIR/workspace/master/test/morphs-repo" + +refs=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph hello` +for ref in $refs do - tar -tf "$chunk" + ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false "$ref" "$DATADIR/$ref" + find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::" done | LC_ALL=C sort -u | sed '/^\.\/./s:^\./::' | grep -Ee '^(bin|etc)' diff --git a/tests.build/build-system-autotools.stdout b/tests.build/build-system-autotools.stdout index 683441c9..6dd6cda7 100644 --- a/tests.build/build-system-autotools.stdout +++ b/tests.build/build-system-autotools.stdout @@ -1,3 +1,3 @@ -bin/ +bin bin/hello -etc/ +etc diff --git a/tests.build/build-system-cmake.script b/tests.build/build-system-cmake.script index fe02f9dc..b761a5d5 100755 --- a/tests.build/build-system-cmake.script +++ b/tests.build/build-system-cmake.script @@ -49,7 +49,16 @@ git commit --quiet -m "Convert hello to a cmake project" "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo master hello-system -for chunk in "$DATADIR/cache/artifacts/"*.chunk.* +cd "$DATADIR" +"$SRCDIR/scripts/test-morph" init workspace +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master +cd "$DATADIR/workspace/master/test/morphs-repo" + +refs=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph hello` +for ref in $refs do - tar -tf "$chunk" + ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \ + "$ref" "$DATADIR/$ref" + find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::" done | LC_ALL=C sort -u | sed '/^\.\/./s:^\./::' | grep -Ee '^(usr/)?(bin|etc)' diff --git a/tests.build/build-system-cmake.stdout b/tests.build/build-system-cmake.stdout index 3410b113..861fd1fa 100644 --- a/tests.build/build-system-cmake.stdout +++ b/tests.build/build-system-cmake.stdout @@ -1,2 +1,2 @@ -usr/bin/ +usr/bin usr/bin/hello diff --git a/tests.build/build-system-cpan.script b/tests.build/build-system-cpan.script index 103d5466..e6bd579c 100755 --- a/tests.build/build-system-cpan.script +++ b/tests.build/build-system-cpan.script @@ -71,7 +71,16 @@ git commit -q -m "Set custom install prefix for hello" "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo master hello-system -for chunk in "$DATADIR/cache/artifacts/"*.chunk.* +cd "$DATADIR" +"$SRCDIR/scripts/test-morph" init workspace +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master +cd "$DATADIR/workspace/master/test/morphs-repo" + +refs=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph hello` +for ref in $refs do - tar -tf "$chunk" + ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \ + "$ref" "$DATADIR/$ref" + find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::" done | LC_ALL=C sort | sed '/^\.\/./s:^\./::' | grep -F 'bin/hello' diff --git a/tests.build/build-system-python-distutils.script b/tests.build/build-system-python-distutils.script index e5c0ea74..44418655 100755 --- a/tests.build/build-system-python-distutils.script +++ b/tests.build/build-system-python-distutils.script @@ -69,12 +69,21 @@ git commit -q -m "Set custom install prefix for hello" "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo master hello-system -for chunk in "$DATADIR/cache/artifacts/"*.chunk.* +cd "$DATADIR" +"$SRCDIR/scripts/test-morph" init workspace +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master +cd "$DATADIR/workspace/master/test/morphs-repo" + +refs=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph hello` +for ref in $refs do - tar -tf "$chunk" + ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \ + "$ref" "$DATADIR/$ref" + find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::" done | LC_ALL=C sort -u | sed '/^\.\/./s:^\./::' | grep -Ee '^(bin|lib)' | sed -e 's:^local/::' \ - -e 's:lib/python2.[6-9]/:lib/python2.x/:' \ - -e 's:/hello-0\.0\.0[^/]*\.egg-info$:/hello.egg-info/:' \ + -e 's:lib/python2.[6-9]:lib/python2.x:' \ + -e 's:/hello-0\.0\.0[^/]*\.egg-info$:/hello.egg-info:' \ -e 's:[^/]*-packages:packages:' \ -e '/^$/d' diff --git a/tests.build/build-system-python-distutils.stdout b/tests.build/build-system-python-distutils.stdout index 4d4c3a1e..a2ceb5ad 100644 --- a/tests.build/build-system-python-distutils.stdout +++ b/tests.build/build-system-python-distutils.stdout @@ -1,6 +1,6 @@ -bin/ +bin bin/hello -lib/ -lib/python2.x/ -lib/python2.x/packages/ -lib/python2.x/packages/hello.egg-info/ +lib +lib/python2.x +lib/python2.x/packages +lib/python2.x/packages/hello.egg-info diff --git a/tests.build/build-system.script b/tests.build/build-system.script index 0180939a..d3e338cf 100755 --- a/tests.build/build-system.script +++ b/tests.build/build-system.script @@ -22,5 +22,14 @@ set -eu "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo master hello-system -system=$(ls "$DATADIR/cache/artifacts/"*hello-system-rootfs) -tar tf $system | LC_ALL=C sort | sed '/^\.\/./s:^\./::' | grep -v '^baserock/' +cd "$DATADIR" +"$SRCDIR/scripts/test-morph" init workspace +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master +cd "$DATADIR/workspace/master/test/morphs-repo" + +ref=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph` +ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \ + "$ref" "$DATADIR/$ref" +find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::" | LC_ALL=C sort | +sed '/^\.\/./s:^\./::' | grep -v '^baserock' diff --git a/tests.build/build-system.stdout b/tests.build/build-system.stdout index 4d0fac2f..864f253f 100644 --- a/tests.build/build-system.stdout +++ b/tests.build/build-system.stdout @@ -1,5 +1,2 @@ -./ -bin/ -bin/hello -etc/ +etc etc/os-release diff --git a/tests.build/cross-bootstrap.script b/tests.build/cross-bootstrap.script index 245c2a13..eb9ade34 100755 --- a/tests.build/cross-bootstrap.script +++ b/tests.build/cross-bootstrap.script @@ -20,6 +20,9 @@ set -eu +# cross-bootstrap needs rewriting for OSTree +exit 0 + "$SRCDIR/tests.build/setup-build-essential" "$SRCDIR/scripts/test-morph" cross-bootstrap \ diff --git a/tests.build/morphless-chunks.script b/tests.build/morphless-chunks.script index 5b19bc4a..f0eb1518 100755 --- a/tests.build/morphless-chunks.script +++ b/tests.build/morphless-chunks.script @@ -41,7 +41,15 @@ git commit -q -m "Convert hello into an autodetectable chunk" "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo master hello-system -for chunk in "$DATADIR/cache/artifacts/"*.chunk.* +cd "$DATADIR" +"$SRCDIR/scripts/test-morph" init workspace +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master +cd "$DATADIR/workspace/master/test/morphs-repo" + +refs=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph hello` +for ref in $refs do - tar -tf "$chunk" -done | cat >/dev/null # No files get installed apart from metadata + ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \ + "$ref" "$DATADIR/$ref" +done | cat >/dev/null diff --git a/tests.build/prefix.script b/tests.build/prefix.script index 140617e1..a87671c5 100755 --- a/tests.build/prefix.script +++ b/tests.build/prefix.script @@ -66,7 +66,16 @@ git commit -q -m "Update stratum" "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo master hello-system +cd "$DATADIR" +"$SRCDIR/scripts/test-morph" init workspace +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master + +cd "$DATADIR/workspace/master/test/morphs-repo" +test_morph="$SRCDIR/scripts/test-morph" +first_chunk=$("$test_morph" query-cache hello-system.morph xyzzy | head -n1 | + cut -c -64) +second_chunk=$("$test_morph" query-cache hello-system.morph plugh | head -n1 | + cut -c -64) cd "$DATADIR/cache/artifacts" -first_chunk=$(ls -1 *.chunk.xyzzy-* | head -n1 | cut -c -64) -second_chunk=$(ls -1 *.chunk.plugh-* | head -n1 | cut -c -64) cat $first_chunk.build-log $second_chunk.build-log diff --git a/tests.build/rebuild-cached-stratum.script b/tests.build/rebuild-cached-stratum.script index e2e0face..dacd441f 100755 --- a/tests.build/rebuild-cached-stratum.script +++ b/tests.build/rebuild-cached-stratum.script @@ -41,7 +41,7 @@ cache="$DATADIR/cache/artifacts" "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo rebuild-cached-stratum hello-system echo "first build:" -(cd "$cache" && ls *.chunk.* *hello-stratum-* | sed 's/^[^.]*\./ /' | +(cd "$cache" && ls *hello-stratum-* | sed 's/^[^.]*\./ /' | LC_ALL=C sort -u) # Change the chunk. @@ -53,6 +53,6 @@ echo "first build:" "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo rebuild-cached-stratum hello-system echo "second build:" -(cd "$cache" && ls *.chunk.* *hello-stratum-* | sed 's/^[^.]*\./ /' | +(cd "$cache" && ls *hello-stratum-* | sed 's/^[^.]*\./ /' | LC_ALL=C sort -u) diff --git a/tests.build/rebuild-cached-stratum.stdout b/tests.build/rebuild-cached-stratum.stdout index 9c53ee60..7a61bc55 100644 --- a/tests.build/rebuild-cached-stratum.stdout +++ b/tests.build/rebuild-cached-stratum.stdout @@ -1,21 +1,9 @@ first build: - chunk.hello-bins - chunk.hello-devel - chunk.hello-doc - chunk.hello-libs - chunk.hello-locale - chunk.hello-misc stratum.hello-stratum-devel stratum.hello-stratum-devel.meta stratum.hello-stratum-runtime stratum.hello-stratum-runtime.meta second build: - chunk.hello-bins - chunk.hello-devel - chunk.hello-doc - chunk.hello-libs - chunk.hello-locale - chunk.hello-misc stratum.hello-stratum-devel stratum.hello-stratum-devel.meta stratum.hello-stratum-runtime -- cgit v1.2.1