Integrating tests for all supported targets

- A profile "rts" has been created which runs the integration tests. By default the the project containing the runtimes tests will not run so that users casually checking out and building the project do not have to install the tools required to test all the supported Antlr targets.

- The base test classes that are required for running the integration tests are downloaded from the other Antlr repos, dynamically added to the compile classpath and used by the currently checked in integration tests

To run the the full build with all the integration tests use the following:

mvn clean install -Prts
This commit is contained in:
Jason van Zyl 2015-06-23 14:01:28 -04:00
parent 6439b40d09
commit 46202d98a2
74 changed files with 148 additions and 2 deletions

13
pom.xml
View File

@ -64,7 +64,6 @@
<module>tool</module>
<module>antlr4-maven-plugin</module>
<module>antlr4-testgen-maven-plugin</module>
<module>runtime-testsuite</module>
</modules>
<properties>
@ -117,5 +116,15 @@
</plugin>
</plugins>
</pluginManagement>
</build>
</build>
<profiles>
<profile>
<id>rts</id>
<modules>
<module>runtime-testsuite</module>
</modules>
</profile>
</profiles>
</project>

22
runtime-testsuite/get.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
# Script we're using to get some of the test classes required for the other targets
pwd=`pwd`
dir="$pwd/test/org/antlr/v4/test/runtime"
# python2
wget https://raw.githubusercontent.com/antlr/antlr4-python2/master/tool/test/org/antlr/v4/test/runtime/python2/BasePython2Test.java -O $dir/python2/BasePython2Test.java
# python3
wget https://raw.githubusercontent.com/antlr/antlr4-python3/master/tool/test/org/antlr/v4/test/runtime/python3/BasePython3Test.java -O $dir/python3/BasePython3Test.java
mkdir -p $dir/python
wget https://raw.githubusercontent.com/antlr/antlr4-python3/master/tool/test/org/antlr/v4/test/runtime/python/BasePythonTest.java -O $dir/python/BasePythonTest.java
# javascript
wget https://raw.githubusercontent.com/antlr/antlr4-javascript/master/tool/test/org/antlr/v4/test/runtime/javascript/node/BaseTest.java -O $dir/javascript/node/BaseTest.java
# csharp
wget https://raw.githubusercontent.com/antlr/antlr4-csharp/master/tool/test/org/antlr/v4/test/runtime/csharp/BaseTest.java -O $dir/csharp/BaseTest.java

View File

@ -28,6 +28,12 @@
<artifactId>antlr4</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@ -38,5 +44,103 @@
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<skipCache>true</skipCache>
</configuration>
<executions>
<execution>
<id>python2</id>
<phase>generate-test-resources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://raw.githubusercontent.com/antlr/antlr4-python2/master/tool/test/org/antlr/v4/test/runtime/python2/BasePython2Test.java</url>
<outputFileName>generated-sources/org/antlr/v4/test/runtime/python2/BasePython2Test.java</outputFileName>
</configuration>
</execution>
<execution>
<id>python3</id>
<phase>generate-test-resources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://raw.githubusercontent.com/antlr/antlr4-python3/master/tool/test/org/antlr/v4/test/runtime/python3/BasePython3Test.java</url>
<outputFileName>generated-sources/org/antlr/v4/test/runtime/python3/BasePython3Test.java</outputFileName>
</configuration>
</execution>
<execution>
<id>python</id>
<phase>generate-test-resources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://raw.githubusercontent.com/antlr/antlr4-python3/master/tool/test/org/antlr/v4/test/runtime/python/BasePythonTest.java</url>
<outputFileName>generated-sources/org/antlr/v4/test/runtime/python/BasePythonTest.java</outputFileName>
</configuration>
</execution>
<execution>
<id>javascript</id>
<phase>generate-test-resources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://raw.githubusercontent.com/antlr/antlr4-javascript/master/tool/test/org/antlr/v4/test/runtime/javascript/node/BaseTest.java</url>
<outputFileName>generated-sources/org/antlr/v4/test/runtime/javascript/node/BaseTest.java</outputFileName>
</configuration>
</execution>
<execution>
<id>csharp</id>
<phase>generate-test-resources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://raw.githubusercontent.com/antlr/antlr4-csharp/master/tool/test/org/antlr/v4/test/runtime/csharp/BaseTest.java</url>
<outputFileName>generated-sources/org/antlr/v4/test/runtime/csharp/BaseTest.java</outputFileName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<antlr-python2-runtime>../../antlr4-python2/src</antlr-python2-runtime>
<antlr-python3-runtime>../../antlr4-python3/src</antlr-python3-runtime>
<antlr-csharp-runtime-project>../../antlr4-csharp/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.mono.csproj</antlr-csharp-runtime-project>
<antlr-javascript-runtime>../../antlr4-javascript/src</antlr-javascript-runtime>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -57,6 +57,17 @@
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr3-maven-plugin</artifactId>