forked from eclipse-jdt/eclipse.jdt.core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup classpath & workspace between suites, improve common setup
The main goal is to be more verbose on any unexpected error, do not hide them, have clean and consistent environment between testsuites executions and between local/Jenkins executions. Many testsuites are written in a different style and do some assertions related to the way how testsuite shares common setup data between different tests extending the testsuite. Unfortunately the logic is complicated to understand and so many testsuites leave environment in a different state as before (e.g. leraking created projects, settings like classpath variables etc). As a short term solution CleanupAfterSuiteTests can be added after such "messy" test suites to cleanup environment for the following testsuites. Extracted / added common code for cleanup: - org.eclipse.jdt.core.tests.util.Util.cleanupWorkspace(String) - org.eclipse.jdt.core.tests.util.Util.cleanupClassPathVariablesAndContainers() Added resource settings in bug.test.b534624 for ModuleBuilderTests.testBug534624a, otherwise the test fails with unrelated warning about missing encoding. Changes setup of CompletionTests, CompletionTests2 and parent class to avoid errors that happen if both testsuites run together. See eclipse-jdt#2536
- Loading branch information
1 parent
2791d16
commit d00b5e4
Showing
15 changed files
with
237 additions
and
139 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...e.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/CleanupAfterSuiteTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Andrey Loskutov ([email protected]) and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Andrey Loskutov ([email protected]) - initial implementation | ||
*******************************************************************************/ | ||
package org.eclipse.jdt.core.tests.util; | ||
|
||
import junit.framework.Test; | ||
import junit.framework.TestSuite; | ||
|
||
public class CleanupAfterSuiteTests extends junit.framework.TestCase { | ||
|
||
private static int count = 1; | ||
|
||
public CleanupAfterSuiteTests(String name) { | ||
super(name); | ||
} | ||
|
||
public static Test suite() { | ||
TestSuite testSuite = new TestSuite("HouseKeeping_" + count); | ||
testSuite.addTest(new TestSuite(CleanupAfterSuiteTests.class)); | ||
return testSuite; | ||
} | ||
|
||
public void testCleanupWorkspace() throws Exception { | ||
System.out.println("Starting cleaning up workspace"); | ||
Util.cleanupWorkspace(getClass().getName()); | ||
System.out.println("Done cleaning up workspace"); | ||
} | ||
|
||
public void testCleanupJavaModel() throws Exception { | ||
System.out.println("Starting cleaning up Java Model"); | ||
Util.cleanupClassPathVariablesAndContainers(); | ||
System.out.println("Done cleaning up Java Model"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.