summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2017-01-17 12:37:32 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2017-01-17 12:37:32 +0000
commit9ad7e14298703efdf1d9c5bfffdb176e82deec5c (patch)
treec503e9074c4a243b1cc1723472eaa2b742498d61 /tests
parent1a041c354fcfd62f9a01151dc64080fdb0a9b40d (diff)
test suite: gitattributes: Break out t-dgit-warn-check
No functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/tests/gitattributes24
1 files changed, 19 insertions, 5 deletions
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