On Mon, 22 Aug 2022 16:07:49 GMT, Weijun Wang <wei...@openjdk.org> wrote:
> Just to clarify, I might have confused the stack trace of the exception > thrown by the test and the newly printed one thrown inside `LoginContext`. I > meant the latter, which is captured in `s` and this bug is about its content. So the patch should look like : # git diff diff --git a/test/jdk/javax/security/auth/login/LoginContext/OptionalJaas/UnixNTPlatform.java b/test/jdk/javax/security/auth/login/LoginContext/OptionalJaas/UnixNTPlatform.java index 6ce0c0ae8fa..5a1aa98ec99 100644 --- a/test/jdk/javax/security/auth/login/LoginContext/OptionalJaas/UnixNTPlatform.java +++ b/test/jdk/javax/security/auth/login/LoginContext/OptionalJaas/UnixNTPlatform.java @@ -39,7 +39,7 @@ import java.io.PrintStream; public class UnixNTPlatform { public static void main(String[] args) throws Exception { - System.out.println("Testing cross-platform"); + System.out.println("Testing cross-platform"); String config = """ hello { @@ -71,7 +71,9 @@ public class UnixNTPlatform { byte[] byes = stream.toByteArray(); String s = new String(byes); if (!s.contains("Failed in attempt to import the underlying")) { - throw new RuntimeException(); + //throw new RuntimeException(); + System.out.printf("-- call stack is -- %n%s%n", s); + throw new RuntimeException(); } else { System.out.printf("-- call stack is -- %n%s%n", s); } ? I tried to execute the test case with this change and I don't see anything changed much. # jtreg/bin/jtreg -jdk:/root/jdk/build.master/linux-x86_64-server-release/images/jdk/ test/jdk/javax/security/auth/login/LoginContext/OptionalJaas/UnixNTPlatform.java Test results: failed: 1 Report written to /root/jdk/JTreport/html/report.html Results written to /root/jdk/JTwork Error: Some tests failed or other problems occurred. [root@hp-z210-01 jdk]# cat JTwork/javax/security/auth/login/LoginContext/OptionalJaas/UnixNTPlatform.jtr #Test Results (version 2) #Mon Aug 22 12:59:50 EDT 2022 #-----testdescription----- $file=/root/jdk/test/jdk/javax/security/auth/login/LoginContext/OptionalJaas/UnixNTPlatform.java $root=/root/jdk/test/jdk keywords=bug8215916 othervm run=USER_SPECIFIED main/othervm -Djava.security.debug=logincontext UnixNTPlatform\n source=UnixNTPlatform.java title=This test case attempts to verify whether call stack trace is printed when JAAS optional login fails when debug is true. #-----environment----- #-----testresult----- description=file:/root/jdk/test/jdk/javax/security/auth/login/LoginContext/OptionalJaas/UnixNTPlatform.java elapsed=159 0:00:00.159 end=Mon Aug 22 12:59:50 EDT 2022 environment=regtest execStatus=Failed. Execution failed: `main' threw exception: java.lang.RuntimeException harnessLoaderMode=Classpath Loader harnessVariety=Full Bundle hostname=hp-z210-01.ml3.eng.bos.redhat.com javatestOS=Linux 5.18.13-200.fc36.x86_64 (amd64) javatestVersion=6.0-ea+b14-2022-02-03 jtregVersion=jtreg 6.2 dev 0 script=com.sun.javatest.regtest.exec.RegressionScript sections=script_messages build main start=Mon Aug 22 12:59:50 EDT 2022 test=javax/security/auth/login/LoginContext/OptionalJaas/UnixNTPlatform.java testJDK=/root/jdk/build.master/linux-x86_64-server-release/images/jdk totalTime=162 user.name=root work=/root/jdk/JTwork/javax/security/auth/login/LoginContext/OptionalJaas #section:script_messages ----------messages:(4/263)---------- JDK under test: /root/jdk/build.master/linux-x86_64-server-release/images/jdk openjdk version "20-internal" 2023-03-21 OpenJDK Runtime Environment (build 20-internal-adhoc.root.jdk) OpenJDK 64-Bit Server VM (build 20-internal-adhoc.root.jdk, mixed mode, sharing) #section:build ----------messages:(3/99)---------- command: build UnixNTPlatform reason: Named class compiled on demand elapsed time (seconds): 0.001 result: Passed. All files up to date #section:main ----------messages:(4/228)---------- command: main -Djava.security.debug=logincontext UnixNTPlatform reason: User specified action: run main/othervm -Djava.security.debug=logincontext UnixNTPlatform Mode: othervm [/othervm specified] elapsed time (seconds): 0.111 ----------configuration:(0/0)---------- ----------System.out:(43/1841)---------- Testing cross-platform config is : hello { com.sun.security.auth.module.UnixLoginModule optional debug=true; com.sun.security.auth.module.NTLoginModule optional debug=true; }; [UnixLoginModule]: succeeded importing info: uid = 0 gid = 0 supp gid = 0 [NTLoginModule] Failed in NT login [UnixLoginModule]: added UnixPrincipal, UnixNumericUserPrincipal, UnixNumericGroupPrincipal(s), to Subject [NTLoginModule]: did not add any Principals to Subject because own authentication failed. Subject: Principal: UnixPrincipal: root Principal: UnixNumericUserPrincipal: 0 Principal: UnixNumericGroupPrincipal [Primary Group]: 0 [UnixLoginModule]: logged out Subject [NTLoginModule] completed logout processing -- call stack is -- [LoginContext]: Build ServiceProviders cache for ClassLoader: app [LoginContext]: Discovered ServiceProviders for ClassLoader: app java.util.ServiceLoader$ProviderImpl@26235ac3 java.util.ServiceLoader$ProviderImpl@b2ec215d java.util.ServiceLoader$ProviderImpl@a4b0c752 java.util.ServiceLoader$ProviderImpl@7231ae26 java.util.ServiceLoader$ProviderImpl@20ac495b java.util.ServiceLoader$ProviderImpl@2f3bbd71 java.util.ServiceLoader$ProviderImpl@78ff4ab0 [LoginContext]: com.sun.security.auth.module.UnixLoginModule loaded as a service [LoginContext]: com.sun.security.auth.module.UnixLoginModule login success [LoginContext]: com.sun.security.auth.module.NTLoginModule loaded as a service [LoginContext]: com.sun.security.auth.module.NTLoginModule login OPTIONAL failure [LoginContext]: com.sun.security.auth.module.UnixLoginModule commit success [LoginContext]: com.sun.security.auth.module.NTLoginModule commit ignored [LoginContext]: com.sun.security.auth.module.UnixLoginModule logout success [LoginContext]: com.sun.security.auth.module.NTLoginModule logout success ----------System.err:(11/552)---------- java.lang.RuntimeException at UnixNTPlatform.main(UnixNTPlatform.java:76) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127) at java.base/java.lang.Thread.run(Thread.java:1589) JavaTest Message: Test threw exception: java.lang.RuntimeException JavaTest Message: shutting down test STATUS:Failed.`main' threw exception: java.lang.RuntimeException ----------rerun:(23/1650)*---------- cd /root/jdk/JTwork/scratch && \\ HOME=/root \\ LANG=en_US.UTF-8 \\ PATH=/bin:/usr/bin:/usr/sbin \\ XMODIFIERS=@im=ibus \\ CLASSPATH=/root/jdk/JTwork/classes/javax/security/auth/login/LoginContext/OptionalJaas/UnixNTPlatform.d:/root/jdk/test/jdk/javax/security/auth/login/LoginContext/OptionalJaas:/root/jdk/jtreg/lib/javatest.jar:/root/jdk/jtreg/lib/jtreg.jar \\ ------------- PR: https://git.openjdk.org/jdk/pull/9159