changeset 1746:b8004f6f4812

6882768: (launcher) test for 6842838 is broken Summary: Testcase correction. Reviewed-by: ksrini
author kevinw
date Tue, 22 Sep 2009 17:01:08 +0100
parents 81dffe63c913
children f708138c9aca
files test/tools/launcher/6842838/Test6842838.sh
diffstat 1 files changed, 26 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/test/tools/launcher/6842838/Test6842838.sh	Tue Sep 22 10:01:32 2009 +0800
+++ b/test/tools/launcher/6842838/Test6842838.sh	Tue Sep 22 17:01:08 2009 +0100
@@ -1,12 +1,3 @@
-#!/bin/sh -x
-
-#
-# @test @(#)Test6842838.sh
-# @bug 6842838
-# @summary Test 6842838 64-bit launcher failure due to corrupt jar
-# @run shell Test6842838.sh
-#
-
 #
 # Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,21 +21,23 @@
 # have any questions.
 #
 
-if [ "${TESTSRC}" = "" ]
-then TESTSRC=.
-fi
 
-if [ "${TESTJAVA}" = "" ]
-then
+# @test Test6842838.sh
+# @bug 6842838
+# @summary Test 6842838 64-bit launcher failure due to corrupt jar
+# @compile CreateBadJar.java
+# @run shell Test6842838.sh
+
+set -x
+
+if [ "${TESTJAVA}" = "" ]; then
   PARENT=`dirname \`which java\``
   TESTJAVA=`dirname ${PARENT}`
-  echo "TESTJAVA not set, selecting " ${TESTJAVA}
-  echo "If this is incorrect, try setting the variable manually."
+  printf "TESTJAVA not set.  Test cannot execute.  Failed.\n"
 fi
 
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
+if [ "${TESTCLASSES}" = "" ]; then
+  printf "TESTCLASSES not set.  Test cannot execute.  Failed.\n"
   exit 1
 fi
 
@@ -58,18 +51,26 @@
     JAVA_EXE=${TESTJAVA}${FS}bin${FS}sparcv9${FS}java
     ;;
   * )
-    echo "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)"
+    printf "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)\n"
     exit 0;
     ;;
 esac
 
+if [ ! -x ${JAVA_EXE} ]; then
+    printf "Warning: sparcv9 components not installed - skipping test.\n"
+    exit 0
+fi
+
+LIBUMEM=/lib/64/libumem.so
+if [ ! -x ${LIBUMEM} ]; then
+    printf "Warning: libumem not installed - skipping test.\n"
+    exit 0
+fi
+
 BADFILE=newbadjar.jar
-
 ${JAVA_EXE} -version
-rm -f ${BADFILE}
-${TESTJAVA}/bin/javac CreateBadJar.java
-${JAVA_EXE} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF"
-LD_PRELOAD=/lib/64/libumem.so ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1
+${JAVA_EXE} -cp ${TESTCLASSES} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF"
+LD_PRELOAD=${LIBUMEM} ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1
 
 grep "Invalid or corrupt jarfile" test.out
 exit $?