Skip to content

Commit 84d8348

Browse files
committed
fix disk space issue on MacOSX CI
1 parent 05f4222 commit 84d8348

File tree

8 files changed

+109
-0
lines changed

8 files changed

+109
-0
lines changed

runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
import org.antlr.v4.tool.GrammarSemanticsMessage;
4545
import org.antlr.v4.tool.LexerGrammar;
4646
import org.antlr.v4.tool.Rule;
47+
import org.junit.rules.TestRule;
48+
import org.junit.rules.TestWatcher;
49+
import org.junit.runner.Description;
4750
import org.stringtemplate.v4.ST;
4851
import org.stringtemplate.v4.STGroup;
4952
import org.stringtemplate.v4.STGroupString;
@@ -89,6 +92,17 @@ public class BaseCppTest implements RuntimeTestSupport {
8992
/** Errors found while running antlr */
9093
protected StringBuilder antlrToolErrors;
9194

95+
@org.junit.Rule
96+
public final TestRule testWatcher = new TestWatcher() {
97+
98+
@Override
99+
protected void succeeded(Description description) {
100+
// remove tmpdir if no error.
101+
eraseTempDir();
102+
}
103+
104+
};
105+
92106
private String getPropertyPrefix() {
93107
return "antlr-" + getLanguage().toLowerCase();
94108
}

runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/BaseCSharpTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,17 @@ public class BaseCSharpTest implements RuntimeTestSupport {
121121
*/
122122
protected StringBuilder antlrToolErrors;
123123

124+
@org.junit.Rule
125+
public final TestRule testWatcher = new TestWatcher() {
126+
127+
@Override
128+
protected void succeeded(Description description) {
129+
// remove tmpdir if no error.
130+
eraseTempDir();
131+
}
132+
133+
};
134+
124135
@Override
125136
public void testSetUp() throws Exception {
126137
if (CREATE_PER_TEST_DIRECTORIES) {

runtime-testsuite/test/org/antlr/v4/test/runtime/dart/BaseDartTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors;
2727
import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors;
2828
import org.antlr.v4.tool.*;
29+
import org.junit.rules.TestRule;
30+
import org.junit.rules.TestWatcher;
31+
import org.junit.runner.Description;
2932
import org.stringtemplate.v4.ST;
3033
import org.stringtemplate.v4.STGroup;
3134
import org.stringtemplate.v4.STGroupString;
@@ -126,6 +129,17 @@ public class BaseDartTest implements RuntimeTestSupport {
126129

127130
private static String cacheDartPackages;
128131

132+
@org.junit.Rule
133+
public final TestRule testWatcher = new TestWatcher() {
134+
135+
@Override
136+
protected void succeeded(Description description) {
137+
// remove tmpdir if no error.
138+
eraseTempDir();
139+
}
140+
141+
};
142+
129143
private String getPropertyPrefix() {
130144
return "antlr-dart";
131145
}

runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseGoTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
import org.antlr.v4.tool.GrammarSemanticsMessage;
4242
import org.antlr.v4.tool.LexerGrammar;
4343
import org.antlr.v4.tool.Rule;
44+
import org.junit.rules.TestRule;
45+
import org.junit.rules.TestWatcher;
46+
import org.junit.runner.Description;
4447
import org.stringtemplate.v4.ST;
4548
import org.stringtemplate.v4.STGroup;
4649
import org.stringtemplate.v4.STGroupString;
@@ -86,6 +89,17 @@ public class BaseGoTest implements RuntimeTestSupport {
8689
/** Errors found while running antlr */
8790
protected StringBuilder antlrToolErrors;
8891

92+
@org.junit.Rule
93+
public final TestRule testWatcher = new TestWatcher() {
94+
95+
@Override
96+
protected void succeeded(Description description) {
97+
// remove tmpdir if no error.
98+
eraseTempDir();
99+
}
100+
101+
};
102+
89103
/**
90104
* Copies all files from go runtime to a temporary folder that is inside a valid GOPATH project structure.
91105
*/

runtime-testsuite/test/org/antlr/v4/test/runtime/java/BaseJavaTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
import org.antlr.v4.tool.GrammarSemanticsMessage;
4343
import org.antlr.v4.tool.LexerGrammar;
4444
import org.antlr.v4.tool.Rule;
45+
import org.junit.rules.TestRule;
46+
import org.junit.rules.TestWatcher;
47+
import org.junit.runner.Description;
4548
import org.stringtemplate.v4.ST;
4649
import org.stringtemplate.v4.STGroup;
4750
import org.stringtemplate.v4.STGroupString;
@@ -170,6 +173,17 @@ public class BaseJavaTest implements RuntimeTestSupport {
170173
*/
171174
protected StringBuilder antlrToolErrors;
172175

176+
@org.junit.Rule
177+
public final TestRule testWatcher = new TestWatcher() {
178+
179+
@Override
180+
protected void succeeded(Description description) {
181+
// remove tmpdir if no error.
182+
eraseTempDir();
183+
}
184+
185+
};
186+
173187
@Override
174188
public void testSetUp() throws Exception {
175189
// STGroup.verbose = true;

runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/BaseNodeTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
import org.antlr.v4.test.runtime.*;
1616
import org.antlr.v4.tool.Grammar;
1717
import org.antlr.v4.tool.LexerGrammar;
18+
import org.junit.rules.TestRule;
19+
import org.junit.rules.TestWatcher;
20+
import org.junit.runner.Description;
1821
import org.stringtemplate.v4.ST;
1922

2023
import java.io.File;
@@ -46,6 +49,17 @@ public class BaseNodeTest implements RuntimeTestSupport {
4649
/** Errors found while running antlr */
4750
protected StringBuilder antlrToolErrors;
4851

52+
@org.junit.Rule
53+
public final TestRule testWatcher = new TestWatcher() {
54+
55+
@Override
56+
protected void succeeded(Description description) {
57+
// remove tmpdir if no error.
58+
eraseTempDir();
59+
}
60+
61+
};
62+
4963
@Override
5064
public void testSetUp() throws Exception {
5165
// new output dir for each test

runtime-testsuite/test/org/antlr/v4/test/runtime/php/BasePHPTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
import org.antlr.v4.test.runtime.StreamVacuum;
3131
import org.antlr.v4.tool.Grammar;
3232
import org.antlr.v4.tool.LexerGrammar;
33+
import org.junit.rules.TestRule;
34+
import org.junit.rules.TestWatcher;
35+
import org.junit.runner.Description;
3336
import org.stringtemplate.v4.ST;
3437

3538
import static org.antlr.v4.test.runtime.BaseRuntimeTest.antlrOnString;
@@ -53,6 +56,17 @@ public class BasePHPTest implements RuntimeTestSupport {
5356
*/
5457
protected StringBuilder antlrToolErrors;
5558

59+
@org.junit.Rule
60+
public final TestRule testWatcher = new TestWatcher() {
61+
62+
@Override
63+
protected void succeeded(Description description) {
64+
// remove tmpdir if no error.
65+
eraseTempDir();
66+
}
67+
68+
};
69+
5670
private String getPropertyPrefix() {
5771
return "antlr-php";
5872
}

runtime-testsuite/test/org/antlr/v4/test/runtime/swift/BaseSwiftTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
1212
import org.antlr.v4.test.runtime.RuntimeTestSupport;
1313
import org.antlr.v4.test.runtime.StreamVacuum;
14+
import org.junit.rules.TestRule;
15+
import org.junit.rules.TestWatcher;
16+
import org.junit.runner.Description;
1417
import org.stringtemplate.v4.ST;
1518

1619
import java.io.BufferedReader;
@@ -96,6 +99,17 @@ public void run() {
9699
*/
97100
private final Set<String> sourceFiles = new HashSet<>();
98101

102+
@org.junit.Rule
103+
public final TestRule testWatcher = new TestWatcher() {
104+
105+
@Override
106+
protected void succeeded(Description description) {
107+
// remove tmpdir if no error.
108+
eraseTempDir();
109+
}
110+
111+
};
112+
99113
@Override
100114
public void testSetUp() throws Exception {
101115
// new output dir for each test

0 commit comments

Comments
 (0)