[wasm] Wasm.Build.Tests - fixes for tests failing on CI (#70704)
* [wasm][nodejs] Ensure that stdout/stderr have been flushed out before exiting
When the results xml is large, and we are writing the base64
representation in one line, `node` can exit before all the output gets
flushed out. This results in xharness getting an incomplete
`STARTRESULTXML <len> <base64> ... ` with missing `ENDRESULTXML`, thus
no `testResults.xml` is generated.
This can be seen in the case of `Microsoft.Extensions.Primitives.Tests`
which has xml ~140KB, and `System.Memory.Tests` which has a xml ~13MB.
So, wait for the two streams to be flushed out, with a timeout of 3secs.
* [wasm] Wasm.Build.Tests: improve reading output from processes
- Fix to call `WaitForExit()` once `WaitForExit(int)` returns, which
ensures that all the async handlers have been run.
- Also, for non-browser xharness runs use the emitted `wasm-console.log`
as the output, so we don't depend on xharness' stdout.
* Wasm.Build.Tests: Run the crypto test only with browser. Other cases are covered in library tests
* Enable WasmTemplateTests.ConsolePublishAndRun
Fixes https://github.com/dotnet/runtime/issues/70675
* Wasm.Build.Tests: avoid unncessary copy when building locally
Copy sdk for testing workloads only on CI.
* Address feedback from @kg
* Remove timeout on flushing stdout/stderr streams, for console templates, IOW, user apps