mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #3987 from ethereum/solc_remove_stdin
BREAKING Solc: read from stdin only if "-" is explicitly given
This commit is contained in:
commit
9705678269
@ -3,6 +3,13 @@
|
|||||||
Features:
|
Features:
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Features:
|
||||||
|
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|
||||||
### 0.4.24 (2018-05-16)
|
### 0.4.24 (2018-05-16)
|
||||||
|
@ -404,9 +404,7 @@ bool CommandLineInterface::readInputFilesAndConfigureRemappings()
|
|||||||
{
|
{
|
||||||
bool ignoreMissing = m_args.count(g_argIgnoreMissingFiles);
|
bool ignoreMissing = m_args.count(g_argIgnoreMissingFiles);
|
||||||
bool addStdin = false;
|
bool addStdin = false;
|
||||||
if (!m_args.count(g_argInputFile))
|
if (m_args.count(g_argInputFile))
|
||||||
addStdin = true;
|
|
||||||
else
|
|
||||||
for (string path: m_args[g_argInputFile].as<vector<string>>())
|
for (string path: m_args[g_argInputFile].as<vector<string>>())
|
||||||
{
|
{
|
||||||
auto eq = find(path.begin(), path.end(), '=');
|
auto eq = find(path.begin(), path.end(), '=');
|
||||||
@ -450,6 +448,11 @@ bool CommandLineInterface::readInputFilesAndConfigureRemappings()
|
|||||||
}
|
}
|
||||||
if (addStdin)
|
if (addStdin)
|
||||||
m_sourceCodes[g_stdinFileName] = dev::readStandardInput();
|
m_sourceCodes[g_stdinFileName] = dev::readStandardInput();
|
||||||
|
if (m_sourceCodes.size() == 0)
|
||||||
|
{
|
||||||
|
cerr << "No input files given. If you wish to use the standard input please specify \"-\" explicity." << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -139,25 +139,55 @@ rm -rf "$TMPDIR"
|
|||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
printTask "Testing library checksum..."
|
printTask "Testing library checksum..."
|
||||||
echo '' | "$SOLC" --link --libraries a:0x90f20564390eAe531E810af625A22f51385Cd222
|
echo '' | "$SOLC" - --link --libraries a:0x90f20564390eAe531E810af625A22f51385Cd222 >/dev/null
|
||||||
! echo '' | "$SOLC" --link --libraries a:0x80f20564390eAe531E810af625A22f51385Cd222 2>/dev/null
|
! echo '' | "$SOLC" - --link --libraries a:0x80f20564390eAe531E810af625A22f51385Cd222 &>/dev/null
|
||||||
|
|
||||||
printTask "Testing long library names..."
|
printTask "Testing long library names..."
|
||||||
echo '' | "$SOLC" --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname:0x90f20564390eAe531E810af625A22f51385Cd222
|
echo '' | "$SOLC" - --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname:0x90f20564390eAe531E810af625A22f51385Cd222 >/dev/null
|
||||||
|
|
||||||
printTask "Testing overwriting files"
|
printTask "Testing overwriting files..."
|
||||||
TMPDIR=$(mktemp -d)
|
TMPDIR=$(mktemp -d)
|
||||||
(
|
(
|
||||||
set -e
|
set -e
|
||||||
# First time it works
|
# First time it works
|
||||||
echo 'contract C {} ' | "$SOLC" --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null
|
echo 'contract C {} ' | "$SOLC" - --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null
|
||||||
# Second time it fails
|
# Second time it fails
|
||||||
! echo 'contract C {} ' | "$SOLC" --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null
|
! echo 'contract C {} ' | "$SOLC" - --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null
|
||||||
# Unless we force
|
# Unless we force
|
||||||
echo 'contract C {} ' | "$SOLC" --overwrite --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null
|
echo 'contract C {} ' | "$SOLC" - --overwrite --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null
|
||||||
)
|
)
|
||||||
rm -rf "$TMPDIR"
|
rm -rf "$TMPDIR"
|
||||||
|
|
||||||
|
printTask "Testing assemble, yul, strict-assembly..."
|
||||||
|
echo '{}' | "$SOLC" - --assemble &>/dev/null
|
||||||
|
echo '{}' | "$SOLC" - --julia &>/dev/null
|
||||||
|
echo '{}' | "$SOLC" - --strict-assembly &>/dev/null
|
||||||
|
|
||||||
|
printTask "Testing standard input..."
|
||||||
|
TMPDIR=$(mktemp -d)
|
||||||
|
(
|
||||||
|
set +e
|
||||||
|
output=$("$SOLC" --bin 2>&1)
|
||||||
|
result=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# This should fail
|
||||||
|
if [[ !("$output" =~ "No input files given") || ($result == 0) ]] ; then
|
||||||
|
printError "Incorrect response to empty input arg list: $STDERR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set +e
|
||||||
|
output=$(echo 'contract C {} ' | "$SOLC" - --bin 2>/dev/null | grep -q "<stdin>:C")
|
||||||
|
result=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# The contract should be compiled
|
||||||
|
if [[ "$result" != 0 ]] ; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
printTask "Testing soljson via the fuzzer..."
|
printTask "Testing soljson via the fuzzer..."
|
||||||
TMPDIR=$(mktemp -d)
|
TMPDIR=$(mktemp -d)
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user