From f71abdf19bdcf3ccfcc5455cb15aff4e93d468bb Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Sat, 21 Jan 2023 04:15:35 +0100
Subject: TestSharedContextVBOES2NEWT5: Try harder having the objects destroyed
 and taken from the GLContextShareSet map

The objects were more sticky on my MacOS 12 x86_64 machine, this double GC w/ sleep 100ms resolved it.
---
 make/scripts/tests.sh                                    | 16 ++++++++++------
 .../junit/jogl/acore/TestSharedContextVBOES2NEWT5.java   |  8 +++++++-
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index d95d2babd..f3b6428d5 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -803,12 +803,6 @@ function testawtswt() {
 #testawtswt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasSWTAWT $*
 #testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTBug643AsyncExec $*
 
-testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
-
 #
 # newt.awt (testawt)
 #
@@ -963,6 +957,16 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
 #testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT $*
 #testawt com.jogamp.opengl.test.junit.jogl.acore.TestBug1398Deadlock02AWT $*
 
+# OSX OpenJDK17 x86_64
+testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT5 $*
+#testawt   com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextWithJTabbedPaneAWT $*
+#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersAWTCanvas $*
+#testawt com.jogamp.opengl.test.junit.newt.event.TestParentingFocus02SwingAWTRobot $*
+#testswt   com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 $*
+#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.swt.TestGearsES2SWT $*
+#testswt com.jogamp.opengl.test.junit.jogl.swt.TestGLCanvasSWTNewtCanvasSWTPosInTabs $*
+#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTBug643AsyncExec $*
+
 #
 # to re-test:
 #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug658NEWT $*
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT5.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT5.java
index 4380b2dc5..8317bb0c1 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT5.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT5.java
@@ -204,7 +204,13 @@ public class TestSharedContextVBOES2NEWT5 extends UITestCase {
                 sf[i] = null;
                 sc[i] = null;
             }
-            System.gc();
+            {
+                // Ensure nulled objects got destroyed and taken from the GLContextShareSet map.
+                System.gc();
+                try { Thread.sleep(100); } catch (final InterruptedException ie) {}
+                System.gc();
+                try { Thread.sleep(100); } catch (final InterruptedException ie) {}
+            }
             System.err.println("XXX-"+j+"-X-SX2 - GLContextShareSet.Map");
             GLContextShareSet.printMap(System.err);
             Assert.assertEquals("GLContextShareSet ctx1.createdCount is not 1", 1, GLContextShareSet.getCreatedShareCount(ctx1));
-- 
cgit v1.2.3