systemProperty 'org.slf4j.simpleLogger.dateTimeFormat', 'yyyy-MM-dd HH:mm:ss.SSS'
systemProperty 'org.slf4j.simpleLogger.showThreadName', 'false'
systemProperty 'org.slf4j.simpleLogger.showShortLogName', 'true'
- systemProperty 'TEST_HOSTS', project.findProperty('hosts')
- systemProperty 'TEST_METADATA', project.findProperty('metadata')
- systemProperty 'OUTPUT_DIR', outputDir
+ systemProperty 'benchmark.TEST_HOSTS', project.findProperty('hosts')
+ systemProperty 'benchmark.TEST_METADATA', project.findProperty('metadata')
+ systemProperty 'benchmark.OUTPUT_DIR', outputDir
//Set all project properties starting with "benchmark." as system properties in the test
//JVM
*/
public class TestRunners {
- public static final String TEST_HOSTS = "TEST_HOSTS";
- public static final String OUTPUT_DIR = "OUTPUT_DIR";
+ public static final String TEST_HOSTS = "benchmark.TEST_HOSTS";
+ public static final String OUTPUT_DIR = "benchmark.OUTPUT_DIR";
public static final String[] JVM_ARGS_SMALL_SIZE = new String[] {
"-XX:CMSInitiatingOccupancyFraction=60",
static TestRunner defaultRunner(String testHosts, File outputDir) {
if (testHosts == null) {
throw new IllegalStateException(
- "You must set the TEST_HOSTS system property to a comma separated list of hosts to run the benchmarks on.");
+ "You must set the benchmark.TEST_HOSTS system property to a comma separated list of hosts to run the benchmarks on.");
}
String userName = System.getProperty("user.name");
}
benchmarkOutput.mkdirs();
+ Properties properties = new Properties();
+ addVersionProperties(properties, getVersionProperties());
+ addSystemProperties(properties);
+ logger.info("Benchmark Properties {}", properties);
+
+
String metadataFilename = outputDir + "/testrunner.properties";
Path metadataOutput = Paths.get(metadataFilename);
if (!metadataOutput.toFile().exists()) {
- Properties properties = new Properties(System.getProperties());
- addVersionProperties(properties, getVersionProperties());
try (FileWriter writer = new FileWriter(metadataOutput.toFile().getAbsoluteFile())) {
properties.store(writer, "Benchmark metadata generated while running tests");
}
}
+ private void addSystemProperties(Properties properties) {
+ System.getProperties().stringPropertyNames().stream()
+ .filter(name -> name.startsWith("benchmark."))
+ .forEach(name -> properties.setProperty(name, System.getProperty(name)));
+ }
+
private void addVersionProperties(Properties jsonMetadata, Properties versionProperties) {
jsonMetadata.put("benchmark.source_version", versionProperties.getProperty("Product-Version"));
jsonMetadata.put("benchmark.source_branch", versionProperties.getProperty("Source-Repository"));