From 126cf32803c0d1e276d5283d33a1db2df43364c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20Svensson?= Date: Thu, 28 Oct 2021 21:20:14 +0200 Subject: [PATCH] [test] Remove projects from workspace even on failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If these tests fail, they cause a series of metadata corruption that will render most/all test executed after as unreliable. Usually, there is about ~150 test cases that fail without reason when one of these fails. Contributed by STMicroelectronics Change-Id: Ic71ace8b6a55c49dd729d40385b245f12dbd6d85 Signed-off-by: Torbjörn Svensson --- .../tests/ManagedProject21MakefileTests.java | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject21MakefileTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject21MakefileTests.java index c0a0c689686..406ea6ec5ec 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject21MakefileTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject21MakefileTests.java @@ -156,42 +156,42 @@ public class ManagedProject21MakefileTests extends TestCase { return false; boolean succeeded = true; - for (int i = 0; i < projects.length; i++) { - IProject curProject = projects[i]; + try { + for (int i = 0; i < projects.length; i++) { + IProject curProject = projects[i]; - IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject); + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject); - //check whether the managed build info is converted - boolean isCompatible = UpdateManagedProjectManager.isCompatibleProject(info); - assertTrue(isCompatible); + //check whether the managed build info is converted + boolean isCompatible = UpdateManagedProjectManager.isCompatibleProject(info); + assertTrue(isCompatible); - if (isCompatible) { - // Build the project in order to generate the maekfiles - try { - curProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null); - } catch (CoreException e) { - fail(e.getStatus().getMessage()); - } catch (OperationCanceledException e) { - fail("the project \"" + curProject.getName() + "\" build was cancelled, exception message: " - + e.getMessage()); - } + if (isCompatible) { + // Build the project in order to generate the maekfiles + try { + curProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null); + } catch (CoreException e) { + fail(e.getStatus().getMessage()); + } catch (OperationCanceledException e) { + fail("the project \"" + curProject.getName() + "\" build was cancelled, exception message: " + + e.getMessage()); + } - //compare the generated makefiles to their benchmarks - if (files != null && files.length > 0) { - if (i == 0) { - String configName = info.getDefaultConfiguration().getName(); - IPath buildDir = Path.fromOSString(configName); - // succeeded = ManagedBuildTestHelper.compareBenchmarks(curProject, buildDir, files); - IPath benchmarkLocationBase = resourcesLocation.append(benchmarkDir); - IPath buildLocation = curProject.getLocation().append(buildDir); - succeeded = ManagedBuildTestHelper.compareBenchmarks(curProject, buildLocation, files, - benchmarkLocationBase); + //compare the generated makefiles to their benchmarks + if (files != null && files.length > 0) { + if (i == 0) { + String configName = info.getDefaultConfiguration().getName(); + IPath buildDir = Path.fromOSString(configName); + // succeeded = ManagedBuildTestHelper.compareBenchmarks(curProject, buildDir, files); + IPath benchmarkLocationBase = resourcesLocation.append(benchmarkDir); + IPath buildLocation = curProject.getLocation().append(buildDir); + succeeded = ManagedBuildTestHelper.compareBenchmarks(curProject, buildLocation, files, + benchmarkLocationBase); + } } } } - } - - if (succeeded) { // Otherwise leave the projects around for comparison + } finally { for (int i = 0; i < projects.length; i++) ManagedBuildTestHelper.removeProject(projects[i].getName()); }