blob: b3a7dd45d46c5439ff81b1701deb56fe1b4396e1 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
plugins { id 'java' }
group 'org.apache.geode-benchmark'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
def outputDir = project.hasProperty('outputDir') ? project.findProperty('outputDir') : new File(project.buildDir, "benchmarks_" + getDate()).getAbsolutePath()
def geodeVersion = project.hasProperty('geodeVersion') ? project.findProperty('geodeVersion') : '1.+'
def getDate() {
new Date().format('yyyyMMddHHmmss')
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation(group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: project.'junit-jupiter-engine.version')
implementation(group: 'org.junit-pioneer', name: 'junit-pioneer', version: project.'junit-pioneer.version')
implementation(group: 'org.slf4j', name: 'slf4j-simple', version: project.'slf4j-simple.version')
implementation(project(':harness'))
implementation(group: 'org.apache.geode', name: 'geode-core', version: geodeVersion)
// Required for missing dependency on geode-core.
runtime(group: 'org.eclipse.jetty', name: 'jetty-webapp', version: '9.4.12.v20180830')
runtime(group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.12.0')
testImplementation(group: 'org.mockito', name: 'mockito-all', version: project.'mockito-all.version')
testImplementation(group: 'org.assertj', name: 'assertj-core', version: project.'assertj-core.version')
}
test{
afterTest { desc, result ->
logger.quiet "Executing test ${desc.className}.${desc.name} with result: ${result.resultType}"
}
useJUnitPlatform()
}
task benchmark(type: Test) {
if (project.hasProperty('testJVM') && !testJVM.trim().isEmpty()) {
executable = "${testJVM}/bin/java"
}
outputs.upToDateWhen { false }
testClassesDirs = project.sourceSets.main.output.classesDirs
classpath = project.sourceSets.main.runtimeClasspath
useJUnitPlatform()
testLogging { exceptionFormat = 'full' }
exclude "**/NoopBenchmark.class"
exclude "**/*LongBenchmark.class"
forkEvery 1
systemProperty 'TEST_HOSTS', project.findProperty('hosts')
systemProperty 'TEST_METADATA', project.findProperty('metadata')
systemProperty 'OUTPUT_DIR', outputDir
if (project.hasProperty('withGc')) {
systemProperty 'withGc', project.findProperty('withGc')
}
if (project.hasProperty('withHeap')) {
systemProperty 'withHeap', project.findProperty('withHeap')
}
if (project.hasProperty('withThreads')) {
systemProperty 'withThreads', project.findProperty('withThreads')
}
if (project.hasProperty('withWarmup')) {
systemProperty 'withWarmup', project.findProperty('withWarmup')
}
if (project.hasProperty('withDuration')) {
systemProperty 'withDuration', project.findProperty('withDuration')
}
systemProperty 'withSsl', project.hasProperty('withSsl')
systemProperty 'withSecurityManager', project.hasProperty('withSecurityManager')
systemProperty 'benchmark.profiler.argument', project.findProperty('benchmark.profiler.argument')
doFirst {
if(!project.hasProperty('hosts')) {
throw new GradleException("You must set the hosts property to a comma separated list of hosts. Eg ./gradlew benchmark -Phosts=localhost,localhost,localhost")
}
}
}