1 # |
|
2 # Copyright (c) 2008, 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 # @summary Unit test for java.nio.channels.spi.AsynchronousChannelProvider |
|
26 # @build Provider1 Provider2 CheckProvider |
|
27 # @run shell custom_provider.sh |
|
28 |
|
29 # if TESTJAVA isn't set then we assume an interactive run. |
|
30 |
|
31 if [ -z "$TESTJAVA" ]; then |
|
32 TESTSRC=. |
|
33 TESTCLASSES=. |
|
34 JAVA=java |
|
35 else |
|
36 JAVA="${TESTJAVA}/bin/java" |
|
37 fi |
|
38 |
|
39 OS=`uname -s` |
|
40 case "$OS" in |
|
41 Windows_* | CYGWIN* ) |
|
42 CLASSPATH="${TESTCLASSES};${TESTSRC}" |
|
43 ;; |
|
44 * ) |
|
45 CLASSPATH=${TESTCLASSES}:${TESTSRC} |
|
46 ;; |
|
47 esac |
|
48 export CLASSPATH |
|
49 |
|
50 failures=0 |
|
51 |
|
52 go() { |
|
53 echo '' |
|
54 $JAVA ${TESTVMOPTS} $1 $2 $3 2>&1 |
|
55 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
|
56 } |
|
57 |
|
58 # Run the tests |
|
59 |
|
60 go CheckProvider Provider1 |
|
61 go -Djava.nio.channels.spi.AsynchronousChannelProvider=Provider2 CheckProvider \ |
|
62 Provider2 |
|
63 |
|
64 # |
|
65 # Results |
|
66 # |
|
67 echo '' |
|
68 if [ $failures -gt 0 ]; |
|
69 then echo "$failures test(s) failed"; |
|
70 else echo "All test(s) passed"; fi |
|
71 exit $failures |
|