Skip to content

Commit 2ca37cb

Browse files
mkartashevjbrbot
authored and
jbrbot
committed
JBR-8572 Wayland: java/awt/Desktop/DesktopGtkLoadTest/DesktopGtkLoadTest.java: Wrong GTK library version: null
1 parent 97632d3 commit 2ca37cb

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

src/java.desktop/unix/native/libawt_wlawt/gtk_interface.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ static const gint DEFAULT = 1 << 10;
440440

441441
typedef enum
442442
{
443-
GTK_ANY,
444-
GTK_3
443+
GTK_ANY = 0,
444+
GTK_3 = 3
445445
} GtkVersion;
446446

447447
typedef enum {

test/jdk/java/awt/Desktop/DesktopGtkLoadTest/DesktopGtkLoadTest.java

+11-20
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@
2828
* @summary AWT_Desktop/Automated/Exceptions/BasicTest loads incorrect GTK
2929
* version when jdk.gtk.version=3
3030
* @requires (os.family == "linux")
31+
* @library /test/lib
3132
* @run main DesktopGtkLoadTest
3233
*/
3334

35+
import jdk.test.lib.process.OutputAnalyzer;
36+
import jdk.test.lib.process.ProcessTools;
3437

3538
import java.awt.*;
3639
import java.io.*;
@@ -43,26 +46,14 @@ public static void main(String[] args) {
4346
}
4447

4548
public static void main(String[] args) throws Exception {
46-
Process p = Runtime.getRuntime().exec(System.getProperty("java.home") +
47-
"/bin/java -Djdk.gtk.version=3 -Djdk.gtk.verbose=true " +
48-
"-cp " + System.getProperty("java.class.path", ".") +
49-
" DesktopGtkLoadTest$RunDesktop");
50-
p.waitFor();
51-
try (BufferedReader br = new BufferedReader(
52-
new InputStreamReader(p.getErrorStream()))) {
53-
String line;
54-
while ((line = br.readLine()) != null) {
55-
System.out.println(line);
56-
if (line.contains("Looking for GTK2 library")) {
57-
break;
58-
}
59-
if (line.contains("Looking for GTK3 library")) {
60-
return;
61-
}
62-
}
63-
throw new RuntimeException("Wrong GTK library version: \n" + line);
64-
}
65-
49+
final ProcessBuilder pbJava = ProcessTools.createTestJavaProcessBuilder(
50+
"-Djdk.gtk.version=3",
51+
"-Djdk.gtk.verbose=true",
52+
RunDesktop.class.getName()
53+
);
54+
final OutputAnalyzer output = ProcessTools.executeProcess(pbJava);
55+
output.shouldNotContain("Looking for GTK2 library");
56+
output.shouldContain("Looking for GTK3 library");
6657
}
6758

6859
}

0 commit comments

Comments
 (0)