Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8266088: compiler/arguments/TestPrintOptoAssemblyLineNumbers test should user driver mode #3726

Closed
wants to merge 7 commits into from
Closed
Changes from 4 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
@@ -1,5 +1,6 @@
/*
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,10 +35,11 @@

package compiler.arguments;

import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

// THIS TEST IS LINE NUMBER SENSITIVE

public class TestPrintOptoAssemblyLineNumbers {
public static void main(String[] args) throws Throwable {
// create subprocess to run some code with -XX:+PrintOptoAssembly enabled
@@ -49,11 +51,12 @@ public static void main(String[] args) throws Throwable {
};

ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs);
String output = new OutputAnalyzer(pb.start()).getOutput();
OutputAnalyzer oa = new OutputAnalyzer(pb.start());
oa.shouldHaveExitValue(0);

if (output.contains("TestPrintOptoAssemblyLineNumbers$CheckC2OptoAssembly::main @ bci:11")) {
if (oa.getOutput().contains("TestPrintOptoAssemblyLineNumbers$CheckC2OptoAssembly::main @ bci:11")) {
// if C2 optimizer invoked ensure output includes line numbers:
Asserts.assertTrue(output.contains("TestPrintOptoAssemblyLineNumbers$CheckC2OptoAssembly::main @ bci:11 (line 68)"));
oa.stdoutShouldContain("TestPrintOptoAssemblyLineNumbers$CheckC2OptoAssembly::main @ bci:11 (line 70)");
}
}

@@ -64,7 +67,7 @@ public static boolean foo(String arg) {

public static void main(String[] args) {
int count = 0;
for (int x = 0; x < 200_000; x++){
for (int x = 0; x < 200_000; x++) {
if (foo("something" + x)) { // <- test expects this line of code to be on line 68
count += 1;
}