Community
Participate
Working Groups
When I run the automated tests I get a barage of useless junk printed out to the console and as a result it's very easy to miss important problems like exceptions getting thrown and genuine errors that are indicitive of problems butdon't cause a test to fail. We should clean this up. The two worst offenders are: 1) The jar verifier tests that print out countless messages like: Verifying org.eclipse.equinox.p2.artifact.repository_1.0.100.v20081024.jar: STDOUT: jar verified. STDOUT: STDOUT: Warning: STDOUT: This jar contains entries whose signer certificate will expire within six months. STDOUT: STDOUT: Re-run with the -verbose and -certs options for more details. 2) The mirroring tests with emssage like: Mirroring: helloworldfeature/org.eclipse.update.feature/1.0.0 (Descriptor: canonical: helloworldfeature/org.eclipse.update.feature/1.0.0) Mirroring: yetanotherfeature/org.eclipse.update.feature/1.0.0 (Descriptor: canonical: yetanotherfeature/org.eclipse.update.feature/1.0.0) Artifact: canonical: helloworld/osgi.bundle/1.0.0 already exists in repository: file:/C:/workspaces/junit-workspace/1227886938015-0.8651159694093722/BasicMirrorApplicationTest/. Artifact: canonical: helloworldfeature/org.eclipse.update.feature/1.0.0 already exists in repository: file:/C:/workspaces/junit-workspace/1227886938015-0.8651159694093722/BasicMirrorApplicationTest/.
I'm not sure if there is a way to suppress the messages from the mirror tests since they just call the application which is simulating calling the app from the command-line. (and prints messages back to the user)
Tests can redirect the output streams before running other code, see org.eclipse.pde.build.tests/ProductTests.testBug238001 as an example
Ah cool... didn't know that! Here is the block of code for those who don't have pde.build.tests checked out in their workspace: PrintStream oldErr = System.err; PrintStream newErr = new PrintStream(new FileOutputStream(buildFolder.getLocation().toOSString() + "/out.out")); System.setErr(newErr); IconExe.main(new String[] {win32File.getLocation().toOSString(), icoFile.getLocation().toOSString()}); IconExe.main(new String[] {win64File.getLocation().toOSString(), icoFile.getLocation().toOSString()}); System.setErr(oldErr); newErr.close();
I have fixed JarProcessorTests to not spew to sysout.
For the mirror app tests, perhaps we could put code in the #run method. Maybe something like: PrintStream oldErr = System.err; PrintStream oldOut = System.out; PrintStream newErr = new PrintStream(...); PrintStream newOut = new PrintStream(...); try { app.start(context); } finally { System.setOut(oldOut); System.setErr(oldErr); newErr.close(); newOut.close(); }
Created attachment 119904 [details] Disables verbose logging for Mirror Application Tests I just removed the -verbose argument from all tests except testCompareUsingMD5Comparator and testBaselineCompareUsingMD5Comparator. These are the only tests that need verbose logging, so I just reassigned stdout as per DJ's suggestion (I was reassigning stderr anyway) Only affects the Artifact Repository Mirror Application.
Thanks Andrew. I've committed to HEAD with a tiny tweak on the file names for sys out and err.