<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Jaikiran,</p>
<p>The encoding is intentional ... and has been there since the
beginning of jtreg! <br>
</p>
<p>While .jtr files are intended to only contain ASCII characters,
they are not intended for direct human consumption. The stream
output from tests is encoded so that it can be subsequently read
back in by jtreg and related software.</p>
<p>To view the output of a test without the encoding used in the
.jtr file, use one of:</p>
<ul>
<li>run the test under jtreg with the -va option</li>
<li>run the test directly, using its main(String...) method ...
you can get a script to run the test from the "rerun" section in
the .jtr file</li>
<li>use jtreg to report the content of the stream using the
`-show:<name>` option, such as `jtreg -w:/path/to/work
-show:System.out /path/to/test</li>
</ul>
<p>-- Jon<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 9/3/21 7:25 AM, Jaikiran Pai wrote:<br>
</div>
<blockquote type="cite" cite="mid:0af0cecb-6ef4-b8d5-684b-5d1bb0cec1ad@gmail.com">Any
inputs? Is this a bug or an intentional implementation detail?
<br>
<br>
-Jaikiran
<br>
<br>
On 29/08/21 6:54 pm, Jaikiran Pai wrote:
<br>
<blockquote type="cite">Please consider this trivial Java code
which prints to System.out:
<br>
<br>
public class FooTest {
<br>
public static void main(final String[] args) throws
Exception {
<br>
final String m = "hello \\ world";
<br>
System.out.println("Message is " + m);
<br>
}
<br>
}
<br>
<br>
When you run this as Java code using the "java" command, the
output that gets printed is (as expected):
<br>
<br>
Message is hello \ world
<br>
<br>
Now, if I convert this Java code a jtreg test as follows
(without any code change, just adding jtreg tags):
<br>
<br>
/**
<br>
* @test
<br>
* @run main FooTest
<br>
*/
<br>
public class FooTest {
<br>
public static void main(final String[] args) throws
Exception {
<br>
final String m = "hello \\ world";
<br>
System.out.println("Message is " + m);
<br>
}
<br>
}
<br>
<br>
Running it as a jtreg test, generates a report which has the
System.out section that is:
<br>
<br>
----------System.out:(1/26)*----------
<br>
Message is hello \\ world
<br>
<br>
Notice the unexpected additional backslash in that output. Is
this intentional?
<br>
<br>
In a non-trivial test case, that I was working on, it took me a
(long) while to figure out that it was jtreg which was adding
the additional backslash in the output and it wasn't my test
case that had something wrong.
<br>
<br>
For reference, jtreg -version gives:
<br>
<br>
jtreg -version
<br>
jtreg 6-dev+0
<br>
Installed in /jtreg/build/images/jtreg/lib/jtreg.jar
<br>
Running on platform version 1.8.0_265 from
/adoptopenjdk-8.jdk/Contents/Home/jre.
<br>
Built with Java(TM) 2 SDK, Version 1.8.0_265-b01 on June 27,
2021.
<br>
Copyright (c) 1999, 2021, Oracle and/or its affiliates. All
rights reserved.
<br>
Use is subject to license terms.
<br>
JT Harness, version 6.0 ea b14 (June 27, 2021)
<br>
JCov 3.0-2
<br>
Java Assembler Tools, version 7.0 ea b09 (June 27, 2021)
<br>
TestNG (testng.jar): version 7.3.0
<br>
TestNG (jcommander.jar): version unknown
<br>
TestNG (guice.jar): version 4.2.3
<br>
JUnit (junit.jar): version 4.13.2
<br>
JUnit (hamcrest.jar): version 2.2
<br>
<br>
-Jaikiran
<br>
<br>
<br>
<br>
<br>
</blockquote>
</blockquote>
</body>
</html>