From eeb826d7c1d50d3f5da2ef7f3677c122c0977790 Mon Sep 17 00:00:00 2001 From: "Thomas L. Kjeldsen" Date: Fri, 31 Jan 2020 13:20:18 +0100 Subject: [PATCH 1/3] Update CommandLineTest.testCommandLineVersion() Looks like the test was broken by the System.out.println statement in Base.java https://github.com/arduino/Arduino/commit/824567d763a29aaf439a271414c08d17ad521299 --- app/test/processing/app/CommandLineTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test/processing/app/CommandLineTest.java b/app/test/processing/app/CommandLineTest.java index 9ac760b1fbb..651b6f3b9dd 100644 --- a/app/test/processing/app/CommandLineTest.java +++ b/app/test/processing/app/CommandLineTest.java @@ -142,7 +142,7 @@ public void testCommandLineVersion() throws Exception { .as("Process will finish with exit code 0 in --version") .isEqualTo(0); Assertions.assertThat(new String(IOUtils.toByteArray(pr.getInputStream()))) - .matches("Arduino: \\d+\\.\\d+\\.\\d+.*\r?\n"); + .matches(".*\nArduino: \\d+\\.\\d+\\.\\d+.*\r?\n"); } @Test From 07a46c853fd75312caa2e35cae70addc37484189 Mon Sep 17 00:00:00 2001 From: "Thomas L. Kjeldsen" Date: Fri, 7 Feb 2020 00:17:56 +0100 Subject: [PATCH 2/3] Revert "Update CommandLineTest.testCommandLineVersion()" This reverts commit eeb826d7c1d50d3f5da2ef7f3677c122c0977790. --- app/test/processing/app/CommandLineTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test/processing/app/CommandLineTest.java b/app/test/processing/app/CommandLineTest.java index 651b6f3b9dd..9ac760b1fbb 100644 --- a/app/test/processing/app/CommandLineTest.java +++ b/app/test/processing/app/CommandLineTest.java @@ -142,7 +142,7 @@ public void testCommandLineVersion() throws Exception { .as("Process will finish with exit code 0 in --version") .isEqualTo(0); Assertions.assertThat(new String(IOUtils.toByteArray(pr.getInputStream()))) - .matches(".*\nArduino: \\d+\\.\\d+\\.\\d+.*\r?\n"); + .matches("Arduino: \\d+\\.\\d+\\.\\d+.*\r?\n"); } @Test From 8c3f214a6c289576c49c29f9122b05e424eb829a Mon Sep 17 00:00:00 2001 From: "Thomas L. Kjeldsen" Date: Fri, 7 Feb 2020 00:09:56 +0100 Subject: [PATCH 3/3] Print log4j store directory only when operating in GUI mode This fixes CommandLineTest.testCommandLineVersion() --- app/src/processing/app/Base.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index d8e9b1cac45..815f264da36 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -207,9 +207,6 @@ public Base(String[] args) throws Exception { BaseNoGui.getPlatform().init(); BaseNoGui.initPortableFolder(); - // This configure the logs root folder - System.out.println("Set log4j store directory " + BaseNoGui.getSettingsFolder().getAbsolutePath()); - System.setProperty("log4j.dir", BaseNoGui.getSettingsFolder().getAbsolutePath()); // Look for a possible "--preferences-file" parameter and load preferences BaseNoGui.initParameters(args); @@ -218,6 +215,12 @@ public Base(String[] args) throws Exception { parser.parseArgumentsPhase1(); commandLine = !parser.isGuiMode(); + // This configure the logs root folder + if (parser.isGuiMode()) { + System.out.println("Set log4j store directory " + BaseNoGui.getSettingsFolder().getAbsolutePath()); + } + System.setProperty("log4j.dir", BaseNoGui.getSettingsFolder().getAbsolutePath()); + BaseNoGui.checkInstallationFolder(); // If no path is set, get the default sketchbook folder for this platform