Skip to content

Commit e8b898c

Browse files
committed
ASTImportTest.sh: Keep temporary files in subdirs of a single, properly named dir
1 parent 2cce9c7 commit e8b898c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

scripts/ASTImportTest.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ function test_import_export_equivalence {
196196
fi
197197
}
198198

199-
WORKINGDIR=$PWD
200-
201199
command_available "$SOLC" --version
202200
command_available jq --version
203201

@@ -214,12 +212,17 @@ IMPORT_TEST_FILES=$(find "${TEST_DIRS[@]}" -name "*.sol" -and -not -name "boost_
214212
NSOURCES="$(echo "${IMPORT_TEST_FILES}" | wc -l)"
215213
echo "Looking at ${NSOURCES} .sol files..."
216214

215+
COUNTER=0
216+
TEST_DIR=$(mktemp -d -t "import-export-test-XXXXXX")
217+
pushd "$TEST_DIR" > /dev/null
218+
217219
for solfile in $IMPORT_TEST_FILES
218220
do
219221
echo -n "·"
220-
# create a temporary sub-directory
221-
FILETMP=$(mktemp -d)
222-
cd "$FILETMP"
222+
223+
TEST_SUBDIR="$(printf "%05d" "$COUNTER")-$(basename "$solfile")"
224+
mkdir "$TEST_SUBDIR"
225+
pushd "$TEST_SUBDIR" > /dev/null
223226

224227
set +e
225228
OUTPUT=$("$SPLITSOURCES" "$solfile")
@@ -244,19 +247,16 @@ do
244247
# All other return codes will be treated as critical errors. The script will exit.
245248
printError "\n\nGot unexpected return code ${SPLITSOURCES_RC} from '${SPLITSOURCES} ${solfile}'. Aborting."
246249
printError "\n\n${OUTPUT}\n\n"
247-
248-
cd "$WORKINGDIR"
249-
# Delete temporary files
250-
rm -rf "$FILETMP"
251-
252250
exit 1
253251
fi
254252

255-
cd "$WORKINGDIR"
256-
# Delete temporary files
257-
rm -rf "$FILETMP"
253+
popd > /dev/null
254+
((++COUNTER))
258255
done
259256

257+
popd > /dev/null
258+
rm -r "$TEST_DIR"
259+
260260
echo
261261

262262
if (( FAILED == 0 ))

0 commit comments

Comments
 (0)