From 677ae9b8b9a61d642f8f0235e42ac6eaaf113ca0 Mon Sep 17 00:00:00 2001 From: Marius Volkhart Date: Sun, 14 Mar 2021 10:42:15 +0000 Subject: [PATCH] Limit which tests can run in parallel Some tests modify global resources. Those tests cannot be run in parallel with others, as they cause problems or become flaky. Where possible, indicate to JUnit the resources in contention. Otherwise, mark the tests as needing to run in isolation. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1887630 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/hssf/dev/TestEFBiffViewer.java | 3 +++ .../org/apache/poi/hssf/dev/TestFormulaViewer.java | 3 +++ src/testcases/org/apache/poi/hssf/dev/TestReSave.java | 8 +++++--- .../org/apache/poi/hssf/dev/TestRecordLister.java | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java index a223cc4506..56be2c87af 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java @@ -26,7 +26,10 @@ import org.apache.poi.hssf.record.RecordInputStream; import org.apache.poi.util.NullPrintStream; import org.apache.poi.util.RecordFormatException; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.Resources; +@ResourceLock(Resources.SYSTEM_OUT) class TestEFBiffViewer extends BaseTestIteratingXLS { @BeforeAll public static void setup() { diff --git a/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java index 8637c1ab7a..a0cdaddcd2 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java @@ -27,7 +27,10 @@ import org.apache.poi.hssf.record.RecordInputStream; import org.apache.poi.util.NullPrintStream; import org.apache.poi.util.RecordFormatException; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.Resources; +@ResourceLock(Resources.SYSTEM_OUT) class TestFormulaViewer extends BaseTestIteratingXLS { @BeforeAll public static void setup() { diff --git a/src/testcases/org/apache/poi/hssf/dev/TestReSave.java b/src/testcases/org/apache/poi/hssf/dev/TestReSave.java index 063e561ba3..868561df21 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestReSave.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestReSave.java @@ -30,10 +30,12 @@ import org.apache.poi.util.RecordFormatException; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.parallel.Execution; -import org.junit.jupiter.api.parallel.ExecutionMode; +import org.junit.jupiter.api.parallel.Isolated; +import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.Resources; -@Execution(ExecutionMode.CONCURRENT) +@Isolated("Modifies the test data directory") +@ResourceLock(Resources.SYSTEM_OUT) class TestReSave extends BaseTestIteratingXLS { @BeforeAll public static void setup() { diff --git a/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java b/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java index cec212a9a4..9eb6ebc255 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java @@ -24,7 +24,10 @@ import org.apache.poi.hssf.OldExcelFormatException; import org.apache.poi.util.NullPrintStream; import org.apache.poi.util.RecordFormatException; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.Resources; +@ResourceLock(Resources.SYSTEM_OUT) class TestRecordLister extends BaseTestIteratingXLS { @BeforeAll public static void setup() {