author | chegar |
Thu, 13 Dec 2012 14:47:35 +0000 | |
changeset 14786 | a9f61e0cbe61 |
parent 9035 | 1255eb81cc2f |
permissions | -rw-r--r-- |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
1 |
# |
9035
1255eb81cc2f
7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents:
8158
diff
changeset
|
2 |
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
4 |
# |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
8 |
# |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
9 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
10 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
11 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
12 |
# version 2 for more details (a copy is included in the LICENSE file that |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
13 |
# accompanied this code). |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
14 |
# |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
15 |
# You should have received a copy of the GNU General Public License version |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
16 |
# 2 along with this work; if not, write to the Free Software Foundation, |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
17 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
18 |
# |
5506 | 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. |
|
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
22 |
# |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
23 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
24 |
# @test |
6695
0e91810597f9
6907737: (file) FileVisitor and Files.walkFileTree issues
alanb
parents:
5506
diff
changeset
|
25 |
# @bug 4313887 6907737 |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
26 |
# @summary Unit test for walkFileTree method |
6695
0e91810597f9
6907737: (file) FileVisitor and Files.walkFileTree issues
alanb
parents:
5506
diff
changeset
|
27 |
# @build CreateFileTree PrintFileTree SkipSiblings TerminateWalk MaxDepth |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
28 |
# @run shell walk_file_tree.sh |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
29 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
30 |
# if TESTJAVA isn't set then we assume an interactive run. |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
31 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
32 |
if [ -z "$TESTJAVA" ]; then |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
33 |
TESTSRC=. |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
34 |
TESTCLASSES=. |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
35 |
JAVA=java |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
36 |
else |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
37 |
JAVA="${TESTJAVA}/bin/java" |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
38 |
fi |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
39 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
40 |
OS=`uname -s` |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
41 |
case "$OS" in |
4657
d0bd64fbe430
6911113: These tests do not work with CYGWIN: java/nio
ohair
parents:
2057
diff
changeset
|
42 |
Windows_* | CYGWIN* ) |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
43 |
echo "This test does not run on Windows" |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
44 |
exit 0 |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
45 |
;; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
46 |
* ) |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
47 |
CLASSPATH=${TESTCLASSES}:${TESTSRC} |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
48 |
;; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
49 |
esac |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
50 |
export CLASSPATH |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
51 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
52 |
# create the file tree |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
53 |
ROOT=`$JAVA CreateFileTree` |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
54 |
if [ $? != 0 ]; then exit 1; fi |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
55 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
56 |
failures=0 |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
57 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
58 |
# print the file tree and compare output with find(1) |
14786
a9f61e0cbe61
8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents:
9035
diff
changeset
|
59 |
$JAVA ${TESTVMOPTS} PrintFileTree "$ROOT" > out1 |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
60 |
find "$ROOT" > out2 |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
61 |
diff out1 out2 |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
62 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
63 |
|
4976
7419a22f407c
6926800: TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with newer versions of find(1)
alanb
parents:
4657
diff
changeset
|
64 |
# repeat test following links. Some versions of find(1) output |
7419a22f407c
6926800: TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with newer versions of find(1)
alanb
parents:
4657
diff
changeset
|
65 |
# cycles (sym links to ancestor directories), other versions do |
7419a22f407c
6926800: TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with newer versions of find(1)
alanb
parents:
4657
diff
changeset
|
66 |
# not. For that reason we run PrintFileTree with the -printCycles |
7419a22f407c
6926800: TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with newer versions of find(1)
alanb
parents:
4657
diff
changeset
|
67 |
# option when the output without this option differs to find(1). |
7419a22f407c
6926800: TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with newer versions of find(1)
alanb
parents:
4657
diff
changeset
|
68 |
find "$ROOT" -follow > out1 |
14786
a9f61e0cbe61
8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents:
9035
diff
changeset
|
69 |
$JAVA ${TESTVMOPTS} PrintFileTree -follow "$ROOT" > out2 |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
70 |
diff out1 out2 |
4976
7419a22f407c
6926800: TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with newer versions of find(1)
alanb
parents:
4657
diff
changeset
|
71 |
if [ $? != 0 ]; |
7419a22f407c
6926800: TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with newer versions of find(1)
alanb
parents:
4657
diff
changeset
|
72 |
then |
7419a22f407c
6926800: TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with newer versions of find(1)
alanb
parents:
4657
diff
changeset
|
73 |
# re-run printing cycles to stdout |
14786
a9f61e0cbe61
8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents:
9035
diff
changeset
|
74 |
$JAVA ${TESTVMOPTS} PrintFileTree -follow -printCycles "$ROOT" > out2 |
4976
7419a22f407c
6926800: TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with newer versions of find(1)
alanb
parents:
4657
diff
changeset
|
75 |
diff out1 out2 |
7419a22f407c
6926800: TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with newer versions of find(1)
alanb
parents:
4657
diff
changeset
|
76 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
7419a22f407c
6926800: TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with newer versions of find(1)
alanb
parents:
4657
diff
changeset
|
77 |
fi |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
78 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
79 |
# test SKIP_SIBLINGS |
14786
a9f61e0cbe61
8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents:
9035
diff
changeset
|
80 |
$JAVA ${TESTVMOPTS} SkipSiblings "$ROOT" |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
81 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
82 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
83 |
# test TERMINATE |
14786
a9f61e0cbe61
8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents:
9035
diff
changeset
|
84 |
$JAVA ${TESTVMOPTS} TerminateWalk "$ROOT" |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
85 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
86 |
|
6695
0e91810597f9
6907737: (file) FileVisitor and Files.walkFileTree issues
alanb
parents:
5506
diff
changeset
|
87 |
# test maxDepth |
14786
a9f61e0cbe61
8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents:
9035
diff
changeset
|
88 |
$JAVA ${TESTVMOPTS} MaxDepth "$ROOT" |
6695
0e91810597f9
6907737: (file) FileVisitor and Files.walkFileTree issues
alanb
parents:
5506
diff
changeset
|
89 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
0e91810597f9
6907737: (file) FileVisitor and Files.walkFileTree issues
alanb
parents:
5506
diff
changeset
|
90 |
|
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
91 |
# clean-up |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
92 |
rm -r "$ROOT" |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
93 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
94 |
echo '' |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
95 |
if [ $failures -gt 0 ]; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
96 |
then echo "$failures test(s) failed"; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
97 |
else echo "Test passed"; fi |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
98 |
exit $failures |