[PATCH ipset 3/7] tests: diff.sh: preserve file name
Florian Westphal <[email protected]>
| Newsgroups | gmane.comp.security.firewalls.netfilter.devel |
|---|---|
| Message-ID | <[email protected]> |
As-is, in case of error, its not easy to see which diff file has failed, because diff gets fed via <(sed...), so diff shows something like --- /dev/fd/63 +++ /dev/ .. Take advantage of the temporary directory and output a file that has keeps part of the original name. Signed-off-by: Florian Westphal <[email protected]> --- tests/diff.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/diff.sh b/tests/diff.sh index a364a28b1dda..76b1938149eb 100755 --- a/tests/diff.sh +++ b/tests/diff.sh @@ -1,7 +1,14 @@ #!/bin/bash -diff -u -I 'Revision: .*' -I 'Size in memory.*' \ - <(sed -e 's/timeout [0-9]*/timeout x/' -e 's/initval 0x[0-9a-fA-F]\{8\}/initval 0x00000000/' $1) \ - <(sed -e 's/timeout [0-9]*/timeout x/' -e 's/initval 0x[0-9a-fA-F]\{8\}/initval 0x00000000/' $2) +NEW_DUMP="$IPSET_TMP/kernel-dump.sed" +STORED_DUMP="$IPSET_TMP/$2.sed" +sed -e 's/timeout [0-9]*/timeout x/' -e 's/initval 0x[0-9a-fA-F]\{8\}/initval 0x00000000/' "$1" > "$NEW_DUMP" +sed -e 's/timeout [0-9]*/timeout x/' -e 's/initval 0x[0-9a-fA-F]\{8\}/initval 0x00000000/' "$2" > "$STORED_DUMP" +diff -u -I 'Revision: .*' -I 'Size in memory.*' "$STORED_DUMP" "$NEW_DUMP" +ret=$? + +rm -f "$STORED_DUMP" "$NEW_DUMP" + +exit $ret -- 2.54.0