small improvements to locating mono, node
This commit is contained in:
parent
978851f703
commit
79dbb8be96
|
@ -130,9 +130,12 @@ Note that ANTLR is written in itself, which is why maven downloads antlr4-4.5.ja
|
|||
|
||||
## Running test subsets
|
||||
|
||||
*From the `runtime-testsuite` dir*
|
||||
|
||||
### Run one test group across targets
|
||||
|
||||
```bash
|
||||
$ cd runtime-testsuite
|
||||
$ mvn -Dtest=TestParserExec test
|
||||
-------------------------------------------------------
|
||||
T E S T S
|
||||
|
|
|
@ -494,7 +494,7 @@ public class BaseCSharpTest implements RuntimeTestSupport, SpecialRuntimeTestAss
|
|||
}
|
||||
|
||||
private String locateTool(String tool) {
|
||||
String[] roots = { "/usr/bin/", "/usr/local/bin/" };
|
||||
String[] roots = { "/opt/local/bin/", "/usr/bin/", "/usr/local/bin/" };
|
||||
for(String root : roots) {
|
||||
if(new File(root + tool).exists())
|
||||
return root + tool;
|
||||
|
|
|
@ -450,21 +450,35 @@ public class BaseNodeTest implements RuntimeTestSupport {
|
|||
return null;
|
||||
}
|
||||
|
||||
private boolean canExecute(String tool) {
|
||||
try {
|
||||
ProcessBuilder builder = new ProcessBuilder(tool, "--version");
|
||||
builder.redirectErrorStream(true);
|
||||
Process process = builder.start();
|
||||
StreamVacuum vacuum = new StreamVacuum(process.getInputStream());
|
||||
vacuum.start();
|
||||
process.waitFor();
|
||||
vacuum.join();
|
||||
return process.exitValue() == 0;
|
||||
}
|
||||
catch (Exception e) {
|
||||
;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String locateNodeJS() {
|
||||
// typically /usr/local/bin/node
|
||||
String propName = "antlr-javascript-nodejs";
|
||||
String prop = System.getProperty(propName);
|
||||
if (prop == null || prop.length() == 0) {
|
||||
prop = locateTool("nodejs"); // seems to be nodejs on ubuntu
|
||||
|
||||
if ( prop!=null && prop.length()!=0 ) {
|
||||
return prop;
|
||||
}
|
||||
if ( prop==null ) {
|
||||
prop = locateTool("node"); // seems to be node on mac
|
||||
if (canExecute("nodejs")) {
|
||||
return "nodejs"; // nodejs on Debian without node-legacy package
|
||||
}
|
||||
File file = new File(prop);
|
||||
if (!file.exists()) {
|
||||
throw new RuntimeException("Missing system property:" + propName);
|
||||
}
|
||||
return prop;
|
||||
return "node"; // everywhere else
|
||||
}
|
||||
|
||||
private String locateRuntime() {
|
||||
|
|
|
@ -592,10 +592,11 @@ public abstract class BasePythonTest implements RuntimeTestSupport {
|
|||
}
|
||||
|
||||
private String locateTool(String tool) {
|
||||
String[] roots = { "/usr/bin/", "/usr/local/bin/" };
|
||||
String[] roots = { "/opt/local/bin", "/usr/bin/", "/usr/local/bin/" };
|
||||
for(String root : roots) {
|
||||
if(new File(root + tool).exists())
|
||||
return root + tool;
|
||||
if(new File(root + tool).exists()) {
|
||||
return root+tool;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("Could not locate " + tool);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue