From: Dmitry V. Levin Date: Mon, 9 May 2016 23:19:37 +0000 (+0000) Subject: strace-V.test: cleanup X-Git-Tag: v4.12~204 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a30d02e9020c59a37efecac082b91967ba94a9f9;p=strace strace-V.test: cleanup * tests/strace-V.test: Move config.h parser to a function. Rename $OUT to $EXP, swap arguments passed to match_diff. --- diff --git a/tests/strace-V.test b/tests/strace-V.test index c474f885..91093acb 100755 --- a/tests/strace-V.test +++ b/tests/strace-V.test @@ -6,10 +6,12 @@ run_strace -V > "$LOG" -PACKAGE_NAME="$(sed -n 's/#define[[:space:]]*PACKAGE_NAME[[:space:]]*"\([^"]*\)".*/\1/p' ../config.h)" -VERSION="$(sed -n 's/#define[[:space:]]*VERSION[[:space:]]*"\([^"]*\)".*/\1/p' ../config.h)" +getval() +{ + sed -n 's/#define[[:space:]]*'"$1"'[[:space:]]*"\([^"]*\)".*/\1/p' ../config.h +} -printf "%s -- version %s\n" "$PACKAGE_NAME" "$VERSION" > "$OUT" +printf "%s -- version %s\n" "$(getval PACKAGE_NAME)" "$(getval VERSION)" > "$EXP" -match_diff "$LOG" "$OUT" -rm -f "$OUT" +match_diff "$EXP" "$LOG" +rm -f "$EXP"