cavis/createTestBackends.gradle

112 lines
4.6 KiB
Groovy

/*
*
* ******************************************************************************
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * See the NOTICE file distributed with this work for additional
* * information regarding copyright ownership.
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*
*/
ext {
buildTarget = rootProject.ext.buildTarget
apply from: new File("${project.rootProject.projectDir}/chooseBackend.gradle")
chipList.each { thisChip ->
configurations.register("${thisChip}TestImplementation") {
it.extendsFrom configurations.testImplementation //, configurations.implementation
}
configurations.register("${thisChip}TestRuntime") {
if(configurations.find {Configuration c -> c.name == "api"}) {
it.extendsFrom configurations.api, configurations.testRuntimeOnly, configurations.implementation, configurations.testImplementation
} else {
it.extendsFrom configurations.testRuntimeOnly, configurations.implementation,configurations.testImplementation
}
}
tasks.register("${thisChip}Test", Test) {
it.testClassesDirs = sourceSets.test.output.classesDirs
it.classpath = configurations.getByName("${thisChip}TestRuntime")
it.classpath += sourceSets.test.output.classesDirs
it.classpath += sourceSets.main.output.classesDirs
it.ignoreFailures = true
it.testLogging {
events "PASSED", "SKIPPED", "FAILED", "STANDARD_OUT", "STANDARD_ERROR"
}
it.useJUnitPlatform {
if( project.hasProperty("includeTags") ) {
it.includeTags=project.getProperty("includeTags").split(",")
}
if( project.hasProperty("excludeTags") ) {
it.excludeTags=project.getProperty("excludeTags").split(",")
}
}
ignoreFailures = true
testLogging {
events "PASSED", "SKIPPED", "FAILED", "STANDARD_OUT", "STANDARD_ERROR"
}
// it.debug = true
it.enabled = true
it.minHeapSize = "1024m" // initial heap size
it.maxHeapSize = "4096m" // maximum heap size
//it.jvmArgs '-XX:MaxPermSize=256m' // mem argument for the test JVM
}
tasks.test.dependsOn "${thisChip}Test"
}
test {
enabled = false
}
dependencies {
//testRuntime projects.cavisNative.cavisNativeLib
if (withCuda()) {
cudaTestRuntime platform(projects.cavisCommonPlatform)
cudaTestRuntime projects.cavisNative.cavisNativeJcublas
cudaTestRuntime projects.cavisDnn.cavisDnnCudnn
cudaTestRuntime group: "org.bytedeco", name: "openblas"
cudaTestRuntime group: "org.bytedeco", name: "openblas", classifier: buildTarget
cudaTestRuntime group: "org.bytedeco", name: "cuda"
cudaTestRuntime group: "org.bytedeco", name: "cuda", classifier: buildTarget
cudaTestRuntime(project(":cavis-native:cavis-native-lib")) {
capabilities {
it.requireCapabilities "net.brutex.cavis.cavis-native:cavis-native-lib-cuda-support:${project.version}"
}
}
}
if (withCpu()) {
cpuTestRuntime platform(projects.cavisCommonPlatform)
cpuTestRuntime projects.cavisNative.cavisNativeCpu
cpuTestRuntime group: "org.bytedeco", name: "openblas"
cpuTestRuntime group: "org.bytedeco", name: "openblas", classifier: buildTarget
cpuTestRuntime group: "org.bytedeco", name: "opencv"
cpuTestRuntime group: "org.bytedeco", name: "opencv", classifier: buildTarget
cpuTestRuntime(project(":cavis-native:cavis-native-lib")) {
capabilities {
it.requireCapabilities "net.brutex.cavis.cavis-native:cavis-native-lib-cpu-support:${project.version}"
}
}
}
}
}