From 3e242f741a44780db137cf8e531c7b49c36af4c6 Mon Sep 17 00:00:00 2001 From: Francis ANDRE Date: Fri, 5 Oct 2018 15:31:16 +0200 Subject: [PATCH] Fix update PATH with the TestApp directoy for ProcessTest --- Crypto/testsuite/build.gradle | 13 +++++ Data/MySQL/testsuite/build.gradle | 11 ++++ Data/PostgreSQL/testsuite/build.gradle | 11 ++++ Foundation/testsuite/build.gradle | 75 +++++++------------------- build.gradle.win | 39 ++++++-------- 5 files changed, 70 insertions(+), 79 deletions(-) diff --git a/Crypto/testsuite/build.gradle b/Crypto/testsuite/build.gradle index d53ccbcbc..91c506221 100644 --- a/Crypto/testsuite/build.gradle +++ b/Crypto/testsuite/build.gradle @@ -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 { diff --git a/Data/MySQL/testsuite/build.gradle b/Data/MySQL/testsuite/build.gradle index fde70a829..fc985d72e 100644 --- a/Data/MySQL/testsuite/build.gradle +++ b/Data/MySQL/testsuite/build.gradle @@ -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 { diff --git a/Data/PostgreSQL/testsuite/build.gradle b/Data/PostgreSQL/testsuite/build.gradle index d1ae5b80f..9d5d0734b 100644 --- a/Data/PostgreSQL/testsuite/build.gradle +++ b/Data/PostgreSQL/testsuite/build.gradle @@ -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 { diff --git a/Foundation/testsuite/build.gradle b/Foundation/testsuite/build.gradle index bbebfb3f1..43c1db193 100644 --- a/Foundation/testsuite/build.gradle +++ b/Foundation/testsuite/build.gradle @@ -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 - } \ No newline at end of file diff --git a/build.gradle.win b/build.gradle.win index d12459720..f890f6ae9 100644 --- a/build.gradle.win +++ b/build.gradle.win @@ -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.testTimeSync'; CPPUNIT_IGNORE+=', class CppUnit::TestCaller.testEchoIPv4'; @@ -895,12 +891,9 @@ subprojects { environment "CPPUNIT_IGNORE", "\"$CPPUNIT_IGNORE\"" - environment "POCO_BASE", "$rootDir" - args test } } - tasks.withType(CppCompile) { maxParallelForks = 2 }