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

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
S. Matthew English 6 years ago committed by GitHub
parent 3a4014ddf7
commit 34c31aebb3
  1. 24
      ethereum/core/build.gradle

@ -91,26 +91,29 @@ test {
exclude 'tech/pegasys/pantheon/ethereum/core/TransactionTest.class' exclude 'tech/pegasys/pantheon/ethereum/core/TransactionTest.class'
} }
def generateTestFiles(FileTree jsonPath, File resourcesPath, File templateFile, String pathstrip, String destination, String namePrefix) { def generateTestFiles(FileTree jsonPath, File templateFile, String pathstrip, String destination, String namePrefix) {
def referenceTestTemplate = templateFile.text def referenceTestTemplate = templateFile.text
// This is how many json files to include in each test file // This is how many json files to include in each test file
def fileSets = jsonPath.getFiles().collate(5) def fileSets = jsonPath.getFiles().collate(5)
fileSets.eachWithIndex { fileSet, idx -> fileSets.eachWithIndex { fileSet, idx ->
def resPath = resourcesPath.getPath().replaceAll("\\\\", "/")
def paths = [] def paths = []
fileSet.each { testJsonFile -> fileSet.each { testJsonFile ->
if (!testJsonFile.getName().toString().startsWith(".")) { if (!testJsonFile.getName().toString().startsWith(".")) {
paths << testJsonFile.getPath().toString() String parentDirectory = testJsonFile.getParentFile().getName()
.replaceAll(resPath + "/", "") String testFile = testJsonFile.getName()
if(testJsonFile.getParentFile().getParentFile().getName() != pathstrip) {
paths << pathstrip + "/" + testJsonFile.getParentFile().getParentFile().getName() + "/" + parentDirectory + "/" + testFile
} else {
paths << pathstrip + "/" + parentDirectory + "/" + testFile
}
} }
} }
def testFile = file(destination + "/" + namePrefix + "_" + idx + ".java") def testFile = file(destination + "/" + namePrefix + "_" + idx + ".java")
def allPaths = '"' + paths.join('", "') + '"'; def allPaths = '"' + paths.join('", "') + '"'
def testFileContents = referenceTestTemplate def testFileContents = referenceTestTemplate
.replaceAll("%%TESTS_FILE%%", allPaths) .replaceAll("%%TESTS_FILE%%", allPaths)
@ -122,9 +125,8 @@ def generateTestFiles(FileTree jsonPath, File resourcesPath, File templateFile,
task blockchainReferenceTestsSetup { task blockchainReferenceTestsSetup {
generateTestFiles( generateTestFiles(
fileTree('../referencetests/src/test/resources/BlockchainTests'), fileTree('../referencetests/src/test/resources/BlockchainTests'),
file("../referencetests/src/test/resources"),
file("./src/test/resources/tech/pegasys/pantheon/ethereum/vm/BlockchainReferenceTest.java.template"), file("./src/test/resources/tech/pegasys/pantheon/ethereum/vm/BlockchainReferenceTest.java.template"),
"BlockchainTests/", "BlockchainTests",
"./src/test/java/tech/pegasys/pantheon/ethereum/vm/blockchain", "./src/test/java/tech/pegasys/pantheon/ethereum/vm/blockchain",
"BlockchainReferenceTest" "BlockchainReferenceTest"
) )
@ -133,9 +135,8 @@ task blockchainReferenceTestsSetup {
task generalstateReferenceTestsSetup { task generalstateReferenceTestsSetup {
generateTestFiles( generateTestFiles(
fileTree("../referencetests/src/test/resources/GeneralStateTests"), fileTree("../referencetests/src/test/resources/GeneralStateTests"),
file("../referencetests/src/test/resources"),
file("./src/test/resources/tech/pegasys/pantheon/ethereum/vm/GeneralStateReferenceTest.java.template"), file("./src/test/resources/tech/pegasys/pantheon/ethereum/vm/GeneralStateReferenceTest.java.template"),
"GeneralStateTests/", "GeneralStateTests",
"./src/test/java/tech/pegasys/pantheon/ethereum/vm/generalstate", "./src/test/java/tech/pegasys/pantheon/ethereum/vm/generalstate",
"GeneralStateReferenceTest" "GeneralStateReferenceTest"
) )
@ -144,9 +145,8 @@ task generalstateReferenceTestsSetup {
task generalstateRegressionReferenceTestsSetup { task generalstateRegressionReferenceTestsSetup {
generateTestFiles( generateTestFiles(
fileTree("./src/test/resources/regressions/generalstate"), fileTree("./src/test/resources/regressions/generalstate"),
file("./src/test/resources"),
file("./src/test/resources/tech/pegasys/pantheon/ethereum/vm/GeneralStateReferenceTest.java.template"), file("./src/test/resources/tech/pegasys/pantheon/ethereum/vm/GeneralStateReferenceTest.java.template"),
"regressions/generalstate/", "regressions",
"./src/test/java/tech/pegasys/pantheon/ethereum/vm/generalstate", "./src/test/java/tech/pegasys/pantheon/ethereum/vm/generalstate",
"GeneralStateRegressionReferenceTest" "GeneralStateRegressionReferenceTest"
) )

Loading…
Cancel
Save