[NC-1615] Report reference tests that have been blacklisted rather than skipping them silently (#63)

Adrian Sutton 6 years ago committed by GitHub
parent 2b098f5840
commit 2b19129bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/core/TransactionTest.java
  2. 4
      ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/vm/BlockchainReferenceTestTools.java
  3. 8
      ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/vm/GeneralStateReferenceTestTools.java
  4. 5
      ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/vm/VMReferenceTest.java
  5. 6
      ethereum/core/src/test/resources/tech/pegasys/pantheon/ethereum/vm/BlockchainReferenceTest.java.template
  6. 6
      ethereum/core/src/test/resources/tech/pegasys/pantheon/ethereum/vm/GeneralStateReferenceTest.java.template
  7. 6
      ethereum/rlp/src/test/java/tech/pegasys/pantheon/ethereum/rlp/InvalidRLPRefTest.java
  8. 4
      ethereum/rlp/src/test/java/tech/pegasys/pantheon/ethereum/rlp/RLPRefTest.java
  9. 4
      ethereum/trie/src/test/java/tech/pegasys/pantheon/ethereum/trie/TrieRefTest.java
  10. 12
      testutil/src/main/java/tech/pegasys/pantheon/testutil/JsonTestParameters.java

@ -1,5 +1,7 @@
package tech.pegasys.pantheon.ethereum.core; package tech.pegasys.pantheon.ethereum.core;
import static org.junit.Assume.assumeTrue;
import tech.pegasys.pantheon.ethereum.mainnet.TransactionValidator; import tech.pegasys.pantheon.ethereum.mainnet.TransactionValidator;
import tech.pegasys.pantheon.ethereum.rlp.RLP; import tech.pegasys.pantheon.ethereum.rlp.RLP;
import tech.pegasys.pantheon.ethereum.vm.ReferenceTestProtocolSchedules; import tech.pegasys.pantheon.ethereum.vm.ReferenceTestProtocolSchedules;
@ -39,12 +41,14 @@ public class TransactionTest {
"TransactionWithGasLimitOverflow(2|63)", "TransactionWithGasLimitxPriceOverflow$") "TransactionWithGasLimitOverflow(2|63)", "TransactionWithGasLimitxPriceOverflow$")
// Nonce is tracked with type long, large valued nonces can't currently be decoded // Nonce is tracked with type long, large valued nonces can't currently be decoded
.blacklist("TransactionWithHighNonce256") .blacklist("TransactionWithHighNonce256")
.generator((name, spec, collector) -> collector.add(name, spec)) .generator((name, spec, collector) -> collector.add(name, spec, true))
.generate(TEST_CONFIG_FILE_DIR_PATH); .generate(TEST_CONFIG_FILE_DIR_PATH);
} }
public TransactionTest(final String name, final TransactionTestCaseSpec spec) { public TransactionTest(
final String name, final TransactionTestCaseSpec spec, final boolean runTest) {
this.spec = spec; this.spec = spec;
assumeTrue("Test was blacklisted", runTest);
} }
@Test @Test

