mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10233 from ethereum/cmdline-tests-arbitrary-input-extension
Arbitrary input file extensions in command-line tests
This commit is contained in:
commit
fc50169d00
@ -254,26 +254,37 @@ printTask "Running general commandline tests..."
|
||||
cd "$REPO_ROOT"/test/cmdlineTests/
|
||||
for tdir in */
|
||||
do
|
||||
if [ -e "${tdir}/input.json" ]
|
||||
printTask " - ${tdir}"
|
||||
|
||||
# Strip trailing slash from $tdir. `find` on MacOS X won't strip it and will produce double slashes.
|
||||
tdir=$(basename "${tdir}")
|
||||
|
||||
inputFiles="$(find "${tdir}" -name 'input.*' -type f -exec printf "%s\n" "{}" \;)"
|
||||
inputCount="$(echo "${inputFiles}" | wc -l)"
|
||||
if (( ${inputCount} == 0 ))
|
||||
then
|
||||
printError "No input files found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (( ${inputCount} > 1 ))
|
||||
then
|
||||
printError "Ambiguous input. Found input files in multiple formats:"
|
||||
echo -e "${inputFiles}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use printf to get rid of the trailing newline
|
||||
inputFile=$(printf "%s" "${inputFiles}")
|
||||
|
||||
if [ "${inputFile}" = "${tdir}/input.json" ]
|
||||
then
|
||||
stdin="${inputFile}"
|
||||
inputFile=""
|
||||
stdin="${tdir}/input.json"
|
||||
stdout="$(cat ${tdir}/output.json 2>/dev/null || true)"
|
||||
stdoutExpectationFile="${tdir}/output.json"
|
||||
args="--standard-json "$(cat ${tdir}/args 2>/dev/null || true)
|
||||
else
|
||||
if [[ -e "${tdir}input.yul" && -e "${tdir}input.sol" ]]
|
||||
then
|
||||
printError "Ambiguous input. Found both input.sol and input.yul."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e "${tdir}input.yul" ]
|
||||
then
|
||||
inputFile="${tdir}input.yul"
|
||||
else
|
||||
inputFile="${tdir}input.sol"
|
||||
fi
|
||||
stdin=""
|
||||
stdout="$(cat ${tdir}/output 2>/dev/null || true)"
|
||||
stdoutExpectationFile="${tdir}/output"
|
||||
@ -282,7 +293,6 @@ printTask "Running general commandline tests..."
|
||||
exitCode=$(cat ${tdir}/exit 2>/dev/null || true)
|
||||
err="$(cat ${tdir}/err 2>/dev/null || true)"
|
||||
stderrExpectationFile="${tdir}/err"
|
||||
printTask " - ${tdir}"
|
||||
test_solc_behaviour "$inputFile" \
|
||||
"$args" \
|
||||
"$stdin" \
|
||||
|
Loading…
Reference in New Issue
Block a user