Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PAN-2586] Reference tests fail on Windows #1401

Merged
merged 5 commits into from
May 6, 2019

Conversation

smatthewenglish
Copy link
Contributor

@smatthewenglish smatthewenglish commented May 4, 2019

PR description

Resolves path issues with running on Windows.

At the moment it seems we aren't evaluating VMTests, TrieTests, or TransitionTests -- why is that?

Fixed Issue(s)

enter image description here

String testFile = testJsonFile.getName()
if(pathstrip == "BlockchainTests/"){
String generalStateTests = "GeneralStateTests/"
if(testJsonFile.getParentFile().getParentFile().getName().toString() == generalStateTests){
Copy link
Contributor

@shemnon shemnon May 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition will never fire. The name of the parent file will never end in a path separator ("/"). You need to test for "GeneralStateTests" and then concat "GeneralStateTests/"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch. thanks. this was a result of my overzealous beautification, I've reimplemented your proposed changes and run it again on windows to ensure that it's got the right test coverage

paths << pathstrip + generalStateTests + "/" + parentDirectory + testFile
}
String transitionTests = "TransitionTests"
if(testJsonFile.getParentFile().getParentFile().getName().toString() == transitionTests){
Copy link
Contributor

@shemnon shemnon May 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we are losing all tests that are not TransitionTests or GeneralStateTests, such as bcInvalidHeaderTest. Instead of doing a one-off for each test directory can these two if blocks be made to work for any parent name? maybe -

paths << parentstrip + testJsonFile?.parentFile?.parentFile?.name + "/" + parentDirectory + testFile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why you would say that, but that's not how it works -- Transition and General State are themselves subdirectories of Blockchain Test - both of which contain still other directories, the only ones like that, so if the test came from one of those two folders we need to add that to the path. You'll see what I mean if you check out the project structure there

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked out the project structure, which is why I know this PR results in us not running all the tests.

Check out tech.pegasys.pantheon.ethereum.vm.blockchain.BlockchainReferenceTest_0 line 21 used to read

  private static final String[] TEST_CONFIG_FILE_DIR_PATH = new String[] {"BlockchainTests/bcForgedTest/bcForkBlockTest.json", "BlockchainTests/bcForgedTest/bcForkUncle.json", "BlockchainTests/bcForgedTest/bcInvalidRLPTest.json", "BlockchainTests/bcMultiChainTest/CallContractFromNotBestBlock.json", "BlockchainTests/bcMultiChainTest/UncleFromSideChain.json"};

It now reads

  private static final String[] TEST_CONFIG_FILE_DIR_PATH = new String[] {""};

We are missing many subdirectories: bcBlockGasLimitTest, bcExploitTest, and 12 others. i.e. too many to reasonable enumerate with if blocks like this. Plus, if a new directories were to be added we would miss them if we only take enumerated directories. We should continue to take all the subdirectories of BlockchainTest as discovered and not as enumerated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look in the directory BlockchainTests/, there are only two subdirectories that contain directories themselves as opposed to -- just a bunch of tests.

Those directories are pantheon/ethereum/referencetests/src/test/resources/BlockchainTests/GeneralStateTests and pantheon/ethereum/referencetests/src/test/resources/BlockchainTests/TransitionTests.

You mentioned bcBlockGasLimitTest , see here:

enter image description here

it follows the pattern paths << pathstrip + "/" + parentDirectory + "/" + testFile

However, if you look here:

enter image description here

we see the pattern paths << pathstrip + "/" + testJsonFile.getParentFile().getParentFile().getName() + "/" + parentDirectory + "/" + testFile, for tests inside of subdirectories of pantheon/ethereum/referencetests/src/test/resources/BlockchainTests/GeneralStateTests.


The point about not hardcoding those two directories is valid, I've updated the pr to be more dynamic.

@smatthewenglish
Copy link
Contributor Author

enter image description here

confirmed that latest update passes on windows

Copy link
Contributor

@AbdelStark AbdelStark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@smatthewenglish smatthewenglish merged commit 2d467dd into PegaSysEng:master May 6, 2019
notlesh pushed a commit to notlesh/pantheon that referenced this pull request May 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants