diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-03-22 14:45:00 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-03-22 14:49:24 +0000 |
commit | 2f9eedd5ce3474a3e07e1a2b5441afad8a55b4dc (patch) | |
tree | 00030a6d116fadfdde7b1e909d78f5ba043262fe /tests | |
parent | 8029b45dfc9ba8970e57ec0b16d48e2ec1a0bd1a (diff) | |
download | morph-2f9eedd5ce3474a3e07e1a2b5441afad8a55b4dc.tar.gz |
Empty and initialize the test data dir anew for each test
This avoids accidentally having tests that depend on each other. It
would be bad to have tests/bar.script do something and then
tests/foo.script only work because of that something: if tests/bar.script
later changes, then the later test starts breaking. Keeping tests
independent is good practice. We don't seem to have had such
dependencies yet, so this is a pre-emptive defensive move.
Also, this means we can use simpler names in $DATADIR, instead of
embedding the test name in everything. This further simplifies the
act of creating new tests.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/build-chunk-distributed-local.script | 4 | ||||
-rwxr-xr-x | tests/build-chunk.script | 6 | ||||
-rwxr-xr-x | tests/build-stratum-distributed-local.script | 4 | ||||
-rwxr-xr-x | tests/build-stratum.script | 6 | ||||
-rwxr-xr-x | tests/missing-ref.script | 6 | ||||
-rwxr-xr-x | tests/name-clash.script | 4 | ||||
-rwxr-xr-x | tests/rebuild-cached-stratum.script | 6 | ||||
-rwxr-xr-x | tests/setup (renamed from tests/setup_once) | 3 | ||||
-rwxr-xr-x | tests/show-dependencies.script | 4 |
9 files changed, 23 insertions, 20 deletions
diff --git a/tests/build-chunk-distributed-local.script b/tests/build-chunk-distributed-local.script index bcfa48af..341bf9d2 100755 --- a/tests/build-chunk-distributed-local.script +++ b/tests/build-chunk-distributed-local.script @@ -23,8 +23,8 @@ set -e # the root directory of the morph repository export PATH="`pwd`:$PATH" -cache="$DATADIR/build-chunk-cache" -log="$DATADIR/build-chunk-morph.log" +cache="$DATADIR/cache" +log="$DATADIR/morph.log" ./morph --no-default-configs \ build-distributed chunk-repo farrokh hello.morph \ --git-base-url="file://$DATADIR" \ diff --git a/tests/build-chunk.script b/tests/build-chunk.script index 01fbf8f5..e33af6b5 100755 --- a/tests/build-chunk.script +++ b/tests/build-chunk.script @@ -2,7 +2,7 @@ # # Test building a chunk. # -# Copyright (C) 2011 Codethink Limited +# 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 @@ -19,8 +19,8 @@ set -e -cache="$DATADIR/build-chunk-cache" -log="$DATADIR/build-chunk-morph.log" +cache="$DATADIR/cache" +log="$DATADIR/morph.log" ./morph --no-default-configs build chunk-repo farrokh hello.morph \ --git-base-url="file://$DATADIR" \ --cachedir="$cache" --keep-path --no-distcc \ diff --git a/tests/build-stratum-distributed-local.script b/tests/build-stratum-distributed-local.script index 2e381fd7..8c8d645e 100755 --- a/tests/build-stratum-distributed-local.script +++ b/tests/build-stratum-distributed-local.script @@ -21,8 +21,8 @@ set -e export PATH="`pwd`:$PATH" -cache="$DATADIR/build-stratum-cache" -log="$DATADIR/build-stratum-morph.log" +cache="$DATADIR/cache" +log="$DATADIR/morph.log" ./morph --no-default-configs \ build-distributed morphs-repo master hello-stratum.morph \ --git-base-url="file://$DATADIR" \ diff --git a/tests/build-stratum.script b/tests/build-stratum.script index dadda81f..4680f25f 100755 --- a/tests/build-stratum.script +++ b/tests/build-stratum.script @@ -2,7 +2,7 @@ # # Test build a simple stratum. # -# Copyright (C) 2011 Codethink Limited +# 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 @@ -19,8 +19,8 @@ set -e -cache="$DATADIR/build-stratum-cache" -log="$DATADIR/build-stratum-morph.log" +cache="$DATADIR/cache" +log="$DATADIR/morph.log" ./morph --no-default-configs build morphs-repo master hello-stratum.morph \ --git-base-url="file://$DATADIR" \ --cachedir="$cache" --keep-path --no-distcc \ diff --git a/tests/missing-ref.script b/tests/missing-ref.script index f37caccc..1f57dca7 100755 --- a/tests/missing-ref.script +++ b/tests/missing-ref.script @@ -18,11 +18,11 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #tempdirs make script diffing cry -cache="$DATADIR/build-chunk-cache" +cache="$DATADIR/cache" ./morph --no-default-configs build chunk-repo non-existent-branch hello.morph \ --git-base-url="file://$DATADIR" \ --cachedir="$cache" --keep-path --no-distcc \ - 2> "$DATADIR/build-chunk-cache.stderr" + 2> "$DATADIR/stderr" err=$? -cat "$DATADIR/build-chunk-cache.stderr" | sed "s%$DATADIR%%" 1>&2 +cat "$DATADIR/stderr" | sed "s%$DATADIR%%" 1>&2 exit $err diff --git a/tests/name-clash.script b/tests/name-clash.script index ce9ec051..0d989732 100755 --- a/tests/name-clash.script +++ b/tests/name-clash.script @@ -22,8 +22,8 @@ set -e -cache="$DATADIR/build-chunk-cache" -log="$DATADIR/build-chunk-morph.log" +cache="$DATADIR/cache" +log="$DATADIR/morph.log" ( cd "$DATADIR/chunk-repo" git checkout --quiet farrokh diff --git a/tests/rebuild-cached-stratum.script b/tests/rebuild-cached-stratum.script index 2802dd54..4d6193e8 100755 --- a/tests/rebuild-cached-stratum.script +++ b/tests/rebuild-cached-stratum.script @@ -5,7 +5,7 @@ # not get rebuilt in that case. Later on, the test will guard against # regressions. # -# Copyright (C) 2011 Codethink Limited +# 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 @@ -22,8 +22,8 @@ set -e -cache="$DATADIR/rebuild-cached-stratum-cache" -log="$DATADIR/rebuild-cached-stratum-morph.log" +cache="$DATADIR/cache" +log="$DATADIR/morph.log" # Make a branch in the chunk repo where we can make our own modifications. (cd "$DATADIR/chunk-repo" && diff --git a/tests/setup_once b/tests/setup index 3cd8e416..3711f050 100755 --- a/tests/setup_once +++ b/tests/setup @@ -28,6 +28,9 @@ set -e +# The $DATADIR should be empty at the beginnig of each test. +find "$DATADIR" -mindepth 1 -delete + # Create chunk repository. chunkrepo="$DATADIR/chunk-repo" diff --git a/tests/show-dependencies.script b/tests/show-dependencies.script index f38764b3..6c59c78b 100755 --- a/tests/show-dependencies.script +++ b/tests/show-dependencies.script @@ -20,8 +20,8 @@ set -e -cache="$DATADIR/show-dependencies-cache" -log="$DATADIR/show-dependencies-morph.log" +cache="$DATADIR/cache" +log="$DATADIR/morph.log" ./morph show-dependencies \ test-repo master xfce-core.morph \ |