diff options
author | Karel Zak | 2012-02-28 14:37:45 +0100 |
---|---|---|
committer | Karel Zak | 2012-02-28 14:37:45 +0100 |
commit | 4210c47adc382815a0528add4342e5f2b3b3c101 (patch) | |
tree | 42001b8e435cdf0fed860c3b7728a88ca258d544 /tests | |
parent | build-sys: enhance readability of the autotools files (diff) | |
download | kernel-qcow2-util-linux-4210c47adc382815a0528add4342e5f2b3b3c101.tar.gz kernel-qcow2-util-linux-4210c47adc382815a0528add4342e5f2b3b3c101.tar.xz kernel-qcow2-util-linux-4210c47adc382815a0528add4342e5f2b3b3c101.zip |
tests: make output and diff dirs usage more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/functions.sh | 15 | ||||
-rwxr-xr-x | tests/ts/build-sys/config | 11 |
3 files changed, 23 insertions, 5 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 2f8f2643c..c22f30e58 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,5 +8,5 @@ EXTRA_DIST = \ run.sh \ ts -distclean-local: +clean-local: rm -rf output diff diff --git a/tests/functions.sh b/tests/functions.sh index 85b162109..6556e4ed2 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -93,6 +93,8 @@ function ts_init_core_subtest_env { TS_MOUNTPOINT="$TS_OUTDIR/${TS_TESTNAME}-${TS_SUBNAME}-mnt" rm -f $TS_OUTPUT $TS_VGDUMP + [ -d "$TS_OUTDIR" ] || mkdir -p "$TS_OUTDIR" + touch $TS_OUTPUT [ -n "$TS_VALGRIND_CMD" ] && touch $TS_VGDUMP } @@ -127,8 +129,6 @@ function ts_init_env { BLKID_FILE="$TS_OUTDIR/${TS_TESTNAME}.blkidtab" - [ -d "$TS_OUTDIR" ] || mkdir -p "$TS_OUTDIR" - [ -d "$TS_DIFFDIR" ] || mkdir -p "$TS_DIFFDIR" declare -a TS_SUID_PROGS declare -a TS_SUID_USER @@ -141,6 +141,8 @@ function ts_init_env { export BLKID_FILE rm -f $TS_OUTPUT $TS_VGDUMP + [ -d "$TS_OUTDIR" ] || mkdir -p "$TS_OUTDIR" + touch $TS_OUTPUT [ -n "$TS_VALGRIND_CMD" ] && touch $TS_VGDUMP @@ -219,8 +221,15 @@ function ts_gen_diff { local res=0 if [ -s "$TS_OUTPUT" ]; then + + [ -d "$TS_DIFFDIR" ] || mkdir -p "$TS_DIFFDIR" diff -u $TS_EXPECTED $TS_OUTPUT > $TS_DIFF - [ -s $TS_DIFF ] && res=1 + + if [ -s $TS_DIFF ]; then + res=1 + else + rm -f $TS_DIFF; + fi else res=1 fi diff --git a/tests/ts/build-sys/config b/tests/ts/build-sys/config index 7ede38ca8..e2c2b00f8 100755 --- a/tests/ts/build-sys/config +++ b/tests/ts/build-sys/config @@ -52,9 +52,18 @@ for conf in $config_gen_dir/config-gen.d/*.conf; do esac fi done + + # clean the tree, but exclude tests/{diff,output} dirs + # + [ -d tests/diff ] && mv tests/diff tests/diff.save + [ -d tests/output ] && mv tests/output tests/output.save + make -j clean &> /dev/null - cd $olddir + [ -d tests/diff.save ] && mv tests/diff.save tests/diff + [ -d tests/output.save ] && mv tests/output.save tests/output + + cd $olddir ts_finalize_subtest done |