Fix update PATH with the TestApp directoy for ProcessTest

This commit is contained in:
Francis ANDRE 2018-10-05 15:31:16 +02:00
parent 4cd077101b
commit 3e242f741a
5 changed files with 70 additions and 79 deletions

View File

@ -39,6 +39,19 @@ model {
testSuites {
CryptoTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
testing $.components.TestSuite
/*
binaries.all {
String PATH = tasks.run.environment.get("Path")
if (targetPlatform.name.equals("win32")) {
PATH = "$rootDir/openssl/build/win32/bin/release;$PATH"
PATH = "$rootDir/openssl/build/win32/bin/debug;$PATH"
} else
if (targetPlatform.name.equals("win64")) {
PATH = "$rootDir/openssl/build/win64/bin/release;$PATH"
PATH = "$rootDir/openssl/build/win64/bin/debug;$PATH"
}
tasks.run.environment "Path", PATH
*/ }
}
}
binaries {

View File

@ -42,6 +42,17 @@ model {
testSuites {
MySQLTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
testing $.components.TestSuite
binaries.all {
String PATH = tasks.run.environment.get("Path")
if (targetPlatform.name.equals("win32")) {
PATH = "$mysql32Home" + "/bin;$PATH"
} else
if (targetPlatform.name.equals("win64")) {
PATH = "$mysql64Home" + "/bin;$PATH"
}
tasks.run.environment "Path", PATH
}
}
}
binaries {

View File

@ -43,6 +43,17 @@ model {
testSuites {
PostgreSQLTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
testing $.components.TestSuite
binaries.all {
String PATH = tasks.run.environment.get("Path")
if (targetPlatform.name.equals("win32")) {
PATH = "$postgres32Home" + "/bin;$PATH"
} else
if (targetPlatform.name.equals("win64")) {
PATH = "$postgres64Home" + "/bin;$PATH"
}
tasks.run.environment "Path", PATH
}
}
}
binaries {

View File

@ -62,12 +62,27 @@ model {
testSuites {
FoundationTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
testing $.components.TestSuite
binaries.all {
binaries.all {
println "Task ${tasks.run.name} is associated with platform ${targetPlatform.name}"
String PATH = System.getenv("PATH")
String PATH = tasks.run.environment.get("Path")
String testAppDir = project.buildDir
println "FoundationTestSuite:testAppDir=" + testAppDir
}
testAppDir += "/exe" + "/testApp"
testAppDir += "/" + targetPlatform.name
if (buildType == buildTypes.debug)
testAppDir += "/debug"
else
if (buildType == buildTypes.release)
testAppDir += "/release"
if (targetPlatform.name.startsWith("win"))
testAppDir = testAppDir.replace('/', '\\')
PATH = testAppDir + File.pathSeparator + PATH
tasks.run.environment "Path", PATH
}
}
}
binaries {
@ -95,58 +110,6 @@ model {
task testsuite { dependsOn "assemble" }
tasks.withType(RunTestExecutable) {
String PATH = System.getenv("PATH")
String testAppDir = project.buildDir
if (name.contains('Win32')) {
testAppDir += "/exe" + "/testApp"
PATH = "$rootDir/bin;$PATH"
PATH = "$rootDir/openssl/build/win32/bin/release;$PATH"
PATH = "$rootDir/openssl/build/win32/bin/debug;$PATH"
PATH = "$mysql32Home" + "/bin;$PATH"
PATH = "$postgres32Home" + "/bin;$PATH"
testAppDir += "/win32"
} else
if (name.contains('Win64')) {
testAppDir += "/exe" + "/testApp"
PATH = "$rootDir/bin64;$PATH"
PATH = "$rootDir/openssl/build/win64/bin/release;$PATH"
PATH = "$rootDir/openssl/build/win64/bin/debug;$PATH"
PATH = "$mysql64Home" + "/bin;$PATH"
PATH = "$postgres64Home" + "/bin;$PATH"
testAppDir += "/win64"
} else
if (name.contains('Linux32')) {
testAppDir += "/exe" + "/testApp"
testAppDir += "/linux32"
} else
if (name.contains('Linux64')) {
testAppDir += "/exe" + "/testApp"
testAppDir += "/linux64"
} else
if (name.contains('MacOsx')) {
testAppDir += "/exe" + "/testApp"
}
if (name.contains("Debug"))
testAppDir += "/debug"
else
if (name.contains("Release"))
testAppDir += "/release"
if (name.contains('Win'))
testAppDir = testAppDir.replace('/', '\\')
println "testAppDir=" + testAppDir
PATH = testAppDir + File.pathSeparator + "$PATH"
environment "Path", "$PATH"
environment "POCO_BASE", "$rootDir"
args test
}

View File

@ -860,29 +860,25 @@ subprojects {
if (toolChain in Gcc) {
}
}
withType(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteBinarySpec) {
tasks.run.environment "POCO_BASE", "$rootDir"
String PATH = tasks.run.environment.get("Path")
if (targetPlatform.name.equals("win32")) {
PATH = "$rootDir/bin;$PATH"
} else
if (targetPlatform.name.equals("win64")) {
PATH = "$rootDir/bin64;$PATH"
}
if (targetPlatform.name.startsWith("win"))
PATH = PATH.replace('/', '\\')
tasks.run.environment "Path", PATH
}
}
}
tasks.withType(RunTestExecutable) {
String PATH = System.getenv("PATH")
String name = getName();
if (name.contains('Win32')) {
PATH = "$rootDir\\bin;$PATH"
PATH = "$rootDir\\openssl\\build\\win32\\bin\\release;$PATH"
PATH = "$rootDir\\openssl\\build\\win32\\bin\\debug;$PATH"
PATH = "$mysql32Home".replace('/','\\') + "\\bin;$PATH"
PATH = "$postgres32Home".replace('/','\\') + "\\bin;$PATH"
} else
if (name.contains('Win64')) {
PATH = "$rootDir\\bin64;$PATH"
PATH = "$rootDir\\openssl\\build\\win64\\bin\\release;$PATH"
PATH = "$rootDir\\openssl\\build\\win64\\bin\\debug;$PATH"
PATH = "$mysql64Home".replace('/','\\') + "\\bin;$PATH"
PATH = "$postgres64Home".replace('/','\\') + "\\bin;$PATH"
}
environment "Path", "$PATH"
String CPPUNIT_IGNORE;
CPPUNIT_IGNORE = 'class CppUnit::TestCaller<class NTPClientTest>.testTimeSync';
CPPUNIT_IGNORE+=', class CppUnit::TestCaller<class RawSocketTest>.testEchoIPv4';
@ -895,12 +891,9 @@ subprojects {
environment "CPPUNIT_IGNORE", "\"$CPPUNIT_IGNORE\""
environment "POCO_BASE", "$rootDir"
args test
}
}
tasks.withType(CppCompile) {
maxParallelForks = 2
}