Skip to content

Commit 2d165a2

Browse files
committedJul 22, 2021
8271160: runtime/jni/checked/TestCheckedJniExceptionCheck.java doesn't set -Djava.library.path
Reviewed-by: dcubed, dholmes
1 parent 7165b3f commit 2d165a2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed
 

‎test/hotspot/jtreg/runtime/jni/checked/TestCheckedJniExceptionCheck.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
3030
*/
3131

3232
import java.util.List;
33+
import jdk.test.lib.Utils;
3334
import jdk.test.lib.process.ProcessTools;
3435
import jdk.test.lib.process.OutputAnalyzer;
3536

@@ -154,6 +155,7 @@ private native void initMethodIds(String callableMethodName,
154155

155156
// Check warnings appear where they should, with start/end statements in output...
156157
static void checkOuputForCorrectWarnings(OutputAnalyzer oa) throws RuntimeException {
158+
oa.shouldHaveExitValue(0);
157159
List<String> lines = oa.asLines();
158160
int expectedWarnings = 0;
159161
int warningCount = 0;
@@ -175,12 +177,10 @@ static void checkOuputForCorrectWarnings(OutputAnalyzer oa) throws RuntimeExcept
175177
oa.reportDiagnosticSummary();
176178
throw new RuntimeException("Unexpected warning at line " + lineNo);
177179
}
178-
}
179-
else if (line.startsWith(EXPECT_WARNING_START)) {
180+
} else if (line.startsWith(EXPECT_WARNING_START)) {
180181
String countStr = line.substring(EXPECT_WARNING_START.length() + 1);
181182
expectedWarnings = Integer.parseInt(countStr);
182-
}
183-
else if (line.startsWith(EXPECT_WARNING_END)) {
183+
} else if (line.startsWith(EXPECT_WARNING_END)) {
184184
if (warningCount != expectedWarnings) {
185185
oa.reportDiagnosticSummary();
186186
throw new RuntimeException("Missing warning at line " + lineNo);
@@ -189,6 +189,9 @@ else if (line.startsWith(EXPECT_WARNING_END)) {
189189
expectedWarnings = 0;
190190
}
191191
}
192+
if (!testStartLine) {
193+
throw new RuntimeException("Missing test start line after " + lineNo + " lines");
194+
}
192195
/*
193196
System.out.println("Output looks good...");
194197
oa.reportDiagnosticSummary();
@@ -203,7 +206,8 @@ public static void main(String[] args) throws Throwable {
203206

204207
// launch and check output
205208
checkOuputForCorrectWarnings(ProcessTools.executeTestJvm("-Xcheck:jni",
206-
"TestCheckedJniExceptionCheck"));
209+
"-Djava.library.path=" + Utils.TEST_NATIVE_PATH,
210+
"TestCheckedJniExceptionCheck"));
207211
}
208212

209213
}

0 commit comments

Comments
 (0)
Please sign in to comment.