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