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/lang/ProcessBuilder/InheritIO/InheritIO.sh
47512 views
1
#
2
# Copyright (c) 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 8023130
26
# @summary (process) ProcessBuilder#inheritIO does not work on Windows
27
# @run shell InheritIO.sh
28
29
if [ "x${TESTSRC}" = "x" ]; then
30
echo "TESTSRC not set. Test cannot execute. Failed."
31
exit 1
32
fi
33
34
if [ "x${TESTJAVA}" = "x" ]; then
35
echo "TESTJAVA not set. Test cannot execute. Failed."
36
exit 1
37
fi
38
39
if [ "x${COMPILEJAVA}" = "x" ]; then
40
COMPILEJAVA="${TESTJAVA}"
41
fi
42
43
JAVA="${TESTJAVA}/bin/java"
44
JAVAC="${COMPILEJAVA}/bin/javac"
45
46
cp -f ${TESTSRC}/InheritIO.java .
47
48
# compile the class ourselves, so this can run as a standalone test
49
50
${JAVAC} InheritIO.java
51
RES="$?"
52
if [ ${RES} != 0 ]; then
53
echo 'FAIL: Cannot compile InheritIO.java'
54
exit ${RES}
55
fi
56
57
58
for TEST_NAME in TestInheritIO TestRedirectInherit
59
do
60
${JAVA} ${TESTVMOPTS} -classpath . \
61
'InheritIO$'${TEST_NAME} printf message > stdout.txt 2> stderr.txt
62
63
RES="$?"
64
if [ ${RES} != 0 ]; then
65
echo 'FAIL: InheritIO$'${TEST_NAME}' failed with '${RES}
66
exit ${RES}
67
fi
68
69
OUT_EXPECTED='message'
70
OUT_RECEIVED=`cat stdout.txt`
71
if [ "x${OUT_RECEIVED}" != "x${OUT_EXPECTED}" ]; then
72
echo "FAIL: unexpected '${OUT_RECEIVED}' in stdout"
73
exit 1
74
fi
75
76
ERR_EXPECTED='exit value: 0'
77
ERR_RECEIVED=`cat stderr.txt`
78
if [ "x${ERR_RECEIVED}" != "x${ERR_EXPECTED}" ]; then
79
echo "FAIL: unexpected '${ERR_RECEIVED}' in stderr"
80
exit 1
81
fi
82
done
83
84
echo 'PASS: InheritIO works as expected'
85
86