Merge pull request #232 from faizkhan00/freezehash

Add per-commit testing
This commit is contained in:
Roman Mandeleil 2015-03-11 15:03:16 +02:00
commit 4d55f020dd
3 changed files with 39 additions and 30 deletions

View File

@ -31,6 +31,13 @@ public class JSONReader {
return json.isEmpty() ? getFromLocal(filename) : json;
}
public static String loadJSONFromCommit(String filename, String shacommit) {
String json = "";
if (!SystemProperties.CONFIG.vmTestLoadLocal())
json = getFromUrl("https://raw.githubusercontent.com/ethereum/tests/" + shacommit + "/" + filename);
return json.isEmpty() ? getFromLocal(filename) : json;
}
public static String getFromLocal(String filename) {
System.out.println("Loading local file: " + filename);
try {

View File

@ -15,10 +15,13 @@ import java.util.Set;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class GitHubStateTest {
//SHACOMMIT of tested commit, ethereum/tests.git
public String shacommit = "cfb120d1793dbb14404d9991f67cfb16bf573887";
@Ignore
@Test // this method is mostly for hands-on convenient testing
public void stSingleTest() throws ParseException {
String json = JSONReader.loadJSON("StateTests/stSystemOperationsTest.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stSystemOperationsTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json, "CallRecursiveBombLog2");
}
@ -28,14 +31,14 @@ public class GitHubStateTest {
Set<String> excluded = new HashSet<>();
excluded.add("CallRipemd160_5");
excluded.add("CallSha256_5");
String json = JSONReader.loadJSON("StateTests/stPreCompiledContracts.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stPreCompiledContracts.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);
}
@Test
public void stExample() throws ParseException { // [V]
String json = JSONReader.loadJSON("StateTests/stExample.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stExample.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json);
}
@ -43,14 +46,14 @@ public class GitHubStateTest {
public void stInitCodeTest() throws ParseException { // [V]
Set<String> excluded = new HashSet<>();
String json = JSONReader.loadJSON("StateTests/stInitCodeTest.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stInitCodeTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);
}
@Test
public void stLogTests() throws ParseException { // [V]
String json = JSONReader.loadJSON("StateTests/stLogTests.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stLogTests.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json);
}
@ -59,14 +62,14 @@ public class GitHubStateTest {
Set<String> excluded = new HashSet<>();
excluded.add("CallRipemd160_5");
excluded.add("CallSha256_5");
String json = JSONReader.loadJSON("StateTests/stPreCompiledContracts.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stPreCompiledContracts.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);
}
@Test
public void stRecursiveCreate() throws ParseException { // [V]
String json = JSONReader.loadJSON("StateTests/stRecursiveCreate.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stRecursiveCreate.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json);
}
@ -75,21 +78,21 @@ public class GitHubStateTest {
Set<String> excluded = new HashSet<>();
excluded.add("refund_CallA");
excluded.add("refund_CallA2");
String json = JSONReader.loadJSON("StateTests/stRefundTest.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stRefundTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);
}
@Test
public void stSpecialTest() throws ParseException { // [V]
String json = JSONReader.loadJSON("StateTests/stSpecialTest.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stSpecialTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json);
}
@Test
public void stBlockHashTest() throws ParseException {
String json = JSONReader.loadJSON("StateTests/stBlockHashTest.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stBlockHashTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json);
}
@ -98,7 +101,7 @@ public class GitHubStateTest {
public void stSystemOperationsTest() throws ParseException {
Set<String> excluded = new HashSet<>();
String json = JSONReader.loadJSON("StateTests/stSystemOperationsTest.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stSystemOperationsTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);
}
@ -114,7 +117,7 @@ public class GitHubStateTest {
excluded.add("SuicidesAndInternlCallSuicides");
excluded.add("SuicidesMixingCoinbase");
excluded.add("CreateTransactionReverted");
String json = JSONReader.loadJSON("StateTests/stTransactionTest.json");
String json = JSONReader.loadJSONFromCommit("StateTests/stTransactionTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);
}

View File

@ -14,17 +14,16 @@ import java.util.Set;
import static org.ethereum.jsontestsuite.JSONReader.getFileNamesForTreeSha;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class GitHubVMTest {
//SHACOMMIT of VMTESTS TREE (not main tree)
public String shacommit = "a713843af6e6274915bdbbc03d62dc5a0007548b";
public List<String> vmTestFiles = getFileNamesForTreeSha(shacommit);
//SHACOMMIT of tested commit, ethereum/tests.git
public String shacommit = "eecee75336681dc8c0b7a2423997178eb2101f4e";
//public List<String> vmTestFiles = getFileNamesForTreeSha(shacommit);
@Test
public void runSingle() throws ParseException {
String json = JSONReader.loadJSON("VMTests/vmEnvironmentalInfoTest.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmEnvironmentalInfoTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonVMTest(json, "extcodecopy0AddressTooBigRight");
}
@ -33,14 +32,15 @@ public class GitHubVMTest {
Set<String> excluded = new HashSet<>();
excluded.add("addmod1_overflowDiff");
excluded.add("addmod1_overflow3");
String json = JSONReader.getTestBlobForTreeSha(shacommit, "vmArithmeticTest.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmArithmeticTest.json", shacommit);
//String json = JSONReader.getTestBlobForTreeSha(shacommit, "vmArithmeticTest.json");
GitHubJSONTestSuite.runGitHubJsonVMTest(json, excluded);
}
@Test // testing full suite
public void testBitwiseLogicOperationFromGitHub() throws ParseException {
Set<String> excluded = new HashSet<>();
String json = JSONReader.loadJSON("VMTests/vmBitwiseLogicOperationTest.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmBitwiseLogicOperationTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonVMTest(json, excluded);
}
@ -48,7 +48,7 @@ public class GitHubVMTest {
@Test // testing full suite
public void testBlockInfoFromGitHub() throws ParseException {
Set<String> excluded = new HashSet<>();
String json = JSONReader.loadJSON("VMTests/vmBlockInfoTest.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmBlockInfoTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonVMTest(json, excluded);
}
@ -57,7 +57,7 @@ public class GitHubVMTest {
public void testEnvironmentalInfoFromGitHub() throws ParseException {
Set<String> excluded = new HashSet<>();
excluded.add("env1"); //Bug in test runner- this passes if VM logging is on "ALL"
String json = JSONReader.loadJSON("VMTests/vmEnvironmentalInfoTest.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmEnvironmentalInfoTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonVMTest(json, excluded);
}
@ -65,7 +65,7 @@ public class GitHubVMTest {
@Test // testing full suite
public void testIOandFlowOperationsFromGitHub() throws ParseException {
Set<String> excluded = new HashSet<>();
String json = JSONReader.loadJSON("VMTests/vmIOandFlowOperationsTest.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmIOandFlowOperationsTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonVMTest(json, excluded);
}
@ -73,44 +73,43 @@ public class GitHubVMTest {
@Test // testing random
public void testvmInputLimitsTest1FromGitHub() throws ParseException {
Set<String> excluded = new HashSet<>();
String json = JSONReader.loadJSON("VMTests/vmInputLimitsTest1.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmInputLimitsTest1.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonVMTest(json, excluded);
}
@Test // testing full suite
public void testVMLogGitHub() throws ParseException {
Set<String> excluded = new HashSet<>();
String json = JSONReader.loadJSON("VMTests/vmLogTest.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmLogTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonVMTest(json, excluded);
}
@Test // testing full suite
public void testPushDupSwapFromGitHub() throws ParseException {
Set<String> excluded = new HashSet<>();
String json = JSONReader.loadJSON("VMTests/vmPushDupSwapTest.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmPushDupSwapTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonVMTest(json, excluded);
}
@Test // testing full suite
public void testShaFromGitHub() throws ParseException {
Set<String> excluded = new HashSet<>();
String json = JSONReader.loadJSON("VMTests/vmSha3Test.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmSha3Test.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonVMTest(json, excluded);
}
@Test // testing full suite
public void testvmSystemOperationsTestGitHub() throws ParseException {
Set<String> excluded = new HashSet<>();
String json = JSONReader.loadJSON("VMTests/vmSystemOperationsTest.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmSystemOperationsTest.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonVMTest(json, excluded);
}
@Test // testing full suite
public void testVMGitHub() throws ParseException {
Set<String> excluded = new HashSet<>();
String json = JSONReader.loadJSON("VMTests/vmtests.json");
String json = JSONReader.loadJSONFromCommit("VMTests/vmtests.json", shacommit);
GitHubJSONTestSuite.runGitHubJsonVMTest(json, excluded);
}
@ -121,7 +120,7 @@ public class GitHubVMTest {
List<String> fileNames = getFileNamesForTreeSha(sha);
List<String> excludedFiles =
Arrays.asList(
"201501150842LARGE_DATA_IN_CALLCREATE_GOjson" //Badly named file
"201501150842LARGE_DATA_IN_CALLCREATE_GOjson" //Badly named file
);
for (String fileName : fileNames) {