提交 46a26da4 编写于 作者: O ohair

6911104: Tests do not work with CYGWIN: tools, sun/tools, and com/sun/tools

Reviewed-by: tbell, alanb
上级 43a54397
......@@ -49,7 +49,11 @@ startApplication()
# "java" process.
if [ "$OS" = "Windows" ]; then
sleep 2
realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6`
if [ "${isCygwin}" = "true" ] ; then
realpid=`ps -p ${pid} | tail -1 | awk '{print $4;}'`
else
realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6`
fi
pid=${realpid}
fi
......@@ -57,7 +61,7 @@ startApplication()
attempts=0
while true; do
sleep 1
port=`tail -1 ${OUTPUTFILE}`
port=`tail -1 ${OUTPUTFILE} | sed -e 's@\\r@@g' `
if [ ! -z "$port" ]; then
# In case of errors wait time for output to be flushed
sleep 1
......
......@@ -48,7 +48,7 @@ failures=0
echo "Running tests ..."
$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \
$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
BasicTests $pid $agent $badagent $redefineagent 2>&1
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
......
......@@ -49,6 +49,12 @@ case "$OS" in
OS="Windows"
FS="\\"
;;
CYGWIN* )
PS=";"
OS="Windows"
FS="\\"
isCygwin=true
;;
* )
echo "Unrecognized system!"
exit 1;
......
......@@ -48,7 +48,7 @@ startApplication
echo "Deny test"
# deny
$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \
$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
-Djava.security.manager \
-Djava.security.policy=${TESTSRC}/java.policy.deny \
PermissionTest $pid true 2>&1
......@@ -56,7 +56,7 @@ if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
# allow
echo "Allow test"
$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \
$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
-Djava.security.manager \
-Djava.security.policy=${TESTSRC}/java.policy.allow \
PermissionTest $pid false 2>&1
......
......@@ -46,6 +46,6 @@ $JAR -cf ${TESTCLASSES}/SimpleProvider.jar \
echo "Running test ..."
$JAVA -classpath \
${TESTCLASSES}${PS}${TESTCLASSES}/SimpleProvider.jar${PS}${TESTJAVA}/lib/tools.jar \
"${TESTCLASSES}${PS}${TESTCLASSES}/SimpleProvider.jar${PS}${TESTJAVA}/lib/tools.jar" \
ProviderTest
......@@ -40,7 +40,7 @@ setup() {
OS=`uname -s`
case ${OS} in
Windows_*)
Windows_* | CYGWIN*)
PS=";"
FS="\\"
;;
......@@ -54,7 +54,7 @@ setup() {
verify_os() {
OS=`uname -s`
case ${OS} in
Windows_95 | Windows_98 | Windows_ME)
Windows_95 | Windows_98 | Windows_ME | CYGWIN* )
echo "Test bypassed: jvmstat feature not supported on ${OS}"
exit 0
;;
......
......@@ -45,7 +45,11 @@ startApplication()
# "java" process.
if [ "$OS" = "Windows" ]; then
sleep 2
realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6`
if [ "${isCygwin}" = "true" ] ; then
realpid=`ps -p ${pid} | tail -1 | awk '{print $4;}'`
else
realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6`
fi
pid=${realpid}
fi
......
......@@ -67,6 +67,11 @@ case "$OS" in
PS=";"
OS="Windows"
;;
CYGWIN* )
PS=";"
OS="Windows"
isCygwin=true
;;
* )
PS=":"
;;
......
......@@ -35,7 +35,7 @@ JPS="${TESTJAVA}/bin/jps"
rm -f jps.out 2>/dev/null
${JPS} -? > jps.out 2>&1
diff jps.out ${TESTSRC}/usage.out
diff -w jps.out ${TESTSRC}/usage.out
if [ $? != 0 ]
then
echo "Output of jps -? differ from expected output. Failed."
......@@ -46,7 +46,7 @@ fi
rm -f jps.out 2>/dev/null
${JPS} -help > jps.out 2>&1
diff jps.out ${TESTSRC}/usage.out
diff -w jps.out ${TESTSRC}/usage.out
if [ $? != 0 ]
then
echo "Output of jps -help differ from expected output. Failed."
......
......@@ -35,7 +35,7 @@ JSTAT="${TESTJAVA}/bin/jstat"
rm -f jstat.out 2>/dev/null
${JSTAT} -? > jstat.out 2>&1
diff jstat.out ${TESTSRC}/usage.out
diff -w jstat.out ${TESTSRC}/usage.out
if [ $? != 0 ]
then
echo "Output of jstat -? differ from expected output. Failed."
......@@ -45,7 +45,7 @@ fi
rm -f jstat.out 2>/dev/null
${JSTAT} -help > jstat.out 2>&1
diff jstat.out ${TESTSRC}/usage.out
diff -w jstat.out ${TESTSRC}/usage.out
if [ $? != 0 ]
then
echo "Output of jstat -help differ from expected output. Failed."
......
......@@ -35,4 +35,4 @@ JSTAT="${TESTJAVA}/bin/jstat"
rm -f jstat.out 2>/dev/null
${JSTAT} -options > jstat.out 2>&1
diff jstat.out ${TESTSRC}/options1.out
diff -w jstat.out ${TESTSRC}/options1.out
......@@ -37,7 +37,7 @@ JSTATD_2_OUT="jstatd_$$_2.out"
${JSTATD} -? > ${JSTATD_1_OUT} 2>&1
diff ${JSTATD_1_OUT} ${TESTSRC}/usage.out
diff -w ${JSTATD_1_OUT} ${TESTSRC}/usage.out
if [ $? != 0 ]
then
echo "Output of jstatd -? differs from expected output. Failed."
......@@ -46,7 +46,7 @@ fi
${JSTATD} -help > ${JSTATD_2_OUT} 2>&1
diff ${JSTATD_2_OUT} ${TESTSRC}/usage.out
diff -w ${JSTATD_2_OUT} ${TESTSRC}/usage.out
if [ $? != 0 ]
then
echo "Output of jstatd -help differs from expected output. Failed."
......
......@@ -32,7 +32,7 @@ if [ "${TESTSRC}" = "" ]; then TESTSRC=.; fi
if [ "${TESTJAVA}" = "" ]; then TESTJAVA=$1; shift; fi
case `uname -s` in
Windows*) OS=Windows;;
Windows* | CYGWIN*) OS=Windows;;
SunOS|Linux) OS=Unix;;
esac
......@@ -45,12 +45,14 @@ check() {
# Strip carriage returns from output when comparing with n2a test output
# on win32 systems
if [ OS = Windows ]; then
tr -d '\015' <$out >$out.1
if [ ${OS} = Windows ]; then
sed -e 's@\\r@@g' $out >$out.1
sed -e 's@\\r@@g' $expected >$out.expected
else
cp $out $out.1
cp $expected $out.expected
fi
if (set -x; diff -c $expected $out.1); then
if (set -x; diff -c $out.expected $out.1); then
echo "$bug passed"
else
echo "$bug failed"
......
......@@ -29,6 +29,9 @@
OS=`uname -s`;
# To remove CR from output, needed for java apps in CYGWIN, harmless otherwise
SED_CR="sed -e s@\\r@@g"
case "$OS" in
Windows* | CYGWIN* )
PATHSEP=";"
......@@ -79,10 +82,10 @@ $JAVAC GetDataModel.java
# Verify data model flag for default data model is accepted
DM=`$JAVA GetDataModel`
DM=`$JAVA GetDataModel | ${SED_CR}`
case "$DM" in
32 )
DM2=`${JAVA} -d32 GetDataModel`
DM2=`${JAVA} -d32 GetDataModel | ${SED_CR}`
if [ "${DM2}" != "32" ]
then
echo "Data model flag -d32 not accepted or had improper effect."
......@@ -91,7 +94,7 @@ case "$DM" in
;;
64 )
DM2=`${JAVA} -d64 GetDataModel`
DM2=`${JAVA} -d64 GetDataModel | ${SED_CR}`
if [ "${DM2}" != "64" ]
then
echo "Data model flag -d64 not accepted or had improper effect."
......@@ -227,10 +230,10 @@ then
else
# Negative tests for non-dual mode platforms to ensure the other data model is
# rejected
DM=`$JAVA GetDataModel`
DM=`$JAVA GetDataModel | ${SED_CR}`
case "$DM" in
32 )
DM2=`${JAVA} -d64 GetDataModel`
DM2=`${JAVA} -d64 GetDataModel | ${SED_CR}`
if [ "x${DM2}" != "x" ]
then
echo "Data model flag -d64 was accepted."
......@@ -239,7 +242,7 @@ else
;;
64 )
DM2=`${JAVA} -d32 GetDataModel`
DM2=`${JAVA} -d32 GetDataModel | ${SED_CR}`
if [ "x${DM2}" != "x" ]
then
echo "Data model flag -d32 was accepted."
......
......@@ -145,7 +145,7 @@ CreateClassFiles D
OS=`uname -s`
case $OS in
Windows*|Cygwin*)
Windows*|CYGWIN*)
PATHSEP=";"
ExecJava "" "${PATHSEP}NOOPDIR"
ExecJava "w" "${PATHSEP}NOOPDIR"
......
......@@ -48,7 +48,7 @@ fi
OS=`uname`
case "$OS" in
Windows* | CYGWIN* )
Windows* )
JAVAC="${TESTJAVA}/bin/javac -d . "
JAVA="${TESTJAVA}/bin/java -classpath . "
JAVAW="${TESTJAVA}/bin/javaw -classpath . "
......@@ -64,6 +64,22 @@ case "$OS" in
echo "Test passes"
exit 0
;;
CYGWIN* )
JAVAC="${TESTJAVA}/bin/javac -d . "
JAVA="${TESTJAVA}/bin/java -classpath . "
JAVAW="${TESTJAVA}/bin/javaw -classpath . "
${JAVAC} ${TESTSRC}/DefaultLocaleTest.java
${JAVA} DefaultLocaleTest | sed -e s@\\r@@g > x.out
${JAVAW} DefaultLocaleTest `cat x.out`
if [ $? -ne 0 ]
then
echo "Test fails"
exit 1
fi
echo "Test passes"
exit 0
;;
* )
echo "Non-windows environment; test vacuously succeeds."
exit 0;
......
......@@ -54,7 +54,7 @@ mkdir UnicodeTest-src UnicodeTest-classes
echo "creating test source files"
"$JAVAC" -d . "${TESTSRC}"/UnicodeTest.java
CLASS_NAME=`"$JAVA" UnicodeTest`
CLASS_NAME=`"$JAVA" UnicodeTest | sed -e 's@\\r@@g' `
if [ "$CLASS_NAME" = "" ]
then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册