Browse Source

Reduce test output for incremental comp tests

tags/V1_9_7M1
Andy Clement 3 years ago
parent
commit
884ced970e

+ 4
- 2
tests/src/test/java/org/aspectj/systemtest/AllTests.java View File

* This program and the accompanying materials are made available * This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0 * under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at * which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* http://www.eclipse.org/legal/epl-v10.html
*
* ******************************************************************/ * ******************************************************************/
package org.aspectj.systemtest; package org.aspectj.systemtest;


*/ */
public class AllTests { public class AllTests {


public final static boolean VERBOSE = System.getProperty("aspectj.tests.verbose", "true").equals("true");

public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite("AspectJ System Test Suite - JDK 1.3"); TestSuite suite = new TestSuite("AspectJ System Test Suite - JDK 1.3");
//$JUnit-BEGIN$ //$JUnit-BEGIN$

+ 0
- 2
tests/src/test/java/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java View File

IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
IProgramElement pe = top.findElementForLabel(top.getRoot(), kind, ipeName); IProgramElement pe = top.findElementForLabel(top.getRoot(), kind, ipeName);
String found = pe.getHandleIdentifier(); String found = pe.getHandleIdentifier();
System.err.println("expected: " + expectedHandle);
System.err.println("actual: " + found);
assertEquals("handleIdentifier - expected " + expectedHandle + ", but found " + found, expectedHandle, found); assertEquals("handleIdentifier - expected " + expectedHandle + ", but found " + found, expectedHandle, found);
} }



+ 14
- 12
tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java View File

