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.
This commit is contained in:
parent
bc2167fa66
commit
deb4e9e0ed
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user