merge old and new travis; improve so it runs C++ on osx; update BaseSwiftTest so it mirrors other targets; remove unneeded dep in pom to some json stuff
This commit is contained in:
parent
e0b326677b
commit
66be087c38
40
.travis.yml
40
.travis.yml
|
@ -1,30 +1,26 @@
|
|||
sudo: true
|
||||
|
||||
language: java
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
jdk: oraclejdk8
|
||||
- os: osx
|
||||
osx_image: xcode8
|
||||
|
||||
script:
|
||||
- mvn -Dparallel=methods -DthreadCount=4 install
|
||||
|
||||
jdk:
|
||||
- oraclejdk7
|
||||
- oraclejdk8
|
||||
|
||||
before_install:
|
||||
- if [[ $TRAVIS_OS_NAME == osx ]]; then ./travis/before_install-macos.sh; fi
|
||||
- if [[ $TRAVIS_OS_NAME == linux ]]; then ./travis/before_install-linux.sh; fi
|
||||
|
||||
env:
|
||||
- CXX=g++-5
|
||||
|
||||
compiler:
|
||||
- clang
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
compiler: clang
|
||||
language: java
|
||||
jdk: oraclejdk7
|
||||
- os: osx
|
||||
compiler: clang
|
||||
language: java
|
||||
osx_image: xcode8.1
|
||||
|
||||
script:
|
||||
- if [[ $TRAVIS_OS_NAME == osx ]]; then cd runtime-testsuite; ../.travis/run-tests-macos.sh; fi
|
||||
- if [[ $TRAVIS_OS_NAME == linux ]]; then cd runtime-testsuite; ../.travis/run-tests-linux.sh; fi
|
||||
|
||||
before_install:
|
||||
- if [[ $TRAVIS_OS_NAME == osx ]]; then ./.travis/before-install-macos.sh; fi
|
||||
- if [[ $TRAVIS_OS_NAME == linux ]]; then ./.travis/before-install-linux.sh; fi
|
||||
|
||||
addons:
|
||||
apt:
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
thisdir=$(dirname $(readlink -f "$0"))
|
||||
|
||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
|
||||
sudo add-apt-repository ppa:fkrull/deadsnakes -y
|
||||
sudo add-apt-repository ppa:rwky/nodejs -y
|
||||
|
@ -14,4 +12,6 @@ echo "deb http://download.mono-project.com/repo/debian wheezy/snapshots/3.12.1 m
|
|||
sudo apt-get install -qq mono-complete
|
||||
eval "$(sudo gimme 1.7.3)"
|
||||
|
||||
"$thisdir/before_install-common.sh"
|
||||
( go version ; go env ) || true
|
||||
python --version
|
||||
python3 --version
|
|
@ -5,11 +5,13 @@ set -euo pipefail
|
|||
thisdir=$(dirname "$0")
|
||||
|
||||
brew update
|
||||
brew install mono python3
|
||||
brew install mono python3 cmake
|
||||
|
||||
# Work around apparent rvm bug that is in Travis's Xcode image.
|
||||
# https://github.com/direnv/direnv/issues/210
|
||||
# https://github.com/travis-ci/travis-ci/issues/6307
|
||||
shell_session_update() { :; }
|
||||
|
||||
"$thisdir/before_install-common.sh"
|
||||
( go version ; go env ) || true
|
||||
python --version
|
||||
python3 --version
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
mvn -Dtest=java.* test
|
||||
mvn -Dtest=csharp.* test
|
||||
mvn -Dtest=python2.* test
|
||||
mvn -Dtest=python3.* test
|
||||
mvn -Dtest=node.* test
|
||||
mvn -Dtest=go.* test
|
||||
mvn -Dtest=cpp.* test
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
mvn -Dtest=java.* test
|
||||
mvn -Dtest=csharp.* test
|
||||
mvn -Dtest=python2.* test
|
||||
mvn -Dtest=python3.* test
|
||||
mvn -Dtest=node.* test
|
||||
mvn -Dtest=go.* test
|
||||
mvn -Dtest=cpp.* test
|
||||
mvn -Dtest=swift.* test
|
|
@ -582,6 +582,7 @@ public class BaseCppTest implements RuntimeTestSupport {
|
|||
}
|
||||
|
||||
private String runProcess(ProcessBuilder builder, String description) throws Exception {
|
||||
// System.out.println("BUILDER: "+builder.command());
|
||||
Process process = builder.start();
|
||||
StreamVacuum stdoutVacuum = new StreamVacuum(process.getInputStream());
|
||||
StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream());
|
||||
|
@ -593,6 +594,7 @@ public class BaseCppTest implements RuntimeTestSupport {
|
|||
String output = stdoutVacuum.toString();
|
||||
if ( stderrVacuum.toString().length()>0 ) {
|
||||
this.stderrDuringParse = stderrVacuum.toString();
|
||||
System.err.println(this.stderrDuringParse);
|
||||
}
|
||||
if (errcode != 0) {
|
||||
String err = "execution failed with error code: "+errcode;
|
||||
|
@ -620,7 +622,7 @@ public class BaseCppTest implements RuntimeTestSupport {
|
|||
System.out.println("Building ANTLR4 C++ runtime (if necessary) at "+ runtimePath);
|
||||
|
||||
try {
|
||||
String command[] = { "cmake", ".", "-DCMAKE_BUILD_TYPE=release" };
|
||||
String command[] = { "cmake", ".", "-DCMAKE_CXX_COMPILER=clang++", "-DCMAKE_BUILD_TYPE=release" };
|
||||
if (runCommand(command, runtimePath, "antlr runtime cmake") == null)
|
||||
return false;
|
||||
}
|
||||
|
@ -688,11 +690,13 @@ public class BaseCppTest implements RuntimeTestSupport {
|
|||
return null;
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.err.println("can't exec module: " + fileName);
|
||||
System.err.println("can't create link to " + runtimePath + "/dist/libantlr4-runtime." + libExtension);
|
||||
e.printStackTrace(System.err);
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
List<String> command2 = new ArrayList<String>(Arrays.asList("clang++", "-std=c++11", "-I", includePath, "-L.", "-lantlr4-runtime"));
|
||||
List<String> command2 = new ArrayList<String>(Arrays.asList("clang++", "-std=c++11", "-I", includePath, "-L.", "-lantlr4-runtime", "-o", "a.out"));
|
||||
command2.addAll(allCppFiles(tmpdir));
|
||||
if (runCommand(command2.toArray(new String[0]), tmpdir, "building test binary") == null) {
|
||||
return null;
|
||||
|
@ -700,6 +704,7 @@ public class BaseCppTest implements RuntimeTestSupport {
|
|||
}
|
||||
catch (Exception e) {
|
||||
System.err.println("can't compile test module: " + e.getMessage());
|
||||
e.printStackTrace(System.err);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -709,7 +714,7 @@ public class BaseCppTest implements RuntimeTestSupport {
|
|||
ProcessBuilder builder = new ProcessBuilder(binPath, inputPath);
|
||||
builder.directory(new File(tmpdir));
|
||||
Map<String, String> env = builder.environment();
|
||||
env.put("LD_PRELOAD", runtimePath + "/dist/libantlr4-runtime.so"); // For linux.
|
||||
env.put("LD_PRELOAD", runtimePath + "/dist/libantlr4-runtime." + libExtension);
|
||||
String output = runProcess(builder, "running test binary");
|
||||
if ( output.length()==0 ) {
|
||||
output = null;
|
||||
|
@ -723,7 +728,8 @@ public class BaseCppTest implements RuntimeTestSupport {
|
|||
return output;
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.err.println("can't exec module: " + fileName + "\nerror is: "+ e.getMessage());
|
||||
System.err.println("can't exec module: " + fileName);
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.antlr.v4.test.runtime.java.BaseJavaTest.antlrLock;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class BaseSwiftTest implements RuntimeTestSupport {
|
||||
|
@ -77,10 +78,9 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
//compile Antlr4 module
|
||||
buildAntlr4Framework();
|
||||
String argsString;
|
||||
} catch (IOException e) {
|
||||
System.out.println(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
public void run() {
|
||||
|
@ -138,8 +138,10 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
buf.append('\n');
|
||||
line = in.readLine();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
System.err.println("can't read output from process");
|
||||
ioe.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,9 +232,6 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
|
||||
compile();
|
||||
String output = execTest();
|
||||
if (stderrDuringParse != null && stderrDuringParse.length() > 0) {
|
||||
System.err.println(stderrDuringParse);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
@ -257,10 +256,10 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
}
|
||||
if (stderrVacuum.toString().length() > 0) {
|
||||
this.stderrDuringParse = stderrVacuum.toString();
|
||||
System.err.println("execTest stderrVacuum: " + stderrVacuum);
|
||||
}
|
||||
return output;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.err.println("can't exec recognizer");
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
|
@ -293,7 +292,7 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
|
||||
private static boolean runProcess(String argsString, String execPath) throws IOException, InterruptedException {
|
||||
String[] args = argsString.split(" ");
|
||||
System.err.println("Starting build " + argsString);//Utils.join(args, " "))
|
||||
// System.err.println("Starting build " + argsString);//Utils.join(args, " "))
|
||||
Process process = Runtime.getRuntime().exec(args, null, new File(execPath));
|
||||
StreamVacuum stdoutVacuum = new StreamVacuum(process.getInputStream());
|
||||
StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream());
|
||||
|
@ -519,18 +518,18 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
}
|
||||
|
||||
protected ErrorQueue antlr(String grammarFileName, boolean defaultListener, String... extraOptions) {
|
||||
final List<String> options = new ArrayList<>();
|
||||
final List<String> options = new ArrayList<String>();
|
||||
Collections.addAll(options, extraOptions);
|
||||
options.add("-Dlanguage=Swift");
|
||||
if (!options.contains("-o")) {
|
||||
if ( !options.contains("-o") ) {
|
||||
options.add("-o");
|
||||
options.add(tmpdir);
|
||||
}
|
||||
if (!options.contains("-lib")) {
|
||||
if ( !options.contains("-lib") ) {
|
||||
options.add("-lib");
|
||||
options.add(tmpdir);
|
||||
}
|
||||
if (!options.contains("-encoding")) {
|
||||
if ( !options.contains("-encoding") ) {
|
||||
options.add("-encoding");
|
||||
options.add("UTF-8");
|
||||
}
|
||||
|
@ -541,26 +540,28 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
Tool antlr = newTool(optionsA);
|
||||
ErrorQueue equeue = new ErrorQueue(antlr);
|
||||
antlr.addListener(equeue);
|
||||
if (defaultListener) {
|
||||
if ( defaultListener ) {
|
||||
antlr.addListener(new DefaultToolListener(antlr));
|
||||
}
|
||||
antlr.processGrammarsOnCommandLine();
|
||||
synchronized (antlrLock) {
|
||||
antlr.processGrammarsOnCommandLine();
|
||||
}
|
||||
|
||||
if (!defaultListener && !equeue.errors.isEmpty()) {
|
||||
for (int i = 0; i < equeue.errors.size(); i++) {
|
||||
if ( !defaultListener && !equeue.errors.isEmpty() ) {
|
||||
for (int i = 0; i<equeue.errors.size(); i++) {
|
||||
ANTLRMessage msg = equeue.errors.get(i);
|
||||
System.err.println(msg);
|
||||
antlrToolErrors.append(msg.toString());
|
||||
}
|
||||
try {
|
||||
System.out.println(new String(Utils.readFile(tmpdir + "/" + grammarFileName)));
|
||||
antlrToolErrors.append(new String(Utils.readFile(tmpdir+"/"+grammarFileName)));
|
||||
} catch (IOException ioe) {
|
||||
System.err.println(ioe.toString());
|
||||
antlrToolErrors.append(ioe.toString());
|
||||
}
|
||||
}
|
||||
if (!defaultListener && !equeue.warnings.isEmpty()) {
|
||||
for (int i = 0; i < equeue.warnings.size(); i++) {
|
||||
if ( !defaultListener && !equeue.warnings.isEmpty() ) {
|
||||
for (int i = 0; i<equeue.warnings.size(); i++) {
|
||||
ANTLRMessage msg = equeue.warnings.get(i);
|
||||
System.err.println(msg);
|
||||
// antlrToolErrors.append(msg); warnings are hushed
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -568,7 +569,6 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
}
|
||||
|
||||
protected ErrorQueue antlr(String grammarFileName, String grammarStr, boolean defaultListener, String... extraOptions) {
|
||||
System.out.println("dir " + tmpdir);
|
||||
mkdir(tmpdir);
|
||||
writeFile(tmpdir, grammarFileName, grammarStr);
|
||||
return antlr(grammarFileName, defaultListener, extraOptions);
|
||||
|
|
16
tool/pom.xml
16
tool/pom.xml
|
@ -51,20 +51,10 @@
|
|||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.json</groupId>
|
||||
<artifactId>javax.json-api</artifactId>
|
||||
<version>1.0</version>
|
||||
<groupId>javax.json</groupId>
|
||||
<artifactId>javax.json-api</artifactId>
|
||||
<version>RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>javax.json</artifactId>
|
||||
<version>1.0.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.json</groupId>
|
||||
<artifactId>javax.json-api</artifactId>
|
||||
<version>RELEASE</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
( go version ; go env ) || true
|
||||
python --version
|
||||
python3 --version
|
Loading…
Reference in New Issue