forked from jasder/antlr
improve management of test directories
This commit is contained in:
parent
84fbdc8038
commit
e38eec4d95
|
@ -148,10 +148,15 @@ public abstract class BaseTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
String prop = System.getProperty("antlr-java-test-dir");
|
||||||
|
if(prop!=null && prop.length()>0)
|
||||||
|
tmpdir = prop;
|
||||||
|
else
|
||||||
// new output dir for each test
|
// new output dir for each test
|
||||||
tmpdir = new File(System.getProperty("java.io.tmpdir"),
|
tmpdir = new File(System.getProperty("java.io.tmpdir"),
|
||||||
getClass().getSimpleName()+"-"+System.currentTimeMillis()).getAbsolutePath();
|
getClass().getSimpleName()+"-"+System.currentTimeMillis()).getAbsolutePath();
|
||||||
// tmpdir = "/tmp";
|
if(new File(tmpdir).exists())
|
||||||
|
eraseFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected org.antlr.v4.Tool newTool(String[] args) {
|
protected org.antlr.v4.Tool newTool(String[] args) {
|
||||||
|
@ -1175,12 +1180,19 @@ public abstract class BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void eraseTempDir() {
|
protected void eraseTempDir() {
|
||||||
|
boolean doErase = true;
|
||||||
|
String propName = "antlr-java-erase-test-dir";
|
||||||
|
String prop = System.getProperty(propName);
|
||||||
|
if(prop!=null && prop.length()>0)
|
||||||
|
doErase = Boolean.getBoolean(prop);
|
||||||
|
if(doErase) {
|
||||||
File tmpdirF = new File(tmpdir);
|
File tmpdirF = new File(tmpdir);
|
||||||
if ( tmpdirF.exists() ) {
|
if ( tmpdirF.exists() ) {
|
||||||
eraseFiles();
|
eraseFiles();
|
||||||
tmpdirF.delete();
|
tmpdirF.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getFirstLineOfException() {
|
public String getFirstLineOfException() {
|
||||||
if ( this.stderrDuringParse ==null ) {
|
if ( this.stderrDuringParse ==null ) {
|
||||||
|
|
Loading…
Reference in New Issue