From 9ad7e14298703efdf1d9c5bfffdb176e82deec5c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 17 Jan 2017 12:37:32 +0000 Subject: test suite: gitattributes: Break out t-dgit-warn-check No functional change. Signed-off-by: Ian Jackson --- tests/tests/gitattributes | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/tests/gitattributes b/tests/tests/gitattributes index 0093f0a..d9323b6 100755 --- a/tests/tests/gitattributes +++ b/tests/tests/gitattributes @@ -121,11 +121,27 @@ sums_check () { diff -U0 ../sums ../$sums } +t-dgit-warn-check () { + local warnok=$1; shift + # warnok should be 0 if the warning is expected + # 1 if the warning is NOT expected + + local err=stderr.$wd + + LC_MESSAGES=C t-dgit "$@" 2>&1 |tee ../$err + + set +e + fgrep 'warning: source tree contains .gitattributes' ../$err + rc=$? + set -e + + test "$rc" = "$warnok" +} + sfmt_import () { inst=$1 dgitargs=$2 branch="import.$sfmt-$inst" - brkerr=stderr.$sfmt-$inst.broken dscf=${p}_${v}.dsc sums=sums.$sfmt-$inst wd=$pdb-import-$inst @@ -134,10 +150,8 @@ sfmt_import () { cd $wd git init - LC_MESSAGES=C \ - t-dgit $dgitargs import-dsc ../$dscf +$branch.broken \ - 2>&1 |tee ../$brkerr - fgrep 'warning: source tree contains .gitattributes' ../$brkerr + t-dgit-warn-check 0 $dgitargs import-dsc ../$dscf +$branch.broken + git checkout $branch.broken sha256sum af/* >../$sums.broken -- cgit v1.2.3