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
31OS=`uname -s`
32if [ "$OS" != "SunOS" ]; then
33    echo "This is a Solaris-only test"
34    exit 0
35fi
36
37IB_LINKS=ib.links
38IB_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}
43if [ $? != 0 ]; then
44    echo "Unable to get IB parition link information"
45    exit 0
46fi
47
48if [ -z "$TESTJAVA" ]; then
49    JAVA=java
50    TESTCLASSES=.
51    TESTSRC=.
52else
53    JAVA="${TESTJAVA}/bin/java"
54fi
55
56CLASSPATH=${TESTCLASSES}:${TESTSRC}
57export 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
63SDPCONF=sdp.conf
64rm ${SDPCONF}
65touch ${SDPCONF}
66cat ${IB_ADDRS} | while read ADDR
67do
68   echo "bind ${ADDR} *" > ${SDPCONF}
69   echo "connect ${ADDR} *" >> ${SDPCONF}
70done
71
72# Sanity check
73$JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true -Dcom.sun.sdp.conf=${SDPCONF} -Dcom.sun.sdp.debug Sanity
74