Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK2.sh
38918 views
#!/bin/ksh -p12#3# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.5#6# This code is free software; you can redistribute it and/or modify it7# under the terms of the GNU General Public License version 2 only, as8# published by the Free Software Foundation.9#10# This code is distributed in the hope that it will be useful, but WITHOUT11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13# version 2 for more details (a copy is included in the LICENSE file that14# accompanied this code).15#16# You should have received a copy of the GNU General Public License version17# 2 along with this work; if not, write to the Free Software Foundation,18# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19#20# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21# or visit www.oracle.com if you need additional information or have any22# questions.23#2425# @test26# @summary Try to force GTK2. We must bail out to GTK3 (if any) if no 2 available.27#28# @compile ProvokeGTK.java29# @requires os.family == "linux"30# @run shell/timeout=400 DemandGTK2.sh3132#33# Note that we depend on34# strace in the PATH35# /sbin/ldconfig (which may be not in PATH)36# It is true for OEL 7 and Ubuntu 14, 1637# but may fail in future. Save tomorrow for tomorrow.38#39# Read DemandGTK2.txt how to prepare GTK2-less machine.40#4142which strace43if [ $? -ne 0 ]44then45echo "Please provide strace: \"which strace\" failed."46exit 147fi4849HAVE_2=`/sbin/ldconfig -v 2>/dev/null | grep libgtk-x11-2 | wc -l`50HAVE_3=`/sbin/ldconfig -v 2>/dev/null | grep libgtk-3.so | wc -l`515253if [ "${HAVE_2}" = "0" ]54then5556if [ "${HAVE_3}" = "0" ]57then58echo "Neither GTK2 nor GTK3 found: system misconfiguration. Exit."59exit 160fi61echo "No GTK 2 library found: we should bail out to 3"62strace -o strace.log -fe open ${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} -Djdk.gtk.version=2 ProvokeGTK63EXECRES=$?64grep 'libgtk-3.*=\ *[0-9]*$' strace.log > logg65else66echo "There is GTK 2 library: we should use it"67strace -o strace.log -fe open ${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} -Djdk.gtk.version=2 ProvokeGTK68EXECRES=$?69grep 'libgtk-x11.*=\ *[0-9]*$' strace.log > logg70fi7172if [ ${EXECRES} -ne 0 ]73then74echo "java execution failed for unknown reason, see logs"75exit 276fi7778cat logg79if [ -s logg ]80then81echo "Success."82exit 083else84echo "Failed. Examine logs."85exit 386fi878889