diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-08-25 11:07:36 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-08-25 11:07:36 +0100 |
commit | 1ae9ddb9a65b8a7277e8a230a57f298503ef23bc (patch) | |
tree | 4e61a165681ee992e58b4f738544c3d05111c1d8 | |
parent | 5d51c44c0413bfd29239cb596e3cba166f4a161d (diff) | |
download | obnam-1ae9ddb9a65b8a7277e8a230a57f298503ef23bc.tar.gz |
Simplify test code by using GNU sed -i emulator script
-rwxr-xr-x | tests/convert5to6.script | 9 | ||||
-rwxr-xr-x | tests/forget-removes-according-to-policy.script | 8 | ||||
-rwxr-xr-x | tests/forget-removes-specified-gens.script | 8 | ||||
-rwxr-xr-x | tests/verify | 8 |
4 files changed, 5 insertions, 28 deletions
diff --git a/tests/convert5to6.script b/tests/convert5to6.script index aeacf2b1..92627d34 100755 --- a/tests/convert5to6.script +++ b/tests/convert5to6.script @@ -19,12 +19,6 @@ set -eu -# GNU sed is required: -if [ -e /usr/local/bin/gsed ]; then - SED=/usr/local/bin/gsed; else - SED=sed -fi - cd "$DATADIR" tar -xf "$SRCDIR/test-data/repo-format-5-encrypted-gzipped.tar.gz" "$SRCDIR/tests/obnam" convert5to6 \ @@ -38,7 +32,8 @@ tar -xf "$SRCDIR/test-data/repo-format-5-encrypted-gzipped.tar.gz" # Not all filesystems support nanosecond timestamps, but that doesn't # matter for us. So we remove the sub-second timestamps from both # summain files. -$SED -i '/^Mtime:/s/\.[0-9]* /.IGNORED /' data.summain restored.summain +"$SRCDIR/sed-in-place" '/^Mtime:/s/\.[0-9]* /.IGNORED /' \ + data.summain restored.summain diff -u data.summain restored.summain diff --git a/tests/forget-removes-according-to-policy.script b/tests/forget-removes-according-to-policy.script index 25a603f1..ab702cb3 100755 --- a/tests/forget-removes-according-to-policy.script +++ b/tests/forget-removes-according-to-policy.script @@ -19,18 +19,12 @@ set -e echo aaa > "$DATADIR/data/aaa" echo ccc > "$DATADIR/data/ccc" -# GNU sed is required: -if [ -e /usr/local/bin/gsed ]; then - SED=/usr/local/bin/gsed; else - SED=sed -fi - $SRCDIR/tests/backup $SRCDIR/tests/backup $SRCDIR/tests/obnam genids > "$DATADIR/genids-1" $SRCDIR/tests/obnam forget --keep=1d -$SED -i 1d "$DATADIR/genids-1" +$SRCDIR/sed-in-place 1d "$DATADIR/genids-1" $SRCDIR/tests/obnam genids > "$DATADIR/genids-2" diff -u "$DATADIR/genids-1" "$DATADIR/genids-2" diff --git a/tests/forget-removes-specified-gens.script b/tests/forget-removes-specified-gens.script index e0de9d47..424ce284 100755 --- a/tests/forget-removes-specified-gens.script +++ b/tests/forget-removes-specified-gens.script @@ -16,12 +16,6 @@ set -e -# GNU sed is required: -if [ -e /usr/local/bin/gsed ]; then - SED=/usr/local/bin/gsed; else - SED=sed -fi - echo aaa > "$DATADIR/data/aaa" echo ccc > "$DATADIR/data/ccc" @@ -30,7 +24,7 @@ $SRCDIR/tests/backup $SRCDIR/tests/obnam genids > "$DATADIR/genids-1" $SRCDIR/tests/obnam forget $(head -n1 "$DATADIR/genids-1") -$SED -i 1d "$DATADIR/genids-1" +$SRCDIR/sed-in-place 1d "$DATADIR/genids-1" $SRCDIR/tests/obnam genids > "$DATADIR/genids-2" diff -u "$DATADIR/genids-1" "$DATADIR/genids-2" diff --git a/tests/verify b/tests/verify index bfac1c6e..a4bfe602 100755 --- a/tests/verify +++ b/tests/verify @@ -18,12 +18,6 @@ set -e -# GNU sed is required: -if [ -e /usr/local/bin/gsed ]; then - SED=/usr/local/bin/gsed; else - SED=sed -fi - summain -r "$DATADIR/data" > "$DATADIR/data.summain" summain -r "$DATADIR/restored/$DATADIR/data" > "$DATADIR/restored.summain" @@ -31,7 +25,7 @@ summain -r "$DATADIR/restored/$DATADIR/data" > "$DATADIR/restored.summain" # summain output to remove sub-second timestamps. if [ "$OBNAM_TEST_SFTP_ROOT" = yes ] then - $SED -i '/^Mtime:/s/\.[[:digit:]]\+ / /' \ + "$SRCDIR/sed-in-place" '/^Mtime:/s/\.[[:digit:]]\+ / /' \ "$DATADIR/data.summain" \ "$DATADIR/restored.summain" fi |