2017-10-31 09:07:53 +01:00
|
|
|
import org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec
|
|
|
|
|
|
|
|
model {
|
|
|
|
components {
|
2018-09-28 16:31:45 +02:00
|
|
|
/*
|
2017-10-31 09:07:53 +01:00
|
|
|
withType(NativeComponentSpec) {
|
|
|
|
binaries.withType(NativeBinarySpec) {
|
|
|
|
if (buildType == buildTypes.debug) {
|
2018-09-28 16:31:45 +02:00
|
|
|
if (it instanceof NativeExecutableBinarySpec) {
|
2017-10-31 09:07:53 +01:00
|
|
|
executable.file = toLocalBin(appendDebugSuffix(executable.file), targetPlatform)
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
if (buildType == buildTypes.release) {
|
2018-09-28 16:31:45 +02:00
|
|
|
if (it instanceof NativeExecutableBinarySpec) {
|
2017-10-31 09:07:53 +01:00
|
|
|
executable.file = toLocalBin(executable.file, targetPlatform)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-09-28 16:31:45 +02:00
|
|
|
*/
|
2018-09-22 20:28:04 +02:00
|
|
|
TestLibrary(NativeLibrarySpec) {
|
2017-10-31 09:07:53 +01:00
|
|
|
sources {
|
|
|
|
cpp {
|
|
|
|
source {
|
|
|
|
srcDir 'src'
|
|
|
|
include 'TestLibrary.cpp'
|
|
|
|
include 'TestPlugin.cpp'
|
|
|
|
}
|
|
|
|
lib project: ':Foundation', library: 'Foundation', linkage: 'shared'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TestApp(NativeExecutableSpec) {
|
|
|
|
sources {
|
|
|
|
cpp {
|
|
|
|
source {
|
|
|
|
srcDir 'src'
|
|
|
|
include 'TestApp.cpp'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TestSuite(NativeLibrarySpec) {
|
|
|
|
sources {
|
|
|
|
cpp {
|
|
|
|
source {
|
|
|
|
srcDir 'src'
|
|
|
|
include '**/*.cpp'
|
|
|
|
exclude '*Driver.cpp'
|
|
|
|
exclude '*_WINCE.cpp'
|
|
|
|
exclude 'TestApp*.cpp'
|
|
|
|
}
|
|
|
|
exportedHeaders {
|
|
|
|
srcDir 'src'
|
|
|
|
}
|
|
|
|
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
|
|
|
|
lib project: ':Foundation', library: 'Foundation', linkage: 'shared'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
testSuites {
|
|
|
|
FoundationTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
|
2018-09-26 10:47:12 +02:00
|
|
|
testing $.components.TestSuite
|
2017-10-31 09:07:53 +01:00
|
|
|
}
|
|
|
|
}
|
2018-09-26 10:47:12 +02:00
|
|
|
binaries {
|
2017-10-31 09:07:53 +01:00
|
|
|
withType(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteBinarySpec) {
|
|
|
|
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
|
2018-09-22 20:28:04 +02:00
|
|
|
lib library: 'TestLibrary', linkage: 'shared'
|
|
|
|
|
2017-10-31 09:07:53 +01:00
|
|
|
if (toolChain in VisualCpp) {
|
|
|
|
if (buildType == buildTypes.debug) {
|
|
|
|
cCompiler.args "/MDd"
|
|
|
|
cppCompiler.args "/MDd"
|
|
|
|
} else
|
|
|
|
if (buildType == buildTypes.release) {
|
|
|
|
cCompiler.args "/MD"
|
|
|
|
cppCompiler.args "/MD"
|
|
|
|
} else {
|
|
|
|
throw new GradleException("Unknown buildType" + buildType)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (toolChain in Gcc) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task testsuite { dependsOn "assemble" }
|
|
|
|
|
2018-09-30 16:44:28 +02:00
|
|
|
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".replace('/','\\') + "\\bin;$PATH"
|
|
|
|
PATH = "$postgres32Home".replace('/','\\') + "\\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".replace('/','\\') + "\\bin;$PATH"
|
|
|
|
PATH = "$postgres64Home".replace('/','\\') + "\\bin;$PATH"
|
2017-10-31 09:07:53 +01:00
|
|
|
|
2018-09-30 16:44:28 +02:00
|
|
|
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"
|
|
|
|
|
|
|
|
println "testAppDir=" + testAppDir
|
|
|
|
|
2018-09-30 16:58:53 +02:00
|
|
|
PATH = testAppDir + ":$PATH"
|
2018-09-30 16:44:28 +02:00
|
|
|
environment "Path", "$PATH"
|
|
|
|
environment "POCO_BASE", "$rootDir"
|
|
|
|
|
|
|
|
args test
|
|
|
|
|
|
|
|
}
|