7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test

Tue, 17 Sep 2013 20:20:03 +0200

author
mseledtsov
date
Tue, 17 Sep 2013 20:20:03 +0200
changeset 5686
6f45933aef35
parent 5685
88d6b9a1c27c
child 5687
41e6ae9f6dd7
child 5743
63147986a428
child 5745
c1d7040a1183

7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
Summary: Re-wrote in Java, this also eliminated temporary result file; set upper limit on malloc'd memory
Reviewed-by: dcubed, dholmes, ccheung

test/runtime/7020373/Test7020373.sh file | annotate | diff | comparison | revisions
test/runtime/7020373/testcase.jar file | annotate | diff | comparison | revisions
test/runtime/ClassFile/JsrRewriting.java file | annotate | diff | comparison | revisions
test/runtime/ClassFile/JsrRewritingTestCase.jar file | annotate | diff | comparison | revisions
     1.1 --- a/test/runtime/7020373/Test7020373.sh	Tue Sep 17 20:09:32 2013 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,43 +0,0 @@
     1.4 -#!/bin/sh
     1.5 -
     1.6 -##
     1.7 -## @test
     1.8 -## @bug 7020373 7055247 7053586 7185550
     1.9 -## @key cte_test
    1.10 -## @summary JSR rewriting can overflow memory address size variables
    1.11 -## @ignore Ignore it as 7053586 test uses lots of memory. See bug report for detail.
    1.12 -## @run shell Test7020373.sh
    1.13 -##
    1.14 -
    1.15 -if [ "${TESTSRC}" = "" ]
    1.16 -then
    1.17 -  TESTSRC=${PWD}
    1.18 -  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
    1.19 -fi
    1.20 -echo "TESTSRC=${TESTSRC}"
    1.21 -## Adding common setup Variables for running shell tests.
    1.22 -. ${TESTSRC}/../../test_env.sh
    1.23 -
    1.24 -${COMPILEJAVA}${FS}bin${FS}jar xvf ${TESTSRC}${FS}testcase.jar
    1.25 -
    1.26 -${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} OOMCrashClass4000_1 > test.out 2>&1
    1.27 -
    1.28 -cat test.out
    1.29 -
    1.30 -egrep "SIGSEGV|An unexpected error has been detected" test.out
    1.31 -
    1.32 -if [ $? = 0 ]
    1.33 -then
    1.34 -    echo "Test Failed"
    1.35 -    exit 1
    1.36 -else
    1.37 -    egrep "java.lang.LinkageError|java.lang.NoSuchMethodError|Main method not found in class OOMCrashClass4000_1|insufficient memory" test.out
    1.38 -    if [ $? = 0 ]
    1.39 -    then
    1.40 -        echo "Test Passed"
    1.41 -        exit 0
    1.42 -    else
    1.43 -        echo "Test Failed"
    1.44 -        exit 1
    1.45 -    fi
    1.46 -fi
     2.1 Binary file test/runtime/7020373/testcase.jar has changed
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/runtime/ClassFile/JsrRewriting.java	Tue Sep 17 20:20:03 2013 +0200
     3.3 @@ -0,0 +1,102 @@
     3.4 +/*
     3.5 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + *
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.
    3.11 + *
    3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.15 + * version 2 for more details (a copy is included in the LICENSE file that
    3.16 + * accompanied this code).
    3.17 + *
    3.18 + * You should have received a copy of the GNU General Public License version
    3.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.21 + *
    3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    3.23 + * or visit www.oracle.com if you need additional information or have any
    3.24 + * questions.
    3.25 + */
    3.26 +
    3.27 +
    3.28 +
    3.29 +/*
    3.30 + * @test JsrRewriting
    3.31 + * @summary JSR (jump local subroutine)
    3.32 + *      rewriting can overflow memory address size variables
    3.33 + * @bug 7020373
    3.34 + * @bug 7055247
    3.35 + * @bug 7053586
    3.36 + * @bug 7185550
    3.37 + * @bug 7149464
    3.38 + * @key cte_test
    3.39 + * @library /testlibrary
    3.40 + * @run main JsrRewriting
    3.41 + */
    3.42 +
    3.43 +import com.oracle.java.testlibrary.*;
    3.44 +import java.io.File;
    3.45 +
    3.46 +public class JsrRewriting {
    3.47 +
    3.48 +    public static void main(String[] args) throws Exception {
    3.49 +
    3.50 +        // ======= Configure the test
    3.51 +        String jarFile = System.getProperty("test.src") +
    3.52 +            File.separator + "JsrRewritingTestCase.jar";
    3.53 +        String className = "OOMCrashClass4000_1";
    3.54 +
    3.55 +        // limit is 768MB in native words
    3.56 +        int mallocMaxTestWords = (1024 * 1024 * 768 / 4);
    3.57 +        if (Platform.is64bit())
    3.58 +            mallocMaxTestWords = (mallocMaxTestWords / 2);
    3.59 +
    3.60 +        // ======= extract the test class
    3.61 +        ProcessBuilder pb = new ProcessBuilder(new String[] {
    3.62 +            JDKToolFinder.getJDKTool("jar"),
    3.63 +            "xvf", jarFile } );
    3.64 +        OutputAnalyzer output = new OutputAnalyzer(pb.start());
    3.65 +        output.shouldHaveExitValue(0);
    3.66 +
    3.67 +        // ======= execute the test
    3.68 +        pb = ProcessTools.createJavaProcessBuilder(
    3.69 +            "-cp", ".",
    3.70 +            "-XX:+UnlockDiagnosticVMOptions",
    3.71 +            "-XX:MallocMaxTestWords=" + mallocMaxTestWords,
    3.72 +            className);
    3.73 +
    3.74 +        output = new OutputAnalyzer(pb.start());
    3.75 +        String[] expectedMsgs = {
    3.76 +            "java.lang.LinkageError",
    3.77 +            "java.lang.NoSuchMethodError",
    3.78 +            "Main method not found in class " + className,
    3.79 +            "insufficient memory"
    3.80 +        };
    3.81 +
    3.82 +        MultipleOrMatch(output, expectedMsgs);
    3.83 +    }
    3.84 +
    3.85 +    private static void
    3.86 +        MultipleOrMatch(OutputAnalyzer analyzer, String[] whatToMatch) {
    3.87 +            String output = analyzer.getOutput();
    3.88 +
    3.89 +            for (String expected : whatToMatch)
    3.90 +                if (output.contains(expected))
    3.91 +                    return;
    3.92 +
    3.93 +            String err =
    3.94 +                " stdout: [" + analyzer.getOutput() + "];\n" +
    3.95 +                " exitValue = " + analyzer.getExitValue() + "\n";
    3.96 +            System.err.println(err);
    3.97 +
    3.98 +            StringBuilder msg = new StringBuilder("Output did not contain " +
    3.99 +                "any of the following expected messages: \n");
   3.100 +            for (String expected : whatToMatch)
   3.101 +                msg.append(expected).append(System.lineSeparator());
   3.102 +            throw new RuntimeException(msg.toString());
   3.103 +    }
   3.104 +}
   3.105 +
     4.1 Binary file test/runtime/ClassFile/JsrRewritingTestCase.jar has changed

mercurial