jdk/test/start-Xvfb.sh
author goetz
Mon, 10 Mar 2014 12:58:02 +0100
changeset 23221 b70675ece1ce
parent 5506 202f599c92aa
child 41107 567f832618d7
permissions -rw-r--r--
8036976: PPC64: implement the template interpreter Reviewed-by: kvn, coleenp Contributed-by: axel.siebenborn@sap.com, martin.doerr@sap.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4187
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
     1
#!/bin/sh -f
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
     2
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4187
diff changeset
     3
# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
4187
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
     5
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4187
diff changeset
     8
# published by the Free Software Foundation.  Oracle designates this
4187
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
     9
# particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4187
diff changeset
    10
# by Oracle in the LICENSE file that accompanied this code.
4187
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    11
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    12
# This code is distributed in the hope that it will be useful, but WITHOUT
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    13
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    14
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    15
# version 2 for more details (a copy is included in the LICENSE file that
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    16
# accompanied this code).
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    17
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    18
# You should have received a copy of the GNU General Public License version
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    19
# 2 along with this work; if not, write to the Free Software Foundation,
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    20
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    21
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4187
diff changeset
    22
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4187
diff changeset
    23
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4187
diff changeset
    24
# questions.
4187
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    25
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    26
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    27
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    28
# Original Author: Tim Bell
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    29
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    30
usage() {
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    31
   echo "Starts up an Xvfb dummy X server with fvwm2 window manager"
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    32
   echo " usage:"
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    33
   echo "    ${0} display_number_file"
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    34
   echo "        display_number_file gets display number when it's ready"
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    35
   exit
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    36
 }
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    37
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    38
currentDir=`pwd`
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    39
rm -f $1
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    40
DD=":$$"
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    41
DISPLAY=${DD}
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    42
export DISPLAY
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    43
cd /tmp
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    44
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    45
if [ ! -x "/usr/bin/X11/Xvfb" ]; then
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    46
  # We have Solaris-flavored X windows, and the /usr/openwin Xvfb is
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    47
  # a simple wrapper script around the Xsun server.  Massage the
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    48
  # arguments: server number must be first; others are slightly
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    49
  # different.
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    50
  #
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    51
  # Also the default Visual Class (DirectColor) triggers an awt bug
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    52
  # (probably 4131533/6505852) and some tests will loop endlessly
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    53
  # when they hit the display.  The workaround is:
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    54
  #  1) Ask for PseudoColor instead.
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    55
  #  2) Omit 32-bit depth.
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    56
  /usr/bin/nohup /usr/openwin/bin/Xvfb ${DISPLAY} -dev vfb screen 0 1280x1024x24 pixdepths 8 16 24 defclass PseudoColor > ${currentDir}/nohup.$$ 2>&1 &
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    57
else
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    58
  # Linux...
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    59
  /usr/bin/nohup /usr/bin/X11/Xvfb -fbdir ${currentDir} -pixdepths 8 16 24 32 ${DISPLAY} > ${currentDir}/nohup.$$ 2>&1 &
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    60
fi
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    61
WM="/usr/bin/X11/fvwm2"
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    62
if [ ! -x ${WM} ] ; then
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    63
  WM="/opt/sfw/bin/fvwm2"
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    64
fi
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    65
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    66
# Wait for Xvfb to initialize:
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    67
sleep 5
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    68
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    69
if [ -x "${WM}" ]; then
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    70
# 2 JCK tests require a window manager
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    71
# mwm fails (key name errors) and twm fails (hangs),
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    72
# but fvwm2 works well.
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    73
  /usr/bin/nohup ${WM} -display ${DISPLAY} -replace -f /dev/null > ${currentDir}/nohup.$$ 2>&1 &
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    74
else
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    75
  echo "Error: ${WM} not found"
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    76
  exit 1
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    77
fi
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    78
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    79
# Wait some more to see if the xhost command gets through:
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    80
sleep 10
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    81
# Allow access to all - this is a brute force approach,
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    82
# but I do not see how it could be a security problem...
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    83
DISPLAY="${DD}" xhost +
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    84
#
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    85
echo "Virtual frame buffer started on ${DISPLAY}"
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    86
echo "$$" > $1
d7111a88f0ec 6888927: Fix jdk jtreg tests to indicate which ones need othervm, allow for use of samevm option
ohair
parents:
diff changeset
    87
wait