@ -40,9 +40,7 @@ public class BlockchainReferenceTestTools {
.generator( .generator(
(testName, spec, collector) -> { (testName, spec, collector) -> {
final String eip = spec.getNetwork(); final String eip = spec.getNetwork();
if (NETWORKS_TO_RUN.contains(eip)) { collector.add(testName + "[" + eip + "]", spec, NETWORKS_TO_RUN.contains(eip));
collector.add(testName + "[" + eip + "]", spec);
}
}); });
static { static {

@ -47,15 +47,13 @@ public class GeneralStateReferenceTestTools {
for (final Map.Entry<String, List<GeneralStateTestCaseEipSpec>> entry : for (final Map.Entry<String, List<GeneralStateTestCaseEipSpec>> entry :
stateSpec.finalStateSpecs().entrySet()) { stateSpec.finalStateSpecs().entrySet()) {
final String eip = entry.getKey(); final String eip = entry.getKey();
if (!EIPS_TO_RUN.contains(eip)) { final boolean runTest = EIPS_TO_RUN.contains(eip);
continue;
}
final List<GeneralStateTestCaseEipSpec> eipSpecs = entry.getValue(); final List<GeneralStateTestCaseEipSpec> eipSpecs = entry.getValue();
if (eipSpecs.size() == 1) { if (eipSpecs.size() == 1) {
collector.add(prefix + eip, eipSpecs.get(0)); collector.add(prefix + eip, eipSpecs.get(0), runTest);
} else { } else {
for (int i = 0; i < eipSpecs.size(); i++) { for (int i = 0; i < eipSpecs.size(); i++) {
collector.add(prefix + eip + '[' + i + ']', eipSpecs.get(i)); collector.add(prefix + eip + '[' + i + ']', eipSpecs.get(i), runTest);
} }
} }
} }

@ -3,6 +3,7 @@ package tech.pegasys.pantheon.ethereum.vm;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
import static tech.pegasys.pantheon.ethereum.vm.OperationTracer.NO_TRACING; import static tech.pegasys.pantheon.ethereum.vm.OperationTracer.NO_TRACING;
import tech.pegasys.pantheon.ethereum.core.Gas; import tech.pegasys.pantheon.ethereum.core.Gas;
@ -88,9 +89,11 @@ public class VMReferenceTest extends AbstractRetryingTest {
.generate(TEST_CONFIG_FILE_DIR_PATHS); .generate(TEST_CONFIG_FILE_DIR_PATHS);
} }
public VMReferenceTest(final String name, final VMReferenceTestCaseSpec spec) { public VMReferenceTest(
final String name, final VMReferenceTestCaseSpec spec, final boolean runTest) {
this.name = name; this.name = name;
this.spec = spec; this.spec = spec;
assumeTrue("Test was blacklisted", runTest);
} }
@Override @Override

@ -12,6 +12,8 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.Parameters;
import static org.junit.Assume.assumeTrue;
/** The blockchain test operation testing framework entry point. */ /** The blockchain test operation testing framework entry point. */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class %%TESTS_NAME%% { public class %%TESTS_NAME%% {
@ -28,9 +30,11 @@ public class %%TESTS_NAME%% {
public %%TESTS_NAME%%( public %%TESTS_NAME%%(
final String name, final String name,
final BlockchainReferenceTestCaseSpec spec) { final BlockchainReferenceTestCaseSpec spec,
final boolean runTest) {
this.name = name; this.name = name;
this.spec = spec; this.spec = spec;
assumeTrue("Test was blacklisted", runTest);
} }
@Test @Test

@ -12,6 +12,8 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.Parameters;
import static org.junit.Assume.assumeTrue;
/** The general state test operation testing framework entry point. */ /** The general state test operation testing framework entry point. */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class %%TESTS_NAME%% { public class %%TESTS_NAME%% {
@ -28,9 +30,11 @@ public class %%TESTS_NAME%% {
public %%TESTS_NAME%%( public %%TESTS_NAME%%(
final String name, final String name,
final GeneralStateTestCaseEipSpec spec) { final GeneralStateTestCaseEipSpec spec,
final boolean runTest) {
this.name = name; this.name = name;
this.spec = spec; this.spec = spec;
assumeTrue("Test was blacklisted", runTest);
} }
@Test @Test

@ -1,5 +1,7 @@
package tech.pegasys.pantheon.ethereum.rlp; package tech.pegasys.pantheon.ethereum.rlp;
import static org.junit.Assume.assumeTrue;
import tech.pegasys.pantheon.testutil.JsonTestParameters; import tech.pegasys.pantheon.testutil.JsonTestParameters;
import java.util.Collection; import java.util.Collection;
@ -20,8 +22,10 @@ public class InvalidRLPRefTest {
private final InvalidRLPRefTestCaseSpec spec; private final InvalidRLPRefTestCaseSpec spec;
public InvalidRLPRefTest(final String name, final InvalidRLPRefTestCaseSpec spec) { public InvalidRLPRefTest(
final String name, final InvalidRLPRefTestCaseSpec spec, final boolean runTest) {
this.spec = spec; this.spec = spec;
assumeTrue("Test was blacklisted", runTest);
} }
@Parameters(name = "Name: {0}") @Parameters(name = "Name: {0}")

@ -1,6 +1,7 @@
package tech.pegasys.pantheon.ethereum.rlp; package tech.pegasys.pantheon.ethereum.rlp;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
import tech.pegasys.pantheon.testutil.JsonTestParameters; import tech.pegasys.pantheon.testutil.JsonTestParameters;
@ -19,8 +20,9 @@ public class RLPRefTest {
private final RLPRefTestCaseSpec spec; private final RLPRefTestCaseSpec spec;
public RLPRefTest(final String name, final RLPRefTestCaseSpec spec) { public RLPRefTest(final String name, final RLPRefTestCaseSpec spec, final boolean runTest) {
this.spec = spec; this.spec = spec;
assumeTrue("Test was blacklisted", runTest);
} }
@Parameters(name = "Name: {0}") @Parameters(name = "Name: {0}")

@ -1,6 +1,7 @@
package tech.pegasys.pantheon.ethereum.trie; package tech.pegasys.pantheon.ethereum.trie;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;
import tech.pegasys.pantheon.testutil.JsonTestParameters; import tech.pegasys.pantheon.testutil.JsonTestParameters;
import tech.pegasys.pantheon.util.bytes.BytesValue; import tech.pegasys.pantheon.util.bytes.BytesValue;
@ -20,8 +21,9 @@ public class TrieRefTest {
private final TrieRefTestCaseSpec spec; private final TrieRefTestCaseSpec spec;
public TrieRefTest(final String name, final TrieRefTestCaseSpec spec) { public TrieRefTest(final String name, final TrieRefTestCaseSpec spec, final boolean runTest) {
this.spec = spec; this.spec = spec;
assumeTrue("Test was blacklisted", runTest);
} }
@Parameters(name = "Name: {0}") @Parameters(name = "Name: {0}")

@ -50,10 +50,8 @@ public class JsonTestParameters<S, T> {
// memory when we run a single test, but it's not the case we're trying to optimize. // memory when we run a single test, but it's not the case we're trying to optimize.
private final List<Object[]> testParameters = new ArrayList<>(256); private final List<Object[]> testParameters = new ArrayList<>(256);
public void add(final String name, final S value) { public void add(final String name, final S value, final boolean runTest) {
if (includes(name)) { testParameters.add(new Object[] {name, value, runTest && includes(name)});
testParameters.add(new Object[] {name, value});
}
} }
private boolean includes(final String name) { private boolean includes(final String name) {
@ -104,7 +102,7 @@ public class JsonTestParameters<S, T> {
public static <T> JsonTestParameters<T, T> create(final Class<T> testCaseSpec) { public static <T> JsonTestParameters<T, T> create(final Class<T> testCaseSpec) {
return new JsonTestParameters<>(testCaseSpec, testCaseSpec) return new JsonTestParameters<>(testCaseSpec, testCaseSpec)
.generator((name, testCase, collector) -> collector.add(name, testCase)); .generator((name, testCase, collector) -> collector.add(name, testCase, true));
} }
public static <S, T> JsonTestParameters<S, T> create( public static <S, T> JsonTestParameters<S, T> create(
@ -187,13 +185,13 @@ public class JsonTestParameters<S, T> {
for (final String path : paths) { for (final String path : paths) {
final URL url = classLoader.getResource(path); final URL url = classLoader.getResource(path);
checkState(url != null, "Cannot find test directory " + path); checkState(url != null, "Cannot find test directory " + path);
Path dir; final Path dir;
try { try {
dir = Paths.get(url.toURI()); dir = Paths.get(url.toURI());
} catch (final URISyntaxException e) { } catch (final URISyntaxException e) {
throw new RuntimeException("Problem converting URL to URI " + url, e); throw new RuntimeException("Problem converting URL to URI " + url, e);
} }
try (Stream<Path> s = Files.walk(dir)) { try (final Stream<Path> s = Files.walk(dir)) {
s.map(Path::toFile) s.map(Path::toFile)
.filter(f -> f.getPath().endsWith(".json")) .filter(f -> f.getPath().endsWith(".json"))
.filter(f -> !fileExcludes.contains(f.getName())) .filter(f -> !fileExcludes.contains(f.getName()))

Loading…
Cancel
Save