Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK2.sh
38918 views
1
#!/bin/ksh -p
2
3
#
4
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6
#
7
# This code is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License version 2 only, as
9
# published by the Free Software Foundation.
10
#
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
16
#
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
23
# questions.
24
#
25
26
# @test
27
# @summary Try to force GTK2. We must bail out to GTK3 (if any) if no 2 available.
28
#
29
# @compile ProvokeGTK.java
30
# @requires os.family == "linux"
31
# @run shell/timeout=400 DemandGTK2.sh
32
33
#
34
# Note that we depend on
35
# strace in the PATH
36
# /sbin/ldconfig (which may be not in PATH)
37
# It is true for OEL 7 and Ubuntu 14, 16
38
# but may fail in future. Save tomorrow for tomorrow.
39
#
40
# Read DemandGTK2.txt how to prepare GTK2-less machine.
41
#
42
43
which strace
44
if [ $? -ne 0 ]
45
then
46
echo "Please provide strace: \"which strace\" failed."
47
exit 1
48
fi
49
50
HAVE_2=`/sbin/ldconfig -v 2>/dev/null | grep libgtk-x11-2 | wc -l`
51
HAVE_3=`/sbin/ldconfig -v 2>/dev/null | grep libgtk-3.so | wc -l`
52
53
54
if [ "${HAVE_2}" = "0" ]
55
then
56
57
if [ "${HAVE_3}" = "0" ]
58
then
59
echo "Neither GTK2 nor GTK3 found: system misconfiguration. Exit."
60
exit 1
61
fi
62
echo "No GTK 2 library found: we should bail out to 3"
63
strace -o strace.log -fe open ${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} -Djdk.gtk.version=2 ProvokeGTK
64
EXECRES=$?
65
grep 'libgtk-3.*=\ *[0-9]*$' strace.log > logg
66
else
67
echo "There is GTK 2 library: we should use it"
68
strace -o strace.log -fe open ${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} -Djdk.gtk.version=2 ProvokeGTK
69
EXECRES=$?
70
grep 'libgtk-x11.*=\ *[0-9]*$' strace.log > logg
71
fi
72
73
if [ ${EXECRES} -ne 0 ]
74
then
75
echo "java execution failed for unknown reason, see logs"
76
exit 2
77
fi
78
79
cat logg
80
if [ -s logg ]
81
then
82
echo "Success."
83
exit 0
84
else
85
echo "Failed. Examine logs."
86
exit 3
87
fi
88
89