Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/start-Xvfb.sh
38763 views
#!/bin/sh -f1#2# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4#5# This code is free software; you can redistribute it and/or modify it6# under the terms of the GNU General Public License version 2 only, as7# published by the Free Software Foundation. Oracle designates this8# particular file as subject to the "Classpath" exception as provided9# by Oracle in the LICENSE file that accompanied this code.10#11# This code is distributed in the hope that it will be useful, but WITHOUT12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License14# version 2 for more details (a copy is included in the LICENSE file that15# accompanied this code).16#17# You should have received a copy of the GNU General Public License version18# 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 USA22# or visit www.oracle.com if you need additional information or have any23# questions.24#2526#27# Original Author: Tim Bell28#29usage() {30echo "Starts up an Xvfb dummy X server with fvwm2 window manager"31echo " usage:"32echo " ${0} display_number_file"33echo " display_number_file gets display number when it's ready"34exit35}36#37currentDir=`pwd`38rm -f $139DD=":$$"40DISPLAY=${DD}41export DISPLAY42cd /tmp43#44if [ ! -x "/usr/bin/X11/Xvfb" ]; then45# We have Solaris-flavored X windows, and the /usr/openwin Xvfb is46# a simple wrapper script around the Xsun server. Massage the47# arguments: server number must be first; others are slightly48# different.49#50# Also the default Visual Class (DirectColor) triggers an awt bug51# (probably 4131533/6505852) and some tests will loop endlessly52# when they hit the display. The workaround is:53# 1) Ask for PseudoColor instead.54# 2) Omit 32-bit depth.55/usr/bin/nohup /usr/openwin/bin/Xvfb ${DISPLAY} -dev vfb screen 0 1280x1024x24 pixdepths 8 16 24 defclass PseudoColor > ${currentDir}/nohup.$$ 2>&1 &56else57# Linux...58/usr/bin/nohup /usr/bin/X11/Xvfb -fbdir ${currentDir} -pixdepths 8 16 24 32 ${DISPLAY} > ${currentDir}/nohup.$$ 2>&1 &59fi60WM="/usr/bin/X11/fvwm2"61if [ ! -x ${WM} ] ; then62WM="/opt/sfw/bin/fvwm2"63fi64#65# Wait for Xvfb to initialize:66sleep 567#68if [ -x "${WM}" ]; then69# 2 JCK tests require a window manager70# mwm fails (key name errors) and twm fails (hangs),71# but fvwm2 works well.72/usr/bin/nohup ${WM} -display ${DISPLAY} -replace -f /dev/null > ${currentDir}/nohup.$$ 2>&1 &73else74echo "Error: ${WM} not found"75exit 176fi77#78# Wait some more to see if the xhost command gets through:79sleep 1080# Allow access to all - this is a brute force approach,81# but I do not see how it could be a security problem...82DISPLAY="${DD}" xhost +83#84echo "Virtual frame buffer started on ${DISPLAY}"85echo "$$" > $186wait878889