Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/nio/file/Files/walkFileTree/find.sh
38886 views
1
#
2
# Copyright (c) 2008, 2013, 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 4313887 6907737
26
# @summary Tests that walkFileTree is consistent with the native find program
27
# @build CreateFileTree PrintFileTree
28
# @run shell find.sh
29
30
# if TESTJAVA isn't set then we assume an interactive run.
31
32
if [ -z "$TESTJAVA" ]; then
33
TESTSRC=.
34
TESTCLASSES=.
35
JAVA=java
36
else
37
JAVA="${TESTJAVA}/bin/java"
38
fi
39
40
OS=`uname -s`
41
case "$OS" in
42
Windows_* | CYGWIN* )
43
echo "This test does not run on Windows"
44
exit 0
45
;;
46
AIX )
47
CLASSPATH=${TESTCLASSES}:${TESTSRC}
48
# On AIX "find -follow" may core dump on recursive links without '-L'
49
# see: http://www-01.ibm.com/support/docview.wss?uid=isg1IV28143
50
FIND_FOLLOW_OPT="-L"
51
;;
52
* )
53
FIND_FOLLOW_OPT=
54
CLASSPATH=${TESTCLASSES}:${TESTSRC}
55
;;
56
esac
57
export CLASSPATH
58
59
# create the file tree
60
ROOT=`$JAVA CreateFileTree`
61
if [ $? != 0 ]; then exit 1; fi
62
63
failures=0
64
65
# print the file tree and compare output with find(1)
66
$JAVA ${TESTVMOPTS} PrintFileTree "$ROOT" > out1
67
find "$ROOT" > out2
68
diff out1 out2
69
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
70
71
# repeat test following links. Some versions of find(1) output
72
# cycles (sym links to ancestor directories), other versions do
73
# not. For that reason we run PrintFileTree with the -printCycles
74
# option when the output without this option differs to find(1).
75
find $FIND_FOLLOW_OPT "$ROOT" -follow > out1
76
$JAVA ${TESTVMOPTS} PrintFileTree -follow "$ROOT" > out2
77
diff out1 out2
78
if [ $? != 0 ];
79
then
80
# re-run printing cycles to stdout
81
$JAVA ${TESTVMOPTS} PrintFileTree -follow -printCycles "$ROOT" > out2
82
diff out1 out2
83
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
84
fi
85
86
# clean-up
87
rm -r "$ROOT"
88
89
echo ''
90
if [ $failures -gt 0 ];
91
then echo "$failures test(s) failed";
92
else echo "Test passed"; fi
93
exit $failures
94
95