cmdlineTests.sh: Remove double slashes from input file paths

- `${tdir}` already ends with a slash so something like `${tdir}/input.json` evaluates to `test_dir//input.json`.
This commit is contained in:
Kamil Śliwak 2020-11-07 16:15:04 +01:00
parent 7f1389a6cd
commit dfb5516446

View File

@ -242,6 +242,9 @@ printTask "Running general commandline tests..."
do do
printTask " - ${tdir}" printTask " - ${tdir}"
# Strip trailing slash from $tdir. `find` on MacOS X won't strip it and will produce double slashes.
tdir=$(basename "${tdir}")
if [ -e "${tdir}/input.json" ] if [ -e "${tdir}/input.json" ]
then then
inputFile="" inputFile=""
@ -250,17 +253,17 @@ printTask "Running general commandline tests..."
stdoutExpectationFile="${tdir}/output.json" stdoutExpectationFile="${tdir}/output.json"
args="--standard-json "$(cat ${tdir}/args 2>/dev/null || true) args="--standard-json "$(cat ${tdir}/args 2>/dev/null || true)
else else
if [[ -e "${tdir}input.yul" && -e "${tdir}input.sol" ]] if [[ -e "${tdir}/input.yul" && -e "${tdir}/input.sol" ]]
then then
printError "Ambiguous input. Found both input.sol and input.yul." printError "Ambiguous input. Found both input.sol and input.yul."
exit 1 exit 1
fi fi
if [ -e "${tdir}input.yul" ] if [ -e "${tdir}/input.yul" ]
then then
inputFile="${tdir}input.yul" inputFile="${tdir}/input.yul"
else else
inputFile="${tdir}input.sol" inputFile="${tdir}/input.sol"
fi fi
stdin="" stdin=""
stdout="$(cat ${tdir}/output 2>/dev/null || true)" stdout="$(cat ${tdir}/output 2>/dev/null || true)"