use of de.dagere.peass.folders.PeassFolders in project peass by DaGeRe.
the class JmhDependencyReaderMultiParamTest method testVersionReading.
@Test
public void testVersionReading() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
try (MockedStatic<GitUtils> gitUtilsMock = Mockito.mockStatic(GitUtils.class)) {
FakeGitUtil.prepareGitUtils(gitUtilsMock);
FakeFileIterator iterator = mockIterator();
ResultsFolders resultsFolders = new ResultsFolders(TraceGettingIT.VIEW_IT_PROJECTFOLDER, "test");
TestSelectionConfig dependencyConfig = new TestSelectionConfig(1, false, true, false);
ExecutionConfig jmhConfig = new ExecutionConfig();
jmhConfig.setTestTransformer("de.dagere.peass.dependency.jmh.JmhTestTransformer");
jmhConfig.setTestExecutor("de.dagere.peass.dependency.jmh.JmhTestExecutor");
DependencyReader reader = new DependencyReader(dependencyConfig, new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, "", iterator, new VersionKeeper(new File("/dev/null")), jmhConfig, new KiekerConfig(true), new EnvironmentVariables());
reader.readInitialVersion();
checkInitialVersion(resultsFolders);
reader.readDependencies();
checkChangedVersion(resultsFolders);
}
}
use of de.dagere.peass.folders.PeassFolders in project peass by DaGeRe.
the class JmhDependencyReaderTest method testVersionReading.
@ParameterizedTest
@ArgumentsSource(KiekerConfigurationProvider.class)
public void testVersionReading(final KiekerConfig kiekerConfig) throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
try (MockedStatic<GitUtils> gitUtilsMock = Mockito.mockStatic(GitUtils.class)) {
FakeGitUtil.prepareGitUtils(gitUtilsMock);
FakeFileIterator iterator = mockIterator();
ResultsFolders resultsFolders = new ResultsFolders(TraceGettingIT.VIEW_IT_PROJECTFOLDER, "test");
TestSelectionConfig dependencyConfig = new TestSelectionConfig(1, false, true, false);
ExecutionConfig jmhConfig = new ExecutionConfig();
jmhConfig.setTestTransformer("de.dagere.peass.dependency.jmh.JmhTestTransformer");
jmhConfig.setTestExecutor("de.dagere.peass.dependency.jmh.JmhTestExecutor");
DependencyReader reader = new DependencyReader(dependencyConfig, new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, "", iterator, new VersionKeeper(new File("/dev/null")), jmhConfig, kiekerConfig, new EnvironmentVariables());
reader.readInitialVersion();
checkInitialVersion(resultsFolders);
reader.readDependencies();
checkChangedVersion(resultsFolders);
}
}
use of de.dagere.peass.folders.PeassFolders in project peass by DaGeRe.
the class JmhIterationTest method testVersionReading.
@Test
public void testVersionReading() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, JAXBException {
FileUtils.copyDirectory(JmhTestConstants.BASIC_VERSION, TestConstants.CURRENT_FOLDER);
MeasurementConfig measurementConfig = new MeasurementConfig(VMS);
measurementConfig.setIterations(ITERATIONS);
measurementConfig.setWarmup(WARMUP);
measurementConfig.getExecutionConfig().setTestExecutor(WorkloadType.JMH.getTestExecutor());
JmhTestTransformer transformer = new JmhTestTransformer(TestConstants.CURRENT_FOLDER, measurementConfig);
PeassFolders folders = new PeassFolders(TestConstants.CURRENT_FOLDER);
TestExecutor executor = ExecutorCreator.createExecutor(folders, transformer, new EnvironmentVariables());
// File logFile = new File(folders.getLogFolder(), "test.txt");
TestCase testcase = new TestCase("de.dagere.peass.ExampleBenchmark#testMethod");
executor.prepareKoPeMeExecution(new File(folders.getMeasureLogFolder(), "compile.txt"));
for (int i = 0; i < 3; i++) {
executor.executeTest(testcase, folders.getMeasureLogFolder(), 100);
}
File clazzFolder = folders.findTempClazzFolder(testcase).get(0);
Kopemedata data = XMLDataLoader.loadData(new File(clazzFolder, testcase.getMethod() + ".xml"));
TestcaseType testcaseData = data.getTestcases().getTestcase().get(0);
Assert.assertEquals("de.dagere.peass.ExampleBenchmark", data.getTestcases().getClazz());
Assert.assertEquals("testMethod", testcaseData.getName());
Assert.assertEquals(VMS, testcaseData.getDatacollector().get(0).getResult().size());
List<Result> results = testcaseData.getDatacollector().get(0).getResult();
Assert.assertEquals(ITERATIONS + WARMUP, results.get(0).getFulldata().getValue().size());
for (Result result : results) {
DescriptiveStatistics statistics = new DescriptiveStatistics();
result.getFulldata().getValue().forEach(value -> statistics.addValue(value.getValue()));
Assert.assertEquals(statistics.getMean(), result.getValue(), 0.01);
Assert.assertEquals(statistics.getStandardDeviation(), result.getDeviation(), 0.01);
}
}
use of de.dagere.peass.folders.PeassFolders in project peass by DaGeRe.
the class JmhIterationTestMultiParam method testVersionReading.
@Test
public void testVersionReading() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, JAXBException {
FileUtils.copyDirectory(JmhTestConstants.MULTIPARAM_VERSION, TestConstants.CURRENT_FOLDER);
MeasurementConfig measurementConfig = new MeasurementConfig(3);
measurementConfig.setIterations(4);
measurementConfig.setWarmup(2);
JmhTestTransformer transformer = new JmhTestTransformer(TestConstants.CURRENT_FOLDER, measurementConfig);
PeassFolders folders = new PeassFolders(TestConstants.CURRENT_FOLDER);
TestExecutor executor = ExecutorCreator.createExecutor(folders, transformer, new EnvironmentVariables());
// File logFile = new File(folders.getLogFolder(), "test.txt");
TestCase testcase = new TestCase("de.dagere.peass.ExampleBenchmark#testMethod");
executor.prepareKoPeMeExecution(new File(folders.getMeasureLogFolder(), "compile.txt"));
executor.executeTest(testcase, folders.getMeasureLogFolder(), 100);
File clazzFolder = folders.findTempClazzFolder(testcase).get(0);
Kopemedata data = XMLDataLoader.loadData(new File(clazzFolder, testcase.getMethod() + ".xml"));
TestcaseType testcaseData = data.getTestcases().getTestcase().get(0);
Assert.assertEquals("de.dagere.peass.ExampleBenchmark", data.getTestcases().getClazz());
Assert.assertEquals("testMethod", testcaseData.getName());
Assert.assertEquals(6, testcaseData.getDatacollector().get(0).getResult().size());
List<Result> results = testcaseData.getDatacollector().get(0).getResult();
Assert.assertEquals(4, results.get(0).getFulldata().getValue().size());
List<String> params = results.stream().map(result -> result.getParams().getParam().stream().map(param -> param.getKey() + "-" + param.getValue()).collect(Collectors.joining(" "))).collect(Collectors.toList());
Assert.assertThat(params, IsIterableContaining.hasItems("parameter-val1", "parameter-val2"));
for (Result result : results) {
DescriptiveStatistics statistics = new DescriptiveStatistics();
result.getFulldata().getValue().forEach(value -> statistics.addValue(value.getValue()));
Assert.assertEquals(statistics.getMean(), result.getValue(), 0.01);
Assert.assertEquals(statistics.getStandardDeviation(), result.getDeviation(), 0.01);
}
}
use of de.dagere.peass.folders.PeassFolders in project peass by DaGeRe.
the class JmhParallelExecutionTest method prepareThreads.
private void prepareThreads(final File[] testFolders, final JmhTestExecutor[] executors, final Thread[] threads, final MeasurementConfig measurementConfig) throws IOException, InterruptedException, XmlPullParserException {
for (int i = 0; i < 2; i++) {
testFolders[i] = new File(BASE_FOLDER, "jmh-" + i);
FileUtils.copyDirectory(JmhTestConstants.BASIC_VERSION, testFolders[i]);
PeassFolders folders = new PeassFolders(testFolders[i]);
JmhTestTransformer transformer = new JmhTestTransformer(testFolders[i], measurementConfig);
executors[i] = new JmhTestExecutor(folders, transformer, new EnvironmentVariables());
executors[i].prepareKoPeMeExecution(new File(folders.getMeasureLogFolder(), "clean.txt"));
final int j = i;
threads[i] = new Thread(new Runnable() {
@Override
public void run() {
File logFolder = new File(BASE_FOLDER, "" + j);
logFolder.mkdirs();
executors[j].executeTest(test, logFolder, 100);
}
});
}
}
Aggregations