Skip to content

Commit

Permalink
8319571: Update jni/nullCaller/NullCallerTest.java to accept flags or…
Browse files Browse the repository at this point in the history
… mark as flagless

Reviewed-by: mchung
  • Loading branch information
Tim Prinzing authored and Mandy Chung committed Jan 11, 2024
1 parent e10d140 commit b78896b
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions test/jdk/jni/nullCaller/NullCallerTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, 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
Expand Down Expand Up @@ -37,17 +37,15 @@

// Test disabled on AIX since we cannot invoke the JVM on the primordial thread.

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Properties;

import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.compiler.CompilerUtils;
import jdk.test.lib.process.ProcessTools;

public class NullCallerTest {

Expand Down Expand Up @@ -87,28 +85,10 @@ public static void main(String[] args) throws Exception {
// build the module used for the test
compileTestModule();

var launcher = Path.of(System.getProperty("test.nativepath"), "NullCallerTest");
var pb = new ProcessBuilder(launcher.toString());
var env = pb.environment();

var libDir = Platform.libDir().toString();
var vmDir = Platform.jvmLibDir().toString();

// set up shared library path
var sharedLibraryPathEnvName = Platform.sharedLibraryPathVariableName();
env.compute(sharedLibraryPathEnvName,
(k, v) -> (v == null) ? libDir : v + File.pathSeparator + libDir);
env.compute(sharedLibraryPathEnvName,
(k, v) -> (v == null) ? vmDir : v + File.pathSeparator + vmDir);

// launch the actual test
System.out.println("Launching: " + launcher + " shared library path: " +
env.get(sharedLibraryPathEnvName));
new OutputAnalyzer(pb.start())
.outputTo(System.out)
.errorTo(System.err)
.shouldHaveExitValue(0);

ProcessBuilder pb = ProcessTools.createNativeTestProcessBuilder("NullCallerTest");
System.out.println("Launching: " + pb.command() + " shared library path: " +
pb.environment().get(Platform.sharedLibraryPathVariableName()));
ProcessTools.executeProcess(pb).shouldHaveExitValue(0);
}

}
Expand Down

3 comments on commit b78896b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on b78896b Mar 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on b78896b Mar 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch backport-GoeLin-b78896b9 in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit b78896b9 from the openjdk/jdk repository.

The commit being backported was authored by Tim Prinzing on 11 Jan 2024 and was reviewed by Mandy Chung.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-b78896b9:backport-GoeLin-b78896b9
$ git checkout backport-GoeLin-b78896b9
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-b78896b9

Please sign in to comment.