1 #
   2 # Copyright (c) 2009, 2012, 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 it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #
  23 
  24 # @test
  25 # @bug 4890703
  26 # @summary Unit test for Solaris SDP support
  27 # @build ProbeIB Sanity
  28 # @run shell sanity.sh
  29 
  30 # Check we are on Solaris and that SDP is enabled
  31 OS=`uname -s`
  32 if [ "$OS" != "SunOS" ]; then
  33     echo "This is a Solaris-only test"
  34     exit 0
  35 fi
  36 
  37 IB_LINKS=ib.links
  38 IB_ADDRS=ib.addrs
  39 
  40 # Display IB partition link information
  41 # (requires Solaris 11, will fail on Solaris 10)
  42 /usr/sbin/dladm show-part -o LINK -p > ${IB_LINKS}
  43 if [ $? != 0 ]; then
  44     echo "Unable to get IB parition link information"
  45     exit 0
  46 fi
  47 
  48 if [ -z "$TESTJAVA" ]; then
  49     JAVA=java
  50     TESTCLASSES=.
  51     TESTSRC=.
  52 else
  53     JAVA="${TESTJAVA}/bin/java"
  54 fi
  55 
  56 CLASSPATH=${TESTCLASSES}:${TESTSRC}
  57 export CLASSPATH
  58 
  59 # Probe for IP addresses plumbed to IB interfaces
  60 $JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true ProbeIB ${IB_LINKS} > ${IB_ADDRS}
  61 
  62 # Create sdp.conf
  63 SDPCONF=sdp.conf
  64 rm ${SDPCONF}
  65 touch ${SDPCONF}
  66 cat ${IB_ADDRS} | while read ADDR
  67 do
  68    echo "bind ${ADDR} *" > ${SDPCONF}
  69    echo "connect ${ADDR} *" >> ${SDPCONF}
  70 done
  71 
  72 # Sanity check
  73 $JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true -Dcom.sun.sdp.conf=${SDPCONF} -Dcom.sun.sdp.debug Sanity