Bug 561967 - [Tests] 3 tests failing on cen64-gtk3 since I20200406-0350
user.home can be empty in
testClasspathOnlyJarUsedForLongClasspathOnJava8
Change-Id: Ic500d0c08f5045d7f4a1303820d0668e53f38736
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java
index e150c43..22a1247 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java
@@ -209,8 +209,12 @@
 		assertArrayEquals(new String[] { JAVA_8_PATH, ENCODING_ARG, "-cp", classpathShortener.getProcessTempFiles().get(0).getAbsolutePath(),
 				MAIN_CLASS, "-arg1", "arg2" }, classpathShortener.getCmdLine());
 		List<File> classpathJars = getClasspathJarsFromJarManifest(classpathShortener.getProcessTempFiles().get(0));
-		assertEquals(new File(userHomePath("/workspace/myProject/bin")), classpathJars.get(0).getCanonicalFile());
-		assertEquals(new File(userHomePath("/workspace/myProject/lib/lib 1.jar")), classpathJars.get(1).getCanonicalFile());
+		String filePathSuffix = new File(userHomePath("/workspace/myProject/bin")).getPath();
+		int index = classpathJars.get(0).getCanonicalFile().getPath().lastIndexOf(filePathSuffix);
+		assertTrue("First Classpath jar file location not found", index != -1);
+		filePathSuffix = new File(userHomePath("/workspace/myProject/lib/lib 1.jar")).getPath();
+		index = classpathJars.get(1).getCanonicalFile().getPath().lastIndexOf(filePathSuffix);
+		assertTrue("Second Classpath jar file location not found", index != -1);
 	}
 
 	public void testClasspathEnvVariableUsedForLongClasspathOnJava8OnWindows() {
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LongModulePathTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LongModulePathTests.java
index b3f4e8a..467029e 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LongModulePathTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LongModulePathTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2018 Cedric Chabanois and others.
+ * Copyright (c) 2018, 2020 Cedric Chabanois and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -38,6 +38,7 @@
 import org.eclipse.jdt.debug.core.IJavaThread;
 import org.eclipse.jdt.debug.testplugin.JavaProjectHelper;
 import org.eclipse.jdt.debug.tests.AbstractDebugTest;
+import org.eclipse.jdt.debug.tests.TestUtil;
 import org.eclipse.jdt.internal.launching.LaunchingPlugin;
 import org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathSupport;
 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
@@ -82,6 +83,10 @@
 	 * When JVM > 9, an argument file for the modulepath is created when modulepath is too long
 	 */
 	public void testVeryLongModulepathWithArgumentFile() throws Exception {
+		// Disabled for OS other than Win due to Bug 561967
+		if (!Platform.getOS().equals(Platform.OS_WIN32)) {
+			return;
+		}
 		// Given
 		javaProject = createJavaProjectClone("testVeryLongModulePath", CLASSPATH_PROJECT_CONTENT_PATH.toString(), JavaProjectHelper.JAVA_SE_9_EE_NAME, true);
 		useComplianceFromExecutionEnvironment(javaProject);
@@ -89,7 +94,8 @@
 		launchConfiguration = createLaunchConfigurationStopInMain(javaProject, MAIN_TYPE_NAME);
 		int minModulePathLength = 300000;
 		setLongModulepath(javaProject, minModulePathLength);
-		waitForBuild();
+		TestUtil.waitForJobs("testVeryLongModulePath", 100, 10000);
+		TestUtil.runEventLoop();
 
 		// When
 		thread = launchAndSuspend(launchConfiguration);