JDK-8035186 : j2se_jdk/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java - assertion error
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: hs25,emb-8u6,emb-8u26,8u5,8u40,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-02-18
  • Updated: 2023-07-25
  • Resolved: 2014-05-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9 Other
8u391Fixed 9 b16Fixed openjdk8u292Fixed
Description
java.lang.AssertionError: only show error once expected [1] but found [0]

from JTR log:

#section:testng
----------messages:(3/139)----------
command: testng LogGeneratedClassesTest
reason: User specified action: run testng LogGeneratedClassesTest 
elapsed time (seconds): 131.179
----------System.out:(52/3025)----------
[TestNG] Running:
  java/lang/invoke/lambda/LogGeneratedClassesTest.java

config LogGeneratedClassesTest.setup(): success
test LogGeneratedClassesTest.testDumpDirIsFile(): success
test LogGeneratedClassesTest.testDumpDirNotExist(): success
test LogGeneratedClassesTest.testDumpDirNotWritable(): failure
java.lang.AssertionError: only show error once expected [1] but found [0]
	at org.testng.Assert.fail(Assert.java:94)
	at org.testng.Assert.failNotEquals(Assert.java:494)
	at org.testng.Assert.assertEquals(Assert.java:123)
	at org.testng.Assert.assertEquals(Assert.java:265)
	at LogGeneratedClassesTest.testDumpDirNotWritable(LogGeneratedClassesTest.java:186)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:484)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
	at org.testng.TestRunner.privateRun(TestRunner.java:767)
	at org.testng.TestRunner.run(TestRunner.java:617)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
	at org.testng.TestNG.run(TestNG.java:1057)
	at com.sun.javatest.regtest.TestNGAction$TestNGRunner.main(TestNGAction.java:161)
	at com.sun.javatest.regtest.TestNGAction$TestNGRunner.main(TestNGAction.java:145)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:484)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:744)
test LogGeneratedClassesTest.testLogging(): success
test LogGeneratedClassesTest.testLoggingException(): success
test LogGeneratedClassesTest.testNotLogging(): success
config LogGeneratedClassesTest.cleanup(): success

===============================================
java/lang/invoke/lambda/LogGeneratedClassesTest.java
Total tests run: 6, Failures: 1, Skips: 0
===============================================
Comments
Fix Request (8u). Low risk, test bug fix, applies cleanly, updated test passes.
18-12-2020

URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/0d9f2bdf6dc9 User: lana Date: 2014-06-04 17:15:00 +0000
04-06-2014

URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/0d9f2bdf6dc9 User: vlivanov Date: 2014-05-29 09:28:26 +0000
29-05-2014

Windows isn't affected.
27-05-2014

Though it's a setup issue, as an afterthought I decided the test can workaround it. Suggested fix: diff --git a/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java b/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java --- a/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java +++ b/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java @@ -175,6 +175,11 @@ return; } + if ("root".equals(System.getProperty("user.name"))) { + // Not applicable to super user: it can create files in read-only directories. + return; + } + Files.createDirectory(Paths.get("readOnly"), asFileAttribute(fromString("r-xr-xr-x"))); Not sure about Windows though.
27-05-2014

George, do you have any links to the failing runs? My analysis shows it's setup error. Do you run tests under super-user? Failing test creates read-only folder, but super-user is able to create files in it anyway. That's why the test fails.
27-05-2014

ILW=Missing assert, Not always reproducibel, none=MMH=P3
10-04-2014

ILW M?? = P2 I: Medium, Doesn't crash test fails L: Unknown (High), W: Unknown (High),
19-02-2014