Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App stdout leaks to XHarness stderr #108

Closed
premun opened this issue Apr 28, 2020 · 5 comments · Fixed by #211
Closed

App stdout leaks to XHarness stderr #108

premun opened this issue Apr 28, 2020 · 5 comments · Fixed by #211
Assignees
Labels
apple iOS/tvOS/WatchOS/Mac Catalyst area bug

Comments

@premun
Copy link
Member

premun commented Apr 28, 2020

Part of the stdout that is the app writing and is received in XHarness through the TCP listener is displayed in stdout of XHarness. Only stuff logged through ILogger should be displayed.

Actual:

info: test[0]
      Starting test for ios-simulator-64..
info: test[0]
      Starting application 'System.Numerics.Vectors.Tests' on ios-simulator-64
2020-04-28 03:44:30.671603-0700 System.Numerics.Vectors.Tests[40307:10721880] assembly_preload_hook: System.Private.CoreLib (null) /Users/prvysoky/Library/Developer/CoreSimulator/Devices/1CE4848E-D84A-4600-84AA-3F04A42F2046/data/Containers/Bundle/Application/F91EA8BA-4A19-4EEB-880B-107D5DFE3471/System.Numerics.Vectors.Tests.app
2020-04-28 03:44:30.697425-0700 System.Numerics.Vectors.Tests[40307:10721880] assembly_preload_hook: AppleTestRunner.dll (null) /Users/prvysoky/Library/Developer/CoreSimulator/Devices/1CE4848E-D84A-4600-84AA-3F04A42F2046/data/Containers/Bundle/Application/F91EA8BA-4A19-4EEB-880B-107D5DFE3471/System.Numerics.Vectors.Tests.app
...

Expected:

info: test[0]
      Starting test for ios-simulator-64..
info: test[0]
      Starting application 'System.Numerics.Vectors.Tests' on ios-simulator-64
@premun premun added bug apple iOS/tvOS/WatchOS/Mac Catalyst area labels Apr 28, 2020
@premun premun self-assigned this Apr 28, 2020
@premun
Copy link
Member Author

premun commented Apr 28, 2020

So it looks like the output is in &2, so 2>/dev/null fixes this, but still looking how it gets there

@premun premun changed the title [iOS] App stdout leaks to XHarness stdout [iOS] App stdout leaks to XHarness stderr May 4, 2020
@premun
Copy link
Member Author

premun commented May 14, 2020

I will have another stab at this one - it pains me so much that I cannot figure it out..

@mandel-macaque
Copy link
Member

Confirmed this with the latests master when running on the simulator. Does not happen on device.

@premun
Copy link
Member Author

premun commented May 18, 2020

I originally thought it is happening because of these lines:

var stderrTty = _helpers.GetTerminalName(2);
if (!string.IsNullOrEmpty(stderrTty))
{
args.Add(new SetStderrArgument(stderrTty));
}
else
{
stdoutLogPath = _logs.CreateFile($"mlaunch-stdout-{_helpers.Timestamp}.log", "Standard output");
stderrLogPath = _logs.CreateFile($"mlaunch-stderr-{_helpers.Timestamp}.log", "Standard error");
args.Add(new SetStdoutArgument(stdoutLogPath));
args.Add(new SetStderrArgument(stderrLogPath));
}

In Xamarin, there was also redirection of stdout argument to the stdout. I removed that and now everything is sent to our stderr, which would correspond with the SetStderrArgument part BUT in every run, the mlaunch stdout/err files are created which means the second branch happens.

And also based on ProcessManager, everything should be redirected to the Log that is supplied.

@premun
Copy link
Member Author

premun commented May 18, 2020

Another observation:

If I call dotnet xharness ios test ... 2>/dev/null this goes away, however, if I call it with 2>foo.txt then foo.txt will be an empty file

@premun premun changed the title [iOS] App stdout leaks to XHarness stderr App stdout leaks to XHarness stderr Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apple iOS/tvOS/WatchOS/Mac Catalyst area bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants