aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog.md1
-rw-r--r--libsolidity/analysis/TypeChecker.cpp7
-rw-r--r--scripts/Dockerfile_alpine5
-rwxr-xr-xscripts/docker_build.sh4
-rwxr-xr-xscripts/docker_deploy.sh24
-rwxr-xr-xscripts/docker_deploy_manual.sh27
-rw-r--r--test/libsolidity/SMTCheckerJSONTest.cpp87
7 files changed, 100 insertions, 55 deletions
diff --git a/Changelog.md b/Changelog.md
index a90580bc..4defbbe4 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -22,6 +22,7 @@ Bugfixes:
Build System:
* Emscripten: Upgrade to Emscripten SDK 1.37.21 and boost 1.67.
+ * Docker: Includes both Scratch and Alpine images.
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 9d536a3a..c41c372b 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -777,15 +777,10 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
)
m_errorReporter.typeError(_variable.location(), "Variables cannot be declared in interfaces.");
- // Variables can be declared without type (with "var"), in which case the first assignment
- // sets the type.
- // Note that assignments before the first declaration are legal because of the special scoping
- // rules inherited from JavaScript.
-
// type is filled either by ReferencesResolver directly from the type name or by
// TypeChecker at the VariableDeclarationStatement level.
TypePointer varType = _variable.annotation().type;
- solAssert(!!varType, "Failed to infer variable type.");
+ solAssert(!!varType, "Variable type not provided.");
if (_variable.value())
expectType(*_variable.value(), *varType);
diff --git a/scripts/Dockerfile_alpine b/scripts/Dockerfile_alpine
new file mode 100644
index 00000000..21bba456
--- /dev/null
+++ b/scripts/Dockerfile_alpine
@@ -0,0 +1,5 @@
+FROM alpine
+MAINTAINER chriseth <chris@ethereum.org>
+
+COPY upload/solc-static-linux /usr/local/bin/solc
+ENTRYPOINT ["/usr/local/bin/solc"]
diff --git a/scripts/docker_build.sh b/scripts/docker_build.sh
index 22657a8c..9eedec34 100755
--- a/scripts/docker_build.sh
+++ b/scripts/docker_build.sh
@@ -2,7 +2,11 @@
set -e
+# Scratch image
docker build -t ethereum/solc:build -f scripts/Dockerfile .
tmp_container=$(docker create ethereum/solc:build sh)
mkdir -p upload
docker cp ${tmp_container}:/usr/bin/solc upload/solc-static-linux
+
+# Alpine image
+docker build -t ethereum/solc:build-alpine -f scripts/Dockerfile_alpine .
diff --git a/scripts/docker_deploy.sh b/scripts/docker_deploy.sh
index 00705725..36e918cf 100755
--- a/scripts/docker_deploy.sh
+++ b/scripts/docker_deploy.sh
@@ -2,20 +2,28 @@
set -e
+image="ethereum/solc"
+
+tag_and_push()
+{
+ docker tag "$image:$1" "$image:$2"
+ docker push "$image:$2"
+}
+
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
version=$($(dirname "$0")/get_version.sh)
if [ "$TRAVIS_BRANCH" = "develop" ]
then
- docker tag ethereum/solc:build ethereum/solc:nightly;
- docker tag ethereum/solc:build ethereum/solc:nightly-"$version"-"$TRAVIS_COMMIT"
- docker push ethereum/solc:nightly-"$version"-"$TRAVIS_COMMIT";
- docker push ethereum/solc:nightly;
+ tag_and_push build nightly
+ tag_and_push build nightly-"$version"-"$TRAVIS_COMMIT"
+ tag_and_push build-alpine nightly-alpine
+ tag_and_push build-alpine nightly-alpine-"$version"-"$TRAVIS_COMMIT"
elif [ "$TRAVIS_TAG" = v"$version" ]
then
- docker tag ethereum/solc:build ethereum/solc:stable;
- docker tag ethereum/solc:build ethereum/solc:"$version";
- docker push ethereum/solc:stable;
- docker push ethereum/solc:"$version";
+ tag_and_push build stable
+ tag_and_push build "$version"
+ tag_and_push build-alpine stable-alpine
+ tag_and_push build-alpine "$version"-alpine
else
echo "Not publishing docker image from branch $TRAVIS_BRANCH or tag $TRAVIS_TAG"
fi
diff --git a/scripts/docker_deploy_manual.sh b/scripts/docker_deploy_manual.sh
index c098f4ee..0393d22d 100755
--- a/scripts/docker_deploy_manual.sh
+++ b/scripts/docker_deploy_manual.sh
@@ -7,6 +7,7 @@ then
echo "Usage: $0 <tag/branch>"
exit 1
fi
+image="ethereum/solc"
branch="$1"
#docker login
@@ -27,21 +28,27 @@ else
date -u +"nightly.%Y.%-m.%-d" > prerelease.txt
fi
+tag_and_push()
+{
+ docker tag "$image:$1" "$image:$2"
+ docker push "$image:$2"
+}
+
rm -rf .git
-docker build -t ethereum/solc:build -f scripts/Dockerfile .
-tmp_container=$(docker create ethereum/solc:build sh)
+docker build -t "$image":build -f scripts/Dockerfile .
+tmp_container=$(docker create "$image":build sh)
if [ "$branch" = "develop" ]
then
- docker tag ethereum/solc:build ethereum/solc:nightly;
- docker tag ethereum/solc:build ethereum/solc:nightly-"$version"-"$commithash"
- docker push ethereum/solc:nightly-"$version"-"$commithash";
- docker push ethereum/solc:nightly;
+ tag_and_push build nightly
+ tag_and_push build nightly-"$version"-"$commithash"
+ tag_and_push build-alpine nightly-alpine
+ tag_and_push build-alpine nightly-alpine-"$version"-"$commithash"
elif [ "$branch" = v"$version" ]
then
- docker tag ethereum/solc:build ethereum/solc:stable;
- docker tag ethereum/solc:build ethereum/solc:"$version";
- docker push ethereum/solc:stable;
- docker push ethereum/solc:"$version";
+ tag_and_push build stable
+ tag_and_push build "$version"
+ tag_and_push build-alpine stable-alpine
+ tag_and_push build-alpine "$version"-alpine
else
echo "Not publishing docker image from branch or tag $branch"
fi
diff --git a/test/libsolidity/SMTCheckerJSONTest.cpp b/test/libsolidity/SMTCheckerJSONTest.cpp
index 6e1329a9..e9204cc4 100644
--- a/test/libsolidity/SMTCheckerJSONTest.cpp
+++ b/test/libsolidity/SMTCheckerJSONTest.cpp
@@ -38,11 +38,15 @@ using namespace boost::unit_test;
SMTCheckerTest::SMTCheckerTest(string const& _filename)
: SyntaxTest(_filename)
{
- BOOST_REQUIRE_MESSAGE(boost::algorithm::ends_with(_filename, ".sol"), "Invalid test contract file name: \"" + _filename + "\".");
+ if (!boost::algorithm::ends_with(_filename, ".sol"))
+ BOOST_THROW_EXCEPTION(runtime_error("Invalid test contract file name: \"" + _filename + "\"."));
string jsonFilename = _filename.substr(0, _filename.size() - 4) + ".json";
- BOOST_CHECK(jsonParseFile(jsonFilename, m_smtResponses));
- BOOST_CHECK(m_smtResponses.isObject());
+ if (
+ !jsonParseFile(jsonFilename, m_smtResponses) ||
+ !m_smtResponses.isObject()
+ )
+ BOOST_THROW_EXCEPTION(runtime_error("Invalid JSON file."));
}
bool SMTCheckerTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted)
@@ -59,42 +63,62 @@ bool SMTCheckerTest::run(ostream& _stream, string const& _linePrefix, bool const
// This is the list of responses provided in the test
string auxInput("auxiliaryInput");
- BOOST_CHECK(m_smtResponses.isMember(auxInput));
+ if (!m_smtResponses.isMember(auxInput))
+ BOOST_THROW_EXCEPTION(runtime_error("JSON file does not contain field \"auxiliaryInput\"."));
+
vector<string> inHashes = hashesFromJson(m_smtResponses, auxInput, "smtlib2responses");
// Ensure that the provided list matches the requested one
- BOOST_CHECK_MESSAGE(
- outHashes == inHashes,
- "SMT query hashes differ: " + boost::algorithm::join(outHashes, ", ") + " x " + boost::algorithm::join(inHashes, ", ")
- );
+ if (outHashes != inHashes)
+ BOOST_THROW_EXCEPTION(runtime_error(
+ "SMT query hashes differ: " +
+ boost::algorithm::join(outHashes, ", ") +
+ " x " +
+ boost::algorithm::join(inHashes, ", ")
+ ));
// Rerun the compiler with the provided hashed (2nd run)
input[auxInput] = m_smtResponses[auxInput];
Json::Value endResult = compiler.compile(input);
- BOOST_CHECK(endResult.isMember("errors"));
- Json::Value const& errors = endResult["errors"];
- for (auto const& error: errors)
+ if (endResult.isMember("errors") && endResult["errors"].isArray())
{
- BOOST_CHECK(error.isMember("type") && error["type"].isString());
- BOOST_CHECK(error.isMember("message") && error["message"].isString());
- if (!error.isMember("sourceLocation"))
- continue;
- Json::Value const& location = error["sourceLocation"];
- BOOST_CHECK(location.isMember("start") && location["start"].isInt());
- BOOST_CHECK(location.isMember("end") && location["end"].isInt());
- int start = location["start"].asInt();
- int end = location["end"].asInt();
- if (start >= static_cast<int>(versionPragma.size()))
- start -= versionPragma.size();
- if (end >= static_cast<int>(versionPragma.size()))
- end -= versionPragma.size();
- m_errorList.emplace_back(SyntaxTestError{
- error["type"].asString(),
- error["message"].asString(),
- start,
- end
- });
+ Json::Value const& errors = endResult["errors"];
+ for (auto const& error: errors)
+ {
+ if (
+ !error.isMember("type") ||
+ !error["type"].isString()
+ )
+ BOOST_THROW_EXCEPTION(runtime_error("Error must have a type."));
+ if (
+ !error.isMember("message") ||
+ !error["message"].isString()
+ )
+ BOOST_THROW_EXCEPTION(runtime_error("Error must have a message."));
+ if (!error.isMember("sourceLocation"))
+ continue;
+ Json::Value const& location = error["sourceLocation"];
+ if (
+ !location.isMember("start") ||
+ !location["start"].isInt() ||
+ !location.isMember("end") ||
+ !location["end"].isInt()
+ )
+ BOOST_THROW_EXCEPTION(runtime_error("Error must have a SourceLocation with start and end."));
+ int start = location["start"].asInt();
+ int end = location["end"].asInt();
+ if (start >= static_cast<int>(versionPragma.size()))
+ start -= versionPragma.size();
+ if (end >= static_cast<int>(versionPragma.size()))
+ end -= versionPragma.size();
+ m_errorList.emplace_back(SyntaxTestError{
+ error["type"].asString(),
+ error["message"].asString(),
+ start,
+ end
+ });
+ }
}
return printExpectationAndError(_stream, _linePrefix, _formatted);
@@ -123,6 +147,7 @@ Json::Value SMTCheckerTest::buildJson(string const& _extra)
string sources = " \"sources\": { " + sourceName + ": " + sourceObj + "}";
string input = "{" + language + ", " + sources + "}";
Json::Value source;
- BOOST_REQUIRE(jsonParse(input, source));
+ if (!jsonParse(input, source))
+ BOOST_THROW_EXCEPTION(runtime_error("Could not build JSON from string."));
return source;
}