Skip to content

Commit

Permalink
unique tmp files
Browse files Browse the repository at this point in the history
  • Loading branch information
hoene committed Oct 19, 2024
1 parent b96933c commit dd2de56
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
13 changes: 8 additions & 5 deletions tests/compare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

13 changes: 8 additions & 5 deletions tests/compareIgnoreNew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit dd2de56

Please sign in to comment.