diff options
Diffstat (limited to 'infra/it/memory-benchmark-scripts')
3 files changed, 112 insertions, 0 deletions
diff --git a/infra/it/memory-benchmark-scripts/pom.xml b/infra/it/memory-benchmark-scripts/pom.xml new file mode 100644 index 000000000..b6b29e5e2 --- /dev/null +++ b/infra/it/memory-benchmark-scripts/pom.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <!-- have to basically duplicate common-scripts, it cannot be used as parent because of jar packaging --> + + <properties> + <!-- groovy --> + <maven.groovy.version>2.0</maven.groovy.version> + <groovy.version>2.4.7</groovy.version> + <groovy.eclipse.compiler.version>2.9.2-01</groovy.eclipse.compiler.version> + <groovy.eclipse.batch.version>2.4.3-01</groovy.eclipse.batch.version> + </properties> + + <modelVersion>4.0.0</modelVersion> + <groupId>io.fd.honeycomb.it</groupId> + <artifactId>benchmark-scripts</artifactId> + <version>1.17.04-SNAPSHOT</version> + <packaging>jar</packaging> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <configuration> + <skip>true</skip> + <skipDeploy>true</skipDeploy> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-eclipse-compiler</artifactId> + <version>${groovy.eclipse.compiler.version}</version> + <extensions>true</extensions> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <!-- 2.8.0-01 and later require maven-compiler-plugin 3.1 or higher --> + <configuration> + <compilerId>groovy-eclipse-compiler</compilerId> + </configuration> + <dependencies> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-eclipse-compiler</artifactId> + <version>${groovy.eclipse.compiler.version}</version> + </dependency> + <!-- for 2.8.0-01 and later you must have an explicit dependency on groovy-eclipse-batch --> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-eclipse-batch</artifactId> + <version>${groovy.eclipse.batch.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-all</artifactId> + <version>${groovy.version}</version> + </dependency> + </dependencies> +</project>
\ No newline at end of file diff --git a/infra/it/memory-benchmark-scripts/src/main/groovy/io/fd/honeycomb/benchmark/script/MemoryBenchmarkStartupScriptGenerator.groovy b/infra/it/memory-benchmark-scripts/src/main/groovy/io/fd/honeycomb/benchmark/script/MemoryBenchmarkStartupScriptGenerator.groovy new file mode 100644 index 000000000..1db656aca --- /dev/null +++ b/infra/it/memory-benchmark-scripts/src/main/groovy/io/fd/honeycomb/benchmark/script/MemoryBenchmarkStartupScriptGenerator.groovy @@ -0,0 +1,38 @@ +package io.fd.honeycomb.benchmark.script + +import groovy.text.SimpleTemplateEngine + +import java.nio.file.Files +import java.nio.file.Paths + +class MemoryBenchmarkStartupScriptGenerator { + + static final def STARTUP_SCRIPT_ON_REST_TEMPLATE = MemoryBenchmarkStartupScriptGenerator.getResource("/memoryBenchmarkScript") + static final def STARTUP_SCRIPT_NAME_BASE = "honeycomb-memory-footprint-benchmark-" + + static final def FOOTPRINT_TEST_CLASS = "io.fd.honeycomb.benchmark.memory.HoneycombFootprintTest" + + static final def OUTPUT_PATH_PARAM = "-DoutPath=\$(dirname \$0)/" + static final def SAMPLE_SIZE_PARAM = "-DsampleSize=" + + /** + * Generate script to run io.fd.honeycomb.benchmark.memory.HoneycombWithDataTest with provided params + * */ + public static void generateWithDataScript(project, log, String outputFileName, dataSampleSize) { + log.info "Binding execution script for with-data benchmark[output=${outputFileName},sampleSize=${dataSampleSize}]" + def scriptContent = new SimpleTemplateEngine().createTemplate(STARTUP_SCRIPT_ON_REST_TEMPLATE).make( + [ + "testParams" : "${OUTPUT_PATH_PARAM}${outputFileName}-${dataSampleSize} ${SAMPLE_SIZE_PARAM}${dataSampleSize}", + "testClass" : FOOTPRINT_TEST_CLASS + ]).toString() + flushScript(Paths.get(project.build.directory, "${STARTUP_SCRIPT_NAME_BASE}${dataSampleSize}"), scriptContent, log) + } + + private static flushScript(filePath, content,log) { + log.info "Saving script to path ${filePath}" + def file = Files.createFile(filePath).toFile() + + file.text = content + file.setExecutable(true) + } +} diff --git a/infra/it/memory-benchmark-scripts/src/main/resources/memoryBenchmarkScript b/infra/it/memory-benchmark-scripts/src/main/resources/memoryBenchmarkScript new file mode 100644 index 000000000..120cb00e0 --- /dev/null +++ b/infra/it/memory-benchmark-scripts/src/main/resources/memoryBenchmarkScript @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +java -cp .:memory-benchmark-1.0.0-with-tests.jar ${testParams} org.junit.runner.JUnitCore ${testClass}
\ No newline at end of file |