diff options
author | marcel <marcel@FreeBSD.org> | 2014-09-22 16:37:37 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2014-09-22 16:37:37 +0000 |
commit | deb4e9e0ed82c6efacaecc28d0d175c8df4bf479 (patch) | |
tree | 075355001ad3104ef981d50b60b7f2dba667746c /usr.bin/mkimg | |
parent | bc2167fa662cc13b9cec9bbc88deddeecbfc39a8 (diff) | |
download | FreeBSD-src-deb4e9e0ed82c6efacaecc28d0d175c8df4bf479.zip FreeBSD-src-deb4e9e0ed82c6efacaecc28d0d175c8df4bf479.tar.gz |
Don't update the baseline file when the result of the test is identical
to the baseline. Since we don't run gzip with the -n option, the output
of gzip varies for identical result files if and when they are created
at different time. Ouch...
Rather than add -n and commit a 600K+ diff for the changes to all the .uu
files, it's less of a churn to uudecode and gunzip the baseline file and
compare that to the new result file to determine if the baseline file
needs to be updated.
This way, "atf-sh mkimg.sh rebase" can be run as many times as people like
and a subsequent "svn status" will not show unnecessary diffs.
Diffstat (limited to 'usr.bin/mkimg')
-rwxr-xr-x | usr.bin/mkimg/tests/mkimg.sh | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/usr.bin/mkimg/tests/mkimg.sh b/usr.bin/mkimg/tests/mkimg.sh index 00b5d92..f1fa931 100755 --- a/usr.bin/mkimg/tests/mkimg.sh +++ b/usr.bin/mkimg/tests/mkimg.sh @@ -68,6 +68,34 @@ makeimage() return 0 } +mkimg_rebase() +{ + local baseline image result tmpfile update + + image=$1 + result=$2 + + baseline=$image.gz.uu + update=yes + + if test -f $baseline; then + tmpfile=_tmp-baseline + uudecode -p $baseline | gunzip -c > $tmpfile + if cmp -s $tmpfile $result; then + update=no + fi + fi + + if test $update = yes; then + # Prevent keyword expansion when writing the keyword. + (echo -n '# $'; echo -n FreeBSD; echo '$') > $baseline + gzip -c $result | uuencode $image.gz >> $baseline + fi + + rm $image $result _tmp-* + return 0 +} + mkimg_test() { local blksz format geom scheme @@ -89,13 +117,10 @@ mkimg_test() image=`makeimage $format $scheme $blksz $geom img $partinfo` result=$image.out hexdump -C $image > $result - baseline=`atf_get_srcdir`/$image if test "x$mkimg_update_baseline" = "xyes"; then - # Prevent keyword expansion when writing the keyword. - (echo -n '# $'; echo -n FreeBSD; echo '$') > $image.gz.uu - gzip -c $result | uuencode $image.gz >> $image.gz.uu - rm $image $result _tmp-* + mkimg_rebase $image $result else + baseline=`atf_get_srcdir`/$image atf_check -s exit:0 cmp -s $baseline $result fi return 0 |