use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.
the class TestDependencyIteratorBuilder method testRegularIteratorCreation.
@Test
public void testRegularIteratorCreation() {
try (MockedStatic<GitUtils> gitUtil = Mockito.mockStatic(GitUtils.class)) {
gitUtil.when(() -> GitUtils.getName(Mockito.any(), Mockito.any())).thenReturn(VERSION_2);
ExecutionConfig config = new ExecutionConfig();
config.setVersionOld(SIMPLE_PREDECESSOR);
config.setVersion("HEAD");
StaticTestSelection dependencies = buildVersionDependencies(LAST_RUNNING_VERSION);
VersionIteratorGit iterator = new DependencyIteratorBuilder(config, dependencies, new PeassFolders(TEMPORARY_FOLDER)).getIterator();
Assert.assertEquals(2, iterator.getSize());
Assert.assertEquals(VERSION_2, iterator.getTag());
Assert.assertEquals(SIMPLE_PREDECESSOR, iterator.getPredecessor());
}
}
use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.
the class RegressionTestSelectionStarter method readExecutions.
public void readExecutions(final String project, final List<GitCommit> commits) throws InterruptedException, IOException, JsonGenerationException, JsonMappingException, JAXBException {
KiekerConfig kiekerConfig = kiekerConfigMixin.getKiekerConfig();
ExecutionConfig executionConfig = executionConfigMixin.getExecutionConfig();
final DependencyParallelReader reader = new DependencyParallelReader(config.getProjectFolder(), config.getResultBaseFolder(), project, commits, config.getDependencyConfig(), executionConfig, kiekerConfig, new EnvironmentVariables());
final ResultsFolders[] outFiles = reader.readDependencies();
LOG.debug("Files: {}", outFiles);
ResultsFolders mergedFolders = new ResultsFolders(config.getResultBaseFolder(), project);
final File out = mergedFolders.getStaticTestSelectionFile();
final StaticTestSelection all = PartialDependenciesMerger.mergeVersions(out, outFiles);
final PeassFolders folders = new PeassFolders(config.getProjectFolder());
final File dependencyTempFiles = new File(folders.getTempProjectFolder().getParentFile(), "dependencyTempFiles");
FileUtils.moveDirectory(folders.getTempProjectFolder(), dependencyTempFiles);
ExecutionData executionData = PartialDependenciesMerger.mergeExecutions(mergedFolders, outFiles);
mergeViews(outFiles, mergedFolders);
if (!config.isDoNotGenerateProperties()) {
ResultsFolders resultsFolders = new ResultsFolders(config.getResultBaseFolder(), project);
final PropertyReader propertyReader = new PropertyReader(resultsFolders, config.getProjectFolder(), executionData, executionConfig);
propertyReader.readAllTestsProperties();
}
}
use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.
the class ExecutionConfigMixin method getExecutionConfig.
public ExecutionConfig getExecutionConfig() {
ExecutionConfig config = new ExecutionConfig(timeout);
config.setVersion(version);
config.setVersionOld(versionOld);
config.setStartversion(getStartversion());
config.setEndversion(getEndversion());
config.setTestGoal(getTestGoal());
if (getIncludes() != null) {
for (String include : getIncludes()) {
config.getIncludes().add(include);
}
}
if (getExcludes() != null) {
for (String exclude : getExcludes()) {
config.getExcludes().add(exclude);
}
}
if (getPl() != null) {
config.setPl(pl);
}
boolean transformerSet = getTestTransformer() != null;
boolean executorSet = getTestExecutor() != null;
if (transformerSet && executorSet) {
config.setTestTransformer(getTestTransformer());
config.setTestExecutor(getTestExecutor());
} else if (transformerSet != executorSet) {
throw new RuntimeException("If the test transformer is set by CLI parameters, the test executor needs also be set!");
} else {
config.setTestTransformer(getWorkloadType().getTestTransformer());
config.setTestExecutor(getWorkloadType().getTestExecutor());
}
config.setUseTieredCompilation(useTieredCompilation);
config.setRemoveSnapshots(removeSnapshots);
config.setUseAlternativeBuildfile(useAlternativeBuildfile);
config.setRemoveSnapshots(removeSnapshots);
config.setCreateDefaultConstructor(!skipDefaultConstructor);
config.setExecuteBeforeClassInMeasurement(executeBeforeClassInMeasurement);
config.setKiekerWaitTime(kiekerWaitTime);
if (getClazzFolder() != null) {
List<String> clazzFolders = ExecutionConfig.buildFolderList(getClazzFolder());
config.setClazzFolders(clazzFolders);
}
if (getTestClazzFolder() != null) {
List<String> testClazzFolders = ExecutionConfig.buildFolderList(getTestClazzFolder());
config.setTestClazzFolders(testClazzFolders);
}
config.setExcludeLog4j(excludeLog4j);
config.setRedirectToNull(!dontRedirectToNull);
return config;
}
use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.
the class JmhDependencyReaderMultiParamTest method mockIterator.
private FakeFileIterator mockIterator() {
List<File> versionList = Arrays.asList(JmhTestConstants.MULTIPARAM_VERSION, JmhTestConstants.MULTIPARAM_VERSION_CHANGE);
FakeFileIterator fakeIterator = new FakeFileIterator(TestConstants.CURRENT_FOLDER, versionList);
fakeIterator.goToFirstCommit();
FakeFileIterator iteratorspied = Mockito.spy(fakeIterator);
VersionDiff fakedDiff = new VersionDiff(Arrays.asList(TestConstants.CURRENT_FOLDER), TestConstants.CURRENT_FOLDER);
ExecutionConfig defaultConfig = new ExecutionConfig();
fakedDiff.addChange("src/test/java/de/dagere/peass/ExampleBenchmark.java", defaultConfig);
Mockito.doReturn(fakedDiff).when(iteratorspied).getChangedClasses(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
return iteratorspied;
}
use of de.dagere.peass.config.ExecutionConfig 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);
}
}
Aggregations