Skip to content

Bugfixes on tests and github actions runner for Windows #10196

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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: gather all output before going on with tests
Wait for consumer thread to collect all output before returning from
command line run. This patch avoid a race condition (the test output
is checked before all the output is actually collected).
  • Loading branch information
cmaglie committed Jun 19, 2020
commit 1621776cc725f8d33e58053c7dea5574e3f6a7b5
14 changes: 9 additions & 5 deletions app/test/processing/app/CommandLineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,16 @@ public static void findBuildPaths() throws Exception {
System.out.println("found arduino: " + arduinoPath);
}

private void consume(InputStream s, OutputStream out) {
new Thread(() -> {
private Thread consume(InputStream s, OutputStream out) {
Thread t = new Thread(() -> {
try {
IOUtils.copy(s, out);
} catch (IOException e) {
e.printStackTrace();
}
}).start();
});
t.start();
return t;
}

public Process runArduino(OutputStream output, boolean success, File wd, String[] extraArgs) throws IOException, InterruptedException {
Expand All @@ -107,9 +109,11 @@ public Process runArduino(OutputStream output, boolean success, File wd, String[
System.out.println("Running: " + String.join(" ", args));

Process pr = rt.exec(args.toArray(new String[0]), null, wd);
consume(pr.getInputStream(), output);
consume(pr.getErrorStream(), System.err);
Thread outThread = consume(pr.getInputStream(), output);
Thread errThread = consume(pr.getErrorStream(), System.err);
pr.waitFor();
outThread.join(5000);
errThread.join(5000);
if (success)
assertEquals(0, pr.exitValue());
return pr;
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy