Search in sources :

Example 1 with EnvironmentVariables

use of de.dagere.peass.execution.utils.EnvironmentVariables in project peass by DaGeRe.

the class CauseTester method main.

public static void main(final String[] args) throws IOException, XmlPullParserException, InterruptedException, JAXBException, ClassNotFoundException {
    final File projectFolder = new File("../../projekte/commons-fileupload");
    final String version = "4ed6e923cb2033272fcb993978d69e325990a5aa";
    final TestCase test = new TestCase("org.apache.commons.fileupload.ServletFileUploadTest", "testFoldedHeaders");
    final MeasurementConfig config = new MeasurementConfig(15 * 1000 * 60, 15, true, version, version + "~1");
    config.setUseKieker(true);
    final CauseSearcherConfig causeConfig = new CauseSearcherConfig(test, false, 0.01, false, false, RCAStrategy.COMPLETE, 1);
    final CauseTester manager = new CauseTester(new CauseSearchFolders(projectFolder), config, causeConfig, new EnvironmentVariables());
    final CallTreeNode node = new CallTreeNode("FileUploadTestCase#parseUpload", "protected java.util.List org.apache.commons.fileupload.FileUploadTestCase.parseUpload(byte[],java.lang.String)", "protected java.util.List org.apache.commons.fileupload.FileUploadTestCase.parseUpload(byte[],java.lang.String)", config);
    node.setOtherVersionNode(node);
    final Set<CallTreeNode> nodes = new HashSet<>();
    nodes.add(node);
    manager.setIncludedMethods(nodes);
    manager.runOnce(test, version, 0, new File("log"));
// manager.evaluate(test);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) CallTreeNode(de.dagere.peass.measurement.rca.data.CallTreeNode) File(java.io.File) HashSet(java.util.HashSet)

Example 2 with EnvironmentVariables

use of de.dagere.peass.execution.utils.EnvironmentVariables in project peass by DaGeRe.

the class LevelCauseSearchExperimentalStarter method main.

public static void main(final String[] args) throws IOException, XmlPullParserException, InterruptedException, IllegalStateException, AnalysisConfigurationException, ViewNotFoundException, JAXBException {
    final File projectFolder = new File("../../projekte/commons-fileupload");
    final String version = "4ed6e923cb2033272fcb993978d69e325990a5aa";
    final TestCase test = new TestCase("org.apache.commons.fileupload.ServletFileUploadTest", "testFoldedHeaders");
    final MeasurementConfig measurementConfiguration = new MeasurementConfig(15 * 1000 * 60, 5, true, version, version + "~1");
    measurementConfiguration.setUseKieker(true);
    final CauseSearcherConfig causeSearcherConfig = new CauseSearcherConfig(test, false, 0.1, false, false, RCAStrategy.COMPLETE, 1);
    final CauseSearchFolders folders2 = new CauseSearchFolders(projectFolder);
    final BothTreeReader reader = new BothTreeReader(causeSearcherConfig, measurementConfiguration, folders2, new EnvironmentVariables());
    final CauseTester measurer = new CauseTester(folders2, measurementConfiguration, causeSearcherConfig, new EnvironmentVariables());
    final LevelCauseSearcher searcher = new LevelCauseSearcher(reader, causeSearcherConfig, measurer, measurementConfiguration, folders2, new EnvironmentVariables());
    reader.readTrees();
    List<CallTreeNode> predecessor = Arrays.asList(new CallTreeNode[] { reader.getRootPredecessor() });
    List<CallTreeNode> current = Arrays.asList(new CallTreeNode[] { reader.getRootVersion() });
    int level = 0;
    boolean hasChilds = true;
    while (hasChilds) {
        level++;
        LOG.info("Level: " + level + " " + predecessor.get(0).getKiekerPattern());
        boolean foundNodeLevel = false;
        final List<CallTreeNode> predecessorNew = new LinkedList<>();
        final List<CallTreeNode> currentNew = new LinkedList<>();
        final Iterator<CallTreeNode> currentIterator = current.iterator();
        for (final Iterator<CallTreeNode> preIterator = predecessor.iterator(); preIterator.hasNext() && currentIterator.hasNext(); ) {
            final CallTreeNode predecessorChild = preIterator.next();
            final CallTreeNode currentChild = currentIterator.next();
            predecessorNew.addAll(predecessorChild.getChildren());
            currentNew.addAll(currentChild.getChildren());
            final String searchedCall = "public static long org.apache.commons.fileupload.util.Streams.copy(java.io.InputStream,java.io.OutputStream,boolean,byte[])";
            if (predecessorChild.getKiekerPattern().equals(searchedCall) && currentChild.getKiekerPattern().equals(searchedCall)) {
                foundNodeLevel = true;
            }
            if (predecessorChild.getKiekerPattern().equals(searchedCall) != currentChild.getKiekerPattern().equals(searchedCall)) {
                LOG.info(predecessorChild.getKiekerPattern());
                LOG.info(currentChild.getKiekerPattern());
                throw new RuntimeException("Tree structure differs above searched node!");
            }
        }
        if (foundNodeLevel) {
            LOG.info("Found!");
            searcher.isLevelDifferent(predecessorNew, currentNew);
        }
        predecessor = predecessorNew;
        current = currentNew;
        if (predecessor.isEmpty()) {
            hasChilds = false;
        }
    }
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) CallTreeNode(de.dagere.peass.measurement.rca.data.CallTreeNode) BothTreeReader(de.dagere.peass.measurement.rca.kieker.BothTreeReader) LinkedList(java.util.LinkedList) CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) LevelCauseSearcher(de.dagere.peass.measurement.rca.searcher.LevelCauseSearcher) File(java.io.File)

Example 3 with EnvironmentVariables

use of de.dagere.peass.execution.utils.EnvironmentVariables in project peass by DaGeRe.

the class TestPeassFilter method testExecution.

@Test
public void testExecution() throws ViewNotFoundException, IOException, XmlPullParserException, InterruptedException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
    Assume.assumeFalse(EnvironmentVariables.isWindows());
    PeassFolders folders = new PeassFolders(CURRENT);
    final KiekerResultManager manager = new KiekerResultManager(folders, new ExecutionConfig(5), new KiekerConfig(true), new EnvironmentVariables());
    final TestSet testset = new TestSet();
    final TestCase testcase = new TestCase("defaultpackage.TestMe", "testMe", "");
    testset.addTest(testcase);
    final ModuleClassMapping mapping = new ModuleClassMapping(manager.getExecutor());
    final List<TraceElement> referenceTrace = regenerateTrace(manager, testset, testcase, mapping, 0);
    for (int i = 1; i <= 3; i++) {
        final List<TraceElement> compareTrace = regenerateTrace(manager, testset, testcase, mapping, i);
        checkRegeneratedTrace(referenceTrace, compareTrace);
    }
}
Also used : EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) TraceElement(de.dagere.peass.dependency.analysis.data.TraceElement) KiekerResultManager(de.dagere.peass.dependency.KiekerResultManager) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) KiekerConfig(de.dagere.peass.config.KiekerConfig) PeassFolders(de.dagere.peass.folders.PeassFolders) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) Test(org.junit.jupiter.api.Test)

Example 4 with EnvironmentVariables

use of de.dagere.peass.execution.utils.EnvironmentVariables in project peass by DaGeRe.

the class RootCauseAnalysis method call.

@Override
public Void call() throws Exception {
    if (testName == null) {
        throw new RuntimeException("Test needs to be defined!");
    }
    initVersionProcessor();
    if (version == null) {
        version = executionData.getVersions().keySet().iterator().next();
        LOG.info("Version was not defined, using " + version);
    }
    final TestCase test = new TestCase(testName);
    final VersionStaticSelection versionInfo = staticTestSelection.getVersions().get(version);
    boolean found = versionInfo.getTests().getTests().contains(test);
    if (!found) {
        LOG.error("Test " + test + " is not contained in regression test selection result, therefore it is unlikely to have a performance change!");
    }
    final String predecessor = versionInfo.getPredecessor();
    LOG.debug("Timeout in minutes: {}", executionMixin.getTimeout());
    final MeasurementConfig measurementConfiguration = getConfiguration(predecessor);
    final CauseSearcherConfig causeSearcherConfig = new CauseSearcherConfig(test, causeSearchConfigMixin);
    if (kiekerConfigMixin.isUseAggregation() && measurementConfiguration.getKiekerConfig().getRecord() == AllowedKiekerRecord.OPERATIONEXECUTION) {
        throw new RuntimeException("Aggregation and OperationExecutionRecord can not be combined!");
    }
    final CauseSearchFolders alternateFolders = new CauseSearchFolders(folders.getProjectFolder());
    final BothTreeReader reader = new BothTreeReader(causeSearcherConfig, measurementConfiguration, alternateFolders, new EnvironmentVariables());
    final CauseSearcher tester = getCauseSeacher(measurementConfiguration, causeSearcherConfig, alternateFolders, reader);
    tester.search();
    return null;
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) LevelCauseSearcher(de.dagere.peass.measurement.rca.searcher.LevelCauseSearcher) CauseSearcher(de.dagere.peass.measurement.rca.searcher.CauseSearcher) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) BothTreeReader(de.dagere.peass.measurement.rca.kieker.BothTreeReader) CauseSearcherConfig(de.dagere.peass.measurement.rca.CauseSearcherConfig)

Example 5 with EnvironmentVariables

use of de.dagere.peass.execution.utils.EnvironmentVariables in project peass by DaGeRe.

the class TestGenerateDependencies method testGenerateDependencies.

@Test
public void testGenerateDependencies() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
    DependencyDetectorTestUtil.init(TraceGettingIT.BASIC);
    final FakeFileIterator iterator = new FakeFileIterator(TestConstants.CURRENT_FOLDER, Arrays.asList(TraceGettingIT.REPETITION));
    ResultsFolders resultsFolders = new ResultsFolders(TraceGettingIT.VIEW_IT_PROJECTFOLDER, "test");
    final DependencyReader reader = new DependencyReader(DependencyTestConstants.DEFAULT_CONFIG_NO_VIEWS, new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, "", iterator, VersionKeeper.INSTANCE, new ExecutionConfig(5), new KiekerConfig(true), new EnvironmentVariables());
    final boolean success = reader.readInitialVersion();
    Assert.assertTrue(success);
    iterator.goToNextCommit();
    final ChangeManager manager = Mockito.mock(ChangeManager.class);
    final HashMap<ChangedEntity, ClazzChangeData> value = new HashMap<>();
    ChangedEntity testMeEntity = new ChangedEntity("viewtest.TestMe", "");
    value.put(testMeEntity, new ClazzChangeData(testMeEntity, false));
    Mockito.when(manager.getChanges(Mockito.any())).thenReturn(value);
    final int tests = reader.analyseVersion(manager);
    LOG.debug(Constants.OBJECTMAPPER.writeValueAsString(reader.getDependencies()));
    Assert.assertEquals(1, tests);
}
Also used : FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) HashMap(java.util.HashMap) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) PeassFolders(de.dagere.peass.folders.PeassFolders) ChangeManager(de.dagere.peass.dependency.ChangeManager) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) ResultsFolders(de.dagere.peass.folders.ResultsFolders) KiekerConfig(de.dagere.peass.config.KiekerConfig) Test(org.junit.jupiter.api.Test)

Aggregations

EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)52 PeassFolders (de.dagere.peass.folders.PeassFolders)30 File (java.io.File)29 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)23 KiekerConfig (de.dagere.peass.config.KiekerConfig)21 Test (org.junit.jupiter.api.Test)21 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)20 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)13 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)11 CauseSearchFolders (de.dagere.peass.folders.CauseSearchFolders)11 TestSelectionConfig (de.dagere.peass.config.TestSelectionConfig)8 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)8 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)7 BothTreeReader (de.dagere.peass.measurement.rca.kieker.BothTreeReader)7 GitUtils (de.dagere.peass.vcs.GitUtils)7 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)6 ChangeManager (de.dagere.peass.dependency.ChangeManager)5 ResultsFolders (de.dagere.peass.folders.ResultsFolders)5 CallTreeNode (de.dagere.peass.measurement.rca.data.CallTreeNode)5 LevelCauseSearcher (de.dagere.peass.measurement.rca.searcher.LevelCauseSearcher)5