jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK3.sh
author goetz
Tue, 14 Jun 2016 10:44:59 +0200
changeset 39056 d99e63b6d962
parent 38410 bbecc75e4521
permissions -rw-r--r--
8159690: [TESTBUG] Mark headful tests with @key headful. Reviewed-by: simonis, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38410
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
     1
#!/bin/ksh -p
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
     2
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
     3
#
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
     4
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
     6
#
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
     9
# published by the Free Software Foundation.
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    10
#
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    15
# accompanied this code).
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    16
#
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    20
#
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    23
# questions.
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    24
#
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    25
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    26
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    27
#   @test
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    28
#   @summary  Try to force GTK3. We must bail out to GTK2 if no 3 available.
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    29
#
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 38410
diff changeset
    30
#   @key headful
38410
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    31
#   @compile ProvokeGTK.java
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    32
#   @requires os.family == "linux"
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    33
#   @run shell/timeout=400 DemandGTK3.sh
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    34
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    35
#
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    36
# Note that we depend on
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    37
# strace in the PATH
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    38
# /sbin/ldconfig (which may be is not in PATH)
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    39
# It is true for OEL 7 and Ubuntu 14, 16
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    40
# but may fail in future. Save tomorrow for tomorrow.
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    41
#
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    42
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    43
which strace
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    44
if [ $?  -ne 0 ]
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    45
then
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    46
    echo "Please provide strace: \"which strace\" failed."
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    47
    exit 1
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    48
fi
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    49
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    50
HAVE_3=`/sbin/ldconfig -v 2>/dev/null | grep libgtk-3.so | wc -l`
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    51
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    52
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    53
if [ "${HAVE_3}" = "0" ]
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    54
then
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    55
    
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    56
    echo "No GTK 3 library found: we should bail out to 2"
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    57
    strace -o strace.log -fe open ${TESTJAVA}/bin/java  -cp ${TESTCLASSPATH}  -Djdk.gtk.version=3 ProvokeGTK
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    58
    EXECRES=$?
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    59
    grep  'libgtk-x11.*=\ *[0-9]*$' strace.log > logg
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    60
else
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    61
    echo "There is GTK 3 library: we should use it"
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    62
    strace -o strace.log -fe open ${TESTJAVA}/bin/java  -cp ${TESTCLASSPATH}  -Djdk.gtk.version=3 ProvokeGTK
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    63
    EXECRES=$?
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    64
    grep  'libgtk-3.*=\ *[0-9]*$' strace.log > logg
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    65
fi
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    66
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    67
if [ ${EXECRES}  -ne 0 ]
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    68
then
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    69
    echo "java execution failed for unknown reason, see logs"
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    70
    exit 2
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    71
fi
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    72
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    73
cat logg
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    74
if [  -s logg ]
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    75
then
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    76
    echo "Success."
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    77
    exit 0
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    78
else
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    79
    echo "Failed. Examine logs."
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    80
    exit 3
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    81
fi
bbecc75e4521 8156128: Tests for [AWT/Swing] Conditional support for GTK 3 on Linux
yan
parents:
diff changeset
    82