test/hotspot/jtreg/runtime/MinimalVM/Instrumentation.java
author jiangli
Mon, 21 May 2018 15:15:58 -0400
changeset 50199 83d8b3a25f25
parent 47216 71c04702a3d5
permissions -rw-r--r--
8199807: AppCDS performs overly restrictive path matching check. 8203377: Cleanup the usage of os::file_name_strcmp() in SharedPathsMiscInfo::check(). Summary: Relax CDS/AppCDS path check for modules image. Reviewed-by: iklam, ccheung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40660
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     1
/*
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     4
 *
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     8
 *
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    13
 * accompanied this code).
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    14
 *
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    18
 *
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    21
 * questions.
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    22
 */
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    23
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    24
/*
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    25
 * @test
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    26
 * @library /test/lib
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    27
 * @requires vm.flavor == "minimal"
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    28
 * @modules java.base/jdk.internal.misc
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    29
 *          java.instrument
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    30
 * @run driver Instrumentation
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    31
 */
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    32
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    33
import jdk.test.lib.process.OutputAnalyzer;
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    34
import jdk.test.lib.process.ProcessTools;
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    35
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    36
public class Instrumentation {
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    37
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    38
    public static void main(String[] args) throws Exception {
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    39
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    40
                "-minimal", "-javaagent:redefineagent.jar", "-version");
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    41
        new OutputAnalyzer(pb.start())
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    42
                .shouldContain("Instrumentation agents are not supported in this VM")
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    43
                .shouldHaveExitValue(1);
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    44
    }
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    45
}