aboutsummaryrefslogtreecommitdiffstats
path: root/test/tools
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-08-04 01:30:18 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-08-04 02:35:50 +0800
commitd923926ff7ceaad551fe76afb356266e28a2a1ea (patch)
treed29538c748e463ad4f93441fa5b77f870530a5d6 /test/tools
parent0b20e4fd22349da691056f3a4ac89c7c5006a0c4 (diff)
downloaddexon-solidity-d923926ff7ceaad551fe76afb356266e28a2a1ea.tar.gz
dexon-solidity-d923926ff7ceaad551fe76afb356266e28a2a1ea.tar.zst
dexon-solidity-d923926ff7ceaad551fe76afb356266e28a2a1ea.zip
Infrastructure for extracting JSON AST tests.
Diffstat (limited to 'test/tools')
-rw-r--r--test/tools/CMakeLists.txt2
-rw-r--r--test/tools/isoltest.cpp38
2 files changed, 36 insertions, 4 deletions
diff --git a/test/tools/CMakeLists.txt b/test/tools/CMakeLists.txt
index 257b4f24..d6df0ac8 100644
--- a/test/tools/CMakeLists.txt
+++ b/test/tools/CMakeLists.txt
@@ -3,5 +3,5 @@ target_link_libraries(solfuzzer PRIVATE libsolc evmasm ${Boost_PROGRAM_OPTIONS_L
add_executable(isoltest isoltest.cpp ../Options.cpp ../libsolidity/TestCase.cpp ../libsolidity/SyntaxTest.cpp
../libsolidity/AnalysisFramework.cpp ../libsolidity/SolidityExecutionFramework.cpp ../ExecutionFramework.cpp
- ../RPCSession.cpp)
+ ../RPCSession.cpp ../libsolidity/ASTJSONTest.cpp)
target_link_libraries(isoltest PRIVATE libsolc solidity evmasm ${Boost_PROGRAM_OPTIONS_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp
index bd4b0db9..7d15b07a 100644
--- a/test/tools/isoltest.cpp
+++ b/test/tools/isoltest.cpp
@@ -18,6 +18,7 @@
#include <libdevcore/CommonIO.h>
#include <test/libsolidity/AnalysisFramework.h>
#include <test/libsolidity/SyntaxTest.h>
+#include <test/libsolidity/ASTJSONTest.h>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/replace.hpp>
@@ -336,22 +337,53 @@ Allowed options)",
}
}
+ TestStats global_stats { 0, 0 };
+
fs::path syntaxTestPath = testPath / "libsolidity" / "syntaxTests";
if (fs::exists(syntaxTestPath) && fs::is_directory(syntaxTestPath))
{
auto stats = TestTool::processPath(SyntaxTest::create, testPath / "libsolidity", "syntaxTests", formatted);
- cout << endl << "Summary: ";
+ cout << endl << "Syntax Test Summary: ";
FormattedScope(cout, formatted, {BOLD, stats ? GREEN : RED}) <<
stats.successCount << "/" << stats.runCount;
- cout << " tests successful." << endl;
+ cout << " tests successful." << endl << endl;
- return stats ? 0 : 1;
+ global_stats.runCount += stats.runCount;
+ global_stats.successCount += stats.successCount;
}
else
{
cerr << "Syntax tests not found. Use the --testpath argument." << endl;
return 1;
}
+
+ fs::path astJsonTestPath = testPath / "libsolidity" / "ASTJSON";
+
+ if (fs::exists(astJsonTestPath) && fs::is_directory(astJsonTestPath))
+ {
+ auto stats = TestTool::processPath(ASTJSONTest::create, testPath / "libsolidity", "ASTJSON", formatted);
+
+ cout << endl << "JSON AST Test Summary: ";
+ FormattedScope(cout, formatted, {BOLD, stats ? GREEN : RED}) <<
+ stats.successCount << "/" << stats.runCount;
+ cout << " tests successful." << endl << endl;
+
+ global_stats.runCount += stats.runCount;
+ global_stats.successCount += stats.successCount;
+ }
+ else
+ {
+ cerr << "JSON AST tests not found." << endl;
+ return 1;
+ }
+
+ cout << endl << "Summary: ";
+ FormattedScope(cout, formatted, {BOLD, global_stats ? GREEN : RED}) <<
+ global_stats.successCount << "/" << global_stats.runCount;
+ cout << " tests successful." << endl;
+
+
+ return global_stats ? 0 : 1;
}