/******************************************************************** /********************************************************************
* Copyright (c) 2006 Contributors. All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html
*
* Contributors:
* Copyright (c) 2006 Contributors. All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html
*
* Contributors:
* Adrian Colyer initial implementation * Adrian Colyer initial implementation
* Helen Hawkins Converted to new interface (bug 148190) * Helen Hawkins Converted to new interface (bug 148190)
*******************************************************************/ *******************************************************************/
File projDir = new File(getWorkingDir(), p); File projDir = new File(getWorkingDir(), p);
return new File(projDir, "bin" + File.separator + filename); return new File(projDir, "bin" + File.separator + filename);
} }
public void build(String projectName) { public void build(String projectName) {
constructUpToDateLstFile(projectName, "build.lst"); constructUpToDateLstFile(projectName, "build.lst");
doBuild(projectName); doBuild(projectName);


/** @return the number of relationship pairs */ /** @return the number of relationship pairs */
protected void printModel(String projectName) throws Exception { protected void printModel(String projectName) throws Exception {
dumptree(getModelFor(projectName).getHierarchy().getRoot(), 0);
PrintWriter pw = new PrintWriter(System.out);
getModelFor(projectName).dumprels(pw);
pw.flush();
if (AjdeInteractionTestbed.VERBOSE) {
dumptree(getModelFor(projectName).getHierarchy().getRoot(), 0);
PrintWriter pw = new PrintWriter(System.out);
getModelFor(projectName).dumprels(pw);
pw.flush();
}
} }


protected File getProjectRelativePath(String p, String filename) { protected File getProjectRelativePath(String p, String filename) {

+ 8
- 6
tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java View File

* Make sure no errors have been recorded * Make sure no errors have been recorded
*/ */
private void checkForErrors(AjCompiler compiler) { private void checkForErrors(AjCompiler compiler) {
MultiProjTestMessageHandler handler = (MultiProjTestMessageHandler) compiler.getMessageHandler();
if (handler.hasErrorMessages()) {
System.err.println("Build errors:");
for (IMessage message: handler.getErrorMessages()) {
System.err.println(message);
if (AjdeInteractionTestbed.VERBOSE) {
MultiProjTestMessageHandler handler = (MultiProjTestMessageHandler) compiler.getMessageHandler();
if (handler.hasErrorMessages()) {
System.err.println("Build errors:");
for (IMessage message : handler.getErrorMessages()) {
System.err.println(message);
}
System.err.println("---------");
} }
System.err.println("---------");
} }
} }



+ 34
- 28
tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java View File

* under the terms of the Eclipse Public License v1.0 * under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at * which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html * http://eclipse.org/legal/epl-v10.html
*
*
* Contributors: * Contributors:
* Andy Clement initial implementation * Andy Clement initial implementation
* Helen Hawkins Converted to new interface (bug 148190) * Helen Hawkins Converted to new interface (bug 148190)
* overlays for incremental builds, that is in here. As is the ability to generate valid build configs based on a directory * overlays for incremental builds, that is in here. As is the ability to generate valid build configs based on a directory
* structure. To support this we just need access to a sandbox directory - this sandbox is managed by the superclass (it only * structure. To support this we just need access to a sandbox directory - this sandbox is managed by the superclass (it only
* assumes all builds occur in <sandboxDir>/<projectName>/ ) * assumes all builds occur in <sandboxDir>/<projectName>/ )
*
*
* The idea is you can initialize multiple projects in the sandbox and they can all be built independently, hopefully exploiting * The idea is you can initialize multiple projects in the sandbox and they can all be built independently, hopefully exploiting
* incremental compilation. Between builds you can alter the contents of a project using the alter() method that overlays some set * incremental compilation. Between builds you can alter the contents of a project using the alter() method that overlays some set
* of new files onto the current set (adding new files/changing existing ones) - you can then drive a new build and check it behaves * of new files onto the current set (adding new files/changing existing ones) - you can then drive a new build and check it behaves
checkWasFullBuild(); checkWasFullBuild();
// Should both indicate that Location cannot be resolved // Should both indicate that Location cannot be resolved
assertEquals(2,getErrorMessages(p).size()); assertEquals(2,getErrorMessages(p).size());
}
}
public void testIncrementalITDInners4() throws Exception { public void testIncrementalITDInners4() throws Exception {
String p = "prInner4"; String p = "prInner4";
initialiseProject(p); initialiseProject(p);
* public void testIncrementalAspectWhitespace() throws Exception { AjdeInteractionTestbed.VERBOSE = true; String p = "xxx"; * public void testIncrementalAspectWhitespace() throws Exception { AjdeInteractionTestbed.VERBOSE = true; String p = "xxx";
* initialiseProject(p); configureNonStandardCompileOptions(p, "-showWeaveInfo"); configureShowWeaveInfoMessages(p, true); * initialiseProject(p); configureNonStandardCompileOptions(p, "-showWeaveInfo"); configureShowWeaveInfoMessages(p, true);
* build(p); * build(p);
*
*
* List weaveMessages = getWeavingMessages(p); if (weaveMessages.size() != 0) { for (Iterator iterator = * List weaveMessages = getWeavingMessages(p); if (weaveMessages.size() != 0) { for (Iterator iterator =
* weaveMessages.iterator(); iterator.hasNext();) { Object object = iterator.next(); System.out.println(object); } } * weaveMessages.iterator(); iterator.hasNext();) { Object object = iterator.next(); System.out.println(object); } }
* checkWasFullBuild(); assertNoErrors(p); alter(p, "inc1"); build(p); checkWasntFullBuild(); assertNoErrors(p); } * checkWasFullBuild(); assertNoErrors(p); alter(p, "inc1"); build(p); checkWasntFullBuild(); assertNoErrors(p); }
String p = "pr278255"; String p = "pr278255";
initialiseProject(p); initialiseProject(p);
build(p); build(p);
printModelAndRelationships(p);
if (AjdeInteractionTestbed.VERBOSE) {
printModelAndRelationships(p);
}
IRelationshipMap irm = getModelFor(p).getRelationshipMap(); IRelationshipMap irm = getModelFor(p).getRelationshipMap();
List<IRelationship> l = irm.get("=pr278255<{A.java'X`declare \\@type"); List<IRelationship> l = irm.get("=pr278255<{A.java'X`declare \\@type");
assertNotNull(l); assertNotNull(l);


/* /*
* A.aj package pack; public aspect A { pointcut p() : call( C.method before() : p() { // line 7 } } * A.aj package pack; public aspect A { pointcut p() : call( C.method before() : p() { // line 7 } }
*
*
* C.java package pack; public class C { public void method1() { method2(); // line 6 } public void method2() { } public void * C.java package pack; public class C { public void method1() { method2(); // line 6 } public void method2() { } public void
* method3() { method2(); // line 13 } * method3() { method2(); // line 13 }
*
*
* } * }
*/ */
public void testDontLoseAdviceMarkers_pr134471() { public void testDontLoseAdviceMarkers_pr134471() {
// see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false; // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false;
initialiseProject("P4"); initialiseProject("P4");
build("P4"); build("P4");
Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after full build where advice is applying");
if (AjdeInteractionTestbed.VERBOSE) {
Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after full build where advice is applying");
}
// should be 4 relationship entries // should be 4 relationship entries


// In inc1 the first advised line is 'commented out' // In inc1 the first advised line is 'commented out'
alter("P4", "inc1"); alter("P4", "inc1");
build("P4"); build("P4");
checkWasntFullBuild(); checkWasntFullBuild();
Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after inc build where first advised line is gone");
if (AjdeInteractionTestbed.VERBOSE) {
Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after inc build where first advised line is gone");
}
// should now be 2 relationship entries // should now be 2 relationship entries


// This will be the line 6 entry in C.java // This will be the line 6 entry in C.java
/* /*
* public void testGenericITD_pr262257() throws IOException { String p = "pr262257"; initialiseProject(p); build(p); * public void testGenericITD_pr262257() throws IOException { String p = "pr262257"; initialiseProject(p); build(p);
* checkWasFullBuild(); * checkWasFullBuild();
*
*
* dumptree(getModelFor(p).getHierarchy().getRoot(), 0); PrintWriter pw = new PrintWriter(System.out); * dumptree(getModelFor(p).getHierarchy().getRoot(), 0); PrintWriter pw = new PrintWriter(System.out);
* getModelFor(p).dumprels(pw); pw.flush(); } * getModelFor(p).dumprels(pw); pw.flush(); }
*/ */
*/ */
/* /*
* public void testProblemCopyingResources_pr138171() { initialiseProject("PR138171"); * public void testProblemCopyingResources_pr138171() { initialiseProject("PR138171");
*
*
* File f=getProjectRelativePath("PR138171","res.txt"); Map m = new HashMap(); m.put("res.txt",f); * File f=getProjectRelativePath("PR138171","res.txt"); Map m = new HashMap(); m.put("res.txt",f);
* AjdeInteractionTestbed.MyProjectPropertiesAdapter .getInstance().setSourcePathResources(m); build("PR138171"); File f2 = * AjdeInteractionTestbed.MyProjectPropertiesAdapter .getInstance().setSourcePathResources(m); build("PR138171"); File f2 =
* getProjectOutputRelativePath("PR138171","res.txt"); boolean successful = f2.setReadOnly(); * getProjectOutputRelativePath("PR138171","res.txt"); boolean successful = f2.setReadOnly();
*
*
* alter("PR138171","inc1"); AjdeInteractionTestbed.MyProjectPropertiesAdapter .getInstance().setSourcePathResources(m); * alter("PR138171","inc1"); AjdeInteractionTestbed.MyProjectPropertiesAdapter .getInstance().setSourcePathResources(m);
* build("PR138171"); List msgs = MyTaskListManager.getErrorMessages(); assertTrue("there should be one message but there are " * build("PR138171"); List msgs = MyTaskListManager.getErrorMessages(); assertTrue("there should be one message but there are "
* +(msgs==null?0:msgs.size())+":\n"+msgs,msgs!=null && msgs.size()==1); IMessage msg = (IMessage)msgs.get(0); String exp = * +(msgs==null?0:msgs.size())+":\n"+msgs,msgs!=null && msgs.size()==1); IMessage msg = (IMessage)msgs.get(0); String exp =
build("P2"); build("P2");
checkWasntFullBuild(); checkWasntFullBuild();
} }
public void testBuildingBrokenCode_pr240360() { public void testBuildingBrokenCode_pr240360() {
initialiseProject("pr240360"); initialiseProject("pr240360");
// configureNonStandardCompileOptions("pr240360","-proceedOnError"); // configureNonStandardCompileOptions("pr240360","-proceedOnError");
/** /**
* The C.java file modified in this test has an inner class - this means the inner class has a this$0 field and <init>(C) ctor * The C.java file modified in this test has an inner class - this means the inner class has a this$0 field and <init>(C) ctor
* to watch out for when checking for structural changes * to watch out for when checking for structural changes
*
*
*/ */
public void testStateManagement3() { public void testStateManagement3() {
File binDirForInterproject1 = new File(getFile("interprojectdeps1", "bin")); File binDirForInterproject1 = new File(getFile("interprojectdeps1", "bin"));
/** /**
* The C.java file modified in this test has an inner class - which has two ctors - this checks how they are mangled with an * The C.java file modified in this test has an inner class - which has two ctors - this checks how they are mangled with an
* instance of C. * instance of C.
*
*
*/ */
public void testStateManagement4() { public void testStateManagement4() {
File binDirForInterproject2 = new File(getFile("interprojectdeps2", "bin")); File binDirForInterproject2 = new File(getFile("interprojectdeps2", "bin"));
/** /**
* The C.java file modified in this test has an inner class - it has two ctors but also a reference to C.this in it - which will * The C.java file modified in this test has an inner class - it has two ctors but also a reference to C.this in it - which will
* give rise to an accessor being created in C * give rise to an accessor being created in C
*
*
*/ */
public void testStateManagement5() { public void testStateManagement5() {
File binDirForInterproject3 = new File(getFile("interprojectdeps3", "bin")); File binDirForInterproject3 = new File(getFile("interprojectdeps3", "bin"));
* public void testPrReducingDependentBuilds_001_221427() { AjdeInteractionTestbed.VERBOSE=true; * public void testPrReducingDependentBuilds_001_221427() { AjdeInteractionTestbed.VERBOSE=true;
* IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_1"); initialiseProject("P221427_2"); * IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_1"); initialiseProject("P221427_2");
* configureNewProjectDependency("P221427_2","P221427_1"); * configureNewProjectDependency("P221427_2","P221427_1");
*
*
* build("P221427_1"); build("P221427_2"); alter("P221427_1","inc1"); // rename private class in super project * build("P221427_1"); build("P221427_2"); alter("P221427_1","inc1"); // rename private class in super project
* MyStateListener.reset(); build("P221427_1"); build("P221427_2"); * MyStateListener.reset(); build("P221427_1"); build("P221427_2");
*
*
* AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_1","bin"))); * AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_1","bin")));
* assertTrue("There should be state for project P221427_1",ajs!=null); * assertTrue("There should be state for project P221427_1",ajs!=null);
* //System.out.println(MyStateListener.getInstance().getDecisions()); checkWasntFullBuild(); * //System.out.println(MyStateListener.getInstance().getDecisions()); checkWasntFullBuild();
* assertTrue("Should be one structural change but there were "+ ajs.getNumberOfStructuralChangesSinceLastFullBuild(), * assertTrue("Should be one structural change but there were "+ ajs.getNumberOfStructuralChangesSinceLastFullBuild(),
* ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1); * ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1);
*
*
* } * }
*
*
* // Case002: changing a class to final that is extended in a dependent project public void * // Case002: changing a class to final that is extended in a dependent project public void
* testPrReducingDependentBuilds_002_221427() { AjdeInteractionTestbed.VERBOSE=true; * testPrReducingDependentBuilds_002_221427() { AjdeInteractionTestbed.VERBOSE=true;
* IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_3"); initialiseProject("P221427_4"); * IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_3"); initialiseProject("P221427_4");
* configureNewProjectDependency("P221427_4","P221427_3"); * configureNewProjectDependency("P221427_4","P221427_3");
*
*
* build("P221427_3"); build("P221427_4"); // build OK, type in super project is non-final alter("P221427_3","inc1"); // change * build("P221427_3"); build("P221427_4"); // build OK, type in super project is non-final alter("P221427_3","inc1"); // change
* class declaration in super-project to final MyStateListener.reset(); build("P221427_3"); build("P221427_4"); // build FAIL, * class declaration in super-project to final MyStateListener.reset(); build("P221427_3"); build("P221427_4"); // build FAIL,
* type in super project is now final * type in super project is now final
*
*
* AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_3","bin"))); * AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_3","bin")));
* assertTrue("There should be state for project P221427_3",ajs!=null); * assertTrue("There should be state for project P221427_3",ajs!=null);
* System.out.println(MyStateListener.getInstance().getDecisions()); * System.out.println(MyStateListener.getInstance().getDecisions());
*
*
* List errors = getErrorMessages("P221427_4"); if (errors.size()!=1) { if (errors.size()==0) * List errors = getErrorMessages("P221427_4"); if (errors.size()!=1) { if (errors.size()==0)
* fail("Expected error about not being able to extend final class"); for (Iterator iterator = errors.iterator(); * fail("Expected error about not being able to extend final class"); for (Iterator iterator = errors.iterator();
* iterator.hasNext();) { Object object = (Object) iterator.next(); System.out.println(object); } * iterator.hasNext();) { Object object = (Object) iterator.next(); System.out.println(object); }
* fail("Expected 1 error but got "+errors.size()); } // assertTrue("Shouldn't be one structural change but there were "+ // * fail("Expected 1 error but got "+errors.size()); } // assertTrue("Shouldn't be one structural change but there were "+ //
* ajs.getNumberOfStructuralChangesSinceLastFullBuild(), // ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1); * ajs.getNumberOfStructuralChangesSinceLastFullBuild(), // ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1);
*
*
* } * }
*/ */
// test for comment #6 - simulates AJDT core builder test testBug99133a - // test for comment #6 - simulates AJDT core builder test testBug99133a -
build("PR154054"); build("PR154054");
checkWasntFullBuild(); checkWasntFullBuild();
} }
public void testIncrementalBuildAdviceChange_456801() throws Exception { public void testIncrementalBuildAdviceChange_456801() throws Exception {
initialiseProject("456801"); initialiseProject("456801");
build("456801"); build("456801");
/** /**
* Retrieve program elements related to this one regardless of the relationship. A JUnit assertion is made that the number that * Retrieve program elements related to this one regardless of the relationship. A JUnit assertion is made that the number that
* the 'expected' number are found. * the 'expected' number are found.
*
*
* @param programElement Program element whose related elements are to be found * @param programElement Program element whose related elements are to be found
* @param expected the number of expected related elements * @param expected the number of expected related elements
*/ */
} }
} }
List<IProgramElement> kids = ipe.getChildren(); List<IProgramElement> kids = ipe.getChildren();
for (IProgramElement kid: kids) {
for (IProgramElement kid: kids) {
IProgramElement found = findAdvice(kid, whichOne); IProgramElement found = findAdvice(kid, whichOne);
if (found != null) { if (found != null) {
return found; return found;

Loading…
Cancel
Save