Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK3.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#242526# @test27# @summary Try to force GTK3. We must bail out to GTK2 if no 3 available.28#29# @compile ProvokeGTK.java30# @requires os.family == "linux"31# @run shell/timeout=400 DemandGTK3.sh3233#34# Note that we depend on35# strace in the PATH36# /sbin/ldconfig (which may be is not in PATH)37# It is true for OEL 7 and Ubuntu 14, 1638# but may fail in future. Save tomorrow for tomorrow.39#4041which strace42if [ $? -ne 0 ]43then44echo "Please provide strace: \"which strace\" failed."45exit 146fi4748HAVE_3=`/sbin/ldconfig -v 2>/dev/null | grep libgtk-3.so | wc -l`495051if [ "${HAVE_3}" = "0" ]52then5354echo "No GTK 3 library found: we should bail out to 2"55strace -o strace.log -fe open ${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} -Djdk.gtk.version=3 ProvokeGTK56EXECRES=$?57grep 'libgtk-x11.*=\ *[0-9]*$' strace.log > logg58else59echo "There is GTK 3 library: we should use it"60strace -o strace.log -fe open ${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} -Djdk.gtk.version=3 ProvokeGTK61EXECRES=$?62grep 'libgtk-3.*=\ *[0-9]*$' strace.log > logg63fi6465if [ ${EXECRES} -ne 0 ]66then67echo "java execution failed for unknown reason, see logs"68exit 269fi7071cat logg72if [ -s logg ]73then74echo "Success."75exit 076else77echo "Failed. Examine logs."78exit 379fi808182