]> granicus.if.org Git - strace/commitdiff
strace-V.test: cleanup
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 9 May 2016 23:19:37 +0000 (23:19 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 9 May 2016 23:19:37 +0000 (23:19 +0000)
* tests/strace-V.test: Move config.h parser to a function.
Rename $OUT to $EXP, swap arguments passed to match_diff.

tests/strace-V.test

index c474f885a84e4af4a0d2479aa37280436de4a4a8..91093acb8cf0c779b20436c093656100c67c41d3 100755 (executable)
@@ -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"