From dd2de560ad5fbf95c7f8243d173cdf2f58c6a740 Mon Sep 17 00:00:00 2001 From: Christian Hoene Date: Sat, 19 Oct 2024 20:48:09 +0200 Subject: [PATCH] unique tmp files --- tests/compare.sh | 13 ++++++++----- tests/compareIgnoreNew.sh | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/tests/compare.sh b/tests/compare.sh index f20d22d..003ef07 100755 --- a/tests/compare.sh +++ b/tests/compare.sh @@ -2,24 +2,27 @@ SCRIPTDIR=${0%/*} NODEJS=$(command -v node nodejs false | head -1) +TMP1=`mktemp -p . tmp1-XXXXXXXX.json` +TMP2=`mktemp -p . tmp2-XXXXXXXX.txt` +TMP3=`mktemp -p . tmp3-XXXXXXXX.json` -"${MYSOFA2JSON:-${SCRIPTDIR}/../build/src/mysofa2json}" -c -o tmp1.json -s "$1".sofa 2>tmp1.txt +"${MYSOFA2JSON:-${SCRIPTDIR}/../build/src/mysofa2json}" -c -o "$TMP1" -s "$1".sofa 2>"$TMP2" ret=$? if [ "$ret" != 0 ]; then - cat tmp1.txt + cat "$TMP2" echo Error libmysofa $ret exit $ret fi cp -f "${SCRIPTDIR}/json-diff.js" . 2>/dev/null || true -bunzip2 -c -k "$1".json.bz2 >./tmp2.json -"${NODEJS}" ./json-diff.js ./tmp1.json ./tmp2.json +bunzip2 -c -k "$1".json.bz2 >"$TMP3" +"${NODEJS}" ./json-diff.js "$TMP1" "$TMP3" ret=$? if [ "$ret" != 0 ]; then echo Diff $ret exit $ret fi echo ok -rm tmp1.json tmp1.txt tmp2.json +rm "$TMP1" "$TMP2" "$TMP3" diff --git a/tests/compareIgnoreNew.sh b/tests/compareIgnoreNew.sh index 9590a3b..cc97cdd 100755 --- a/tests/compareIgnoreNew.sh +++ b/tests/compareIgnoreNew.sh @@ -2,24 +2,27 @@ SCRIPTDIR=${0%/*} NODEJS=$(command -v node nodejs false | head -1) +TMP1=`mktemp -p . tmp1-XXXXXXXX.json` +TMP2=`mktemp -p . tmp2-XXXXXXXX.txt` +TMP3=`mktemp -p . tmp3-XXXXXXXX.json` -"${MYSOFA2JSON:-${SCRIPTDIR}/../build/src/mysofa2json}" -c -s -o tmp1.json "$1".sofa 2>tmp1.txt +"${MYSOFA2JSON:-${SCRIPTDIR}/../build/src/mysofa2json}" -c -s -o "$TMP1" "$1".sofa 2>"$TMP2" ret=$? if [ "$ret" != 0 ]; then - cat tmp1.txt + cat "$TMP2" echo Error libmysofa $ret exit $ret fi cp -f "${SCRIPTDIR}/json-diffIgnoreNew.js" . 2>/dev/null || true -bunzip2 -c -k "$1".json.bz2 >./tmp2.json -"${NODEJS}" ./json-diffIgnoreNew.js ./tmp1.json ./tmp2.json +bunzip2 -c -k "$1".json.bz2 >"$TMP3" +"${NODEJS}" ./json-diffIgnoreNew.js "$TMP1" "$TMP3" ret=$? if [ "$ret" != 0 ]; then echo Diff $ret exit $ret fi echo ok -rm tmp1.json tmp1.txt tmp2.json +rm "$TMP1" "$TMP2" "$TMP3"