test/java/awt/Toolkit/Headless/WrappedToolkitTest/WrappedToolkitTest.sh

Print this page
rev 8343 : 8025673: [macosx] Disable X11 AWT toolkit
Summary: Disable but not completely remove the XAWT and headless toolkits on Mac OS X
Reviewed-by:
Contributed-by: david.dehaven@oracle.com


  60 OS=`uname -s`
  61 case "$OS" in
  62    SunOS )
  63       VAR="One value for Sun"
  64       DEFAULT_JDK=/usr/local/java/jdk1.2/solaris
  65       FILESEP="/"
  66       ;;
  67 
  68    Linux )
  69       VAR="A different value for Linux"
  70       DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386
  71       FILESEP="/"
  72       ;;
  73 
  74    Windows* | CYGWIN* )
  75       VAR="A different value for Win32"
  76       DEFAULT_JDK=/usr/local/java/jdk1.2/win32
  77       FILESEP="\\"
  78       ;;
  79 






  80    # catch all other OSs
  81    * )
  82       echo "Unrecognized system!  $OS"
  83       fail "Unrecognized system!  $OS"
  84       ;;
  85 esac
  86 
  87 # check that some executable or other file you need is available, abort if not
  88 #  note that the name of the executable is in the fail string as well.
  89 # this is how to check for presence of the compiler, etc.
  90 #RESOURCE=`whence SomeProgramOrFileNeeded`
  91 #if [ "${RESOURCE}" = "" ] ; 
  92 #   then fail "Need SomeProgramOrFileNeeded to perform the test" ; 
  93 #fi
  94 
  95 # Want this test to run standalone as well as in the harness, so do the 
  96 #  following to copy the test's directory into the harness's scratch directory 
  97 #  and set all appropriate variables:
  98 
  99 if [ -z "${TESTJAVA}" ] ; then


 154       fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.windows.WToolkit";
 155     fi
 156     ;;
 157 
 158   SunOS | Linux )
 159     ${TESTJAVA}/bin/java -Djava.awt.headless=true \
 160                          -Dawt.toolkit=sun.awt.X11.XToolkit \
 161                          TestWrapped sun.awt.X11.XToolkit
 162     status=$?
 163     if [ ! $status -eq "0" ]; then
 164       fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.xawt.XToolkit";
 165     fi
 166     AWT_TOOLKIT=XToolkit ${TESTJAVA}/bin/java -Djava.awt.headless=true \
 167                                               TestWrapped sun.awt.X11.XToolkit
 168     status=$?
 169     if [ ! $status -eq "0" ]; then
 170       fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.xawt.XToolkit";
 171     fi
 172     ;;
 173 
















 174 esac
 175 
 176 pass "All the tests are PASSED";
 177 
 178 #For additional examples of how to write platform independent KSH scripts,
 179 # see the jtreg file itself.  It is a KSH script for both Solaris and Win32


  60 OS=`uname -s`
  61 case "$OS" in
  62    SunOS )
  63       VAR="One value for Sun"
  64       DEFAULT_JDK=/usr/local/java/jdk1.2/solaris
  65       FILESEP="/"
  66       ;;
  67 
  68    Linux )
  69       VAR="A different value for Linux"
  70       DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386
  71       FILESEP="/"
  72       ;;
  73 
  74    Windows* | CYGWIN* )
  75       VAR="A different value for Win32"
  76       DEFAULT_JDK=/usr/local/java/jdk1.2/win32
  77       FILESEP="\\"
  78       ;;
  79 
  80     Darwin)
  81       VAR="Lets not forget about Mac"
  82       DEFAULT_JDK=$(/usr/libexec/java_home)
  83       FILESEP="/"
  84       ;;
  85 
  86    # catch all other OSs
  87    * )
  88       echo "Unrecognized system!  $OS"
  89       fail "Unrecognized system!  $OS"
  90       ;;
  91 esac
  92 
  93 # check that some executable or other file you need is available, abort if not
  94 #  note that the name of the executable is in the fail string as well.
  95 # this is how to check for presence of the compiler, etc.
  96 #RESOURCE=`whence SomeProgramOrFileNeeded`
  97 #if [ "${RESOURCE}" = "" ] ; 
  98 #   then fail "Need SomeProgramOrFileNeeded to perform the test" ; 
  99 #fi
 100 
 101 # Want this test to run standalone as well as in the harness, so do the 
 102 #  following to copy the test's directory into the harness's scratch directory 
 103 #  and set all appropriate variables:
 104 
 105 if [ -z "${TESTJAVA}" ] ; then


 160       fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.windows.WToolkit";
 161     fi
 162     ;;
 163 
 164   SunOS | Linux )
 165     ${TESTJAVA}/bin/java -Djava.awt.headless=true \
 166                          -Dawt.toolkit=sun.awt.X11.XToolkit \
 167                          TestWrapped sun.awt.X11.XToolkit
 168     status=$?
 169     if [ ! $status -eq "0" ]; then
 170       fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.xawt.XToolkit";
 171     fi
 172     AWT_TOOLKIT=XToolkit ${TESTJAVA}/bin/java -Djava.awt.headless=true \
 173                                               TestWrapped sun.awt.X11.XToolkit
 174     status=$?
 175     if [ ! $status -eq "0" ]; then
 176       fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.xawt.XToolkit";
 177     fi
 178     ;;
 179 
 180   Darwin)
 181     ${TESTJAVA}/bin/java -Djava.awt.headless=true \
 182                          TestWrapped sun.lwawt.macosx.LWCToolkit
 183     status=$?
 184     if [ ! $status -eq "0" ]; then
 185       fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.lwawt.macosx.LWCToolkit";
 186     fi
 187     ${TESTJAVA}/bin/java -Djava.awt.headless=true \
 188                          -Dawt.toolkit=sun.lwawt.macosx.LWCToolkit \
 189                          TestWrapped sun.lwawt.macosx.LWCToolkit
 190     status=$?
 191     if [ ! $status -eq "0" ]; then
 192       fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.lwawt.macosx.LWCToolkit";
 193     fi
 194     ;;
 195 
 196 esac
 197 
 198 pass "All the tests are PASSED";
 199 
 200 #For additional examples of how to write platform independent KSH scripts,
 201 # see the jtreg file itself.  It is a KSH script for both Solaris and Win32