Skip to content

Commit 200b544

Browse files
committed
[GR-51162] Update TCK.md to use maven to run the TCK test.
1 parent 4d1211a commit 200b544

File tree

2 files changed

+74
-49
lines changed

2 files changed

+74
-49
lines changed

truffle/docs/TCK.md

+74-28
Original file line numberDiff line numberDiff line change
@@ -61,32 +61,78 @@ You can also disable output and error output for all tests but one:
6161

6262
`mx tck -Dtck.verbose=false -Dtck.ErrorTypeTest.verbose=true`
6363

64-
## Running TCK Tests without `mx`
65-
66-
The Python [TCK runner](https://github.com/oracle/graal/blob/master/truffle/mx.truffle/tck.py) can be used to execute the Truffle TCK on top of GraalVM. The script requires Maven for downloading the TCK artifacts.
67-
68-
To execute TCK tests on GraalVM use:
69-
70-
`python tck.py -g <path_to_graalvm>`
71-
72-
To include your own language and TCK provider use:
73-
74-
`python tck.py -g <path_to_graalvm> -cp <path_to_tck_provider_jars> -lp <path_to_language_jars>`
75-
76-
To restrict tests to a certain language, use the language ID as a first unnamed option.
77-
The following example executes tests only for the JavaScript language:
78-
79-
`python tck.py -g <path_to_graalvm> js`
80-
81-
To execute the tests under debugger use the `-d` or `--dbg <port>` option:
82-
83-
`python tck.py -d -g <path_to_graalvm>`
84-
85-
The TCK tests can be filtered by test names. To execute just the `ScriptTest` for the JavaScript TCK provider use:
86-
87-
`python tck.py -g <path_to_graalvm> js default ScriptTest`
88-
89-
The TCK tests can be executed in `compile` mode in which all calltargets are compiled before they are executed.
90-
To execute JavaScript tests in `compile` mode use:
64+
## Running TCK Tests with Apache Maven
65+
The Apache Maven can be used to execute Truffle TCK tests. First, create a Maven module (project) containing the language
66+
TCK provider. Ensure that this module has a test dependency on the language being tested and TCK tests `org.graalvm.truffle:truffle-tck-tests`.
67+
Configure the `maven-surefire-plugin` to identify tests in the `org.graalvm.truffle:truffle-tck-tests` artifact.
68+
This can be achieved using the following snippet within the <build> section of your project's pom.xml:
69+
```
70+
<build>
71+
<plugins>
72+
[...]
73+
<plugin>
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-surefire-plugin</artifactId>
76+
<version>3.1.2</version>
77+
<configuration>
78+
<dependenciesToScan>
79+
<dependency>org.graalvm.truffle:truffle-tck-tests</dependency>
80+
</dependenciesToScan>
81+
</configuration>
82+
</plugin>
83+
[...]
84+
</plugins>
85+
</build>
86+
```
87+
To include additional languages in the TCK execution add their TCK providers as test dependencies. For example, adding `org.graalvm.js:js-truffle-tck` will include JavaScript in the testing process.
88+
You can utilize the SimpleLanguage TCK provider [pom.xml](https://github.com/oracle/graal/blob/master/truffle/external_repos/simplelanguage/tck/pom.xml) as a template to get started.
89+
To test the runtime optimizations set the `JAVA_HOME` environment variable to the GraalVM location before running `mvn package`.
90+
91+
### Customize TCK Tests
92+
To restrict the TCK tests to test a certain language, use the `tck.language` property.
93+
The following example tests JavaScript with data types from all available languages.
94+
```
95+
<build>
96+
<plugins>
97+
[...]
98+
<plugin>
99+
<groupId>org.apache.maven.plugins</groupId>
100+
<artifactId>maven-surefire-plugin</artifactId>
101+
<version>3.1.2</version>
102+
<configuration>
103+
<argLine>
104+
-Dtck.language=js
105+
</argLine>
106+
[...]
107+
</configuration>
108+
</plugin>
109+
[...]
110+
</plugins>
111+
</build>
112+
```
91113

92-
`python tck.py -g <path_to_graalvm> js compile`
114+
To restrict the data types to a certain language, use the `tck.values` property.
115+
The following example tests JavaScript with Java types.
116+
```
117+
<build>
118+
<plugins>
119+
[...]
120+
<plugin>
121+
<groupId>org.apache.maven.plugins</groupId>
122+
<artifactId>maven-surefire-plugin</artifactId>
123+
<version>3.1.2</version>
124+
<configuration>
125+
<argLine>
126+
-Dtck.values=java-host
127+
-Dtck.language=js
128+
</argLine>
129+
[...]
130+
</configuration>
131+
</plugin>
132+
[...]
133+
</plugins>
134+
</build>
135+
```
136+
137+
To execute a specific TCK test you can use the test parameter along with the `-Dtest` option.
138+
For example: `mvn test -Dtest=ScriptTest`

truffle/external_repos/simplelanguage/tck/pom.xml

-21
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,9 @@
6565
<artifactId>maven-surefire-plugin</artifactId>
6666
<version>3.1.2</version>
6767
<configuration>
68-
<argLine>
69-
-Dtck.values=java-host,sl
70-
-Dtck.language=sl
71-
</argLine>
7268
<dependenciesToScan>
7369
<dependency>org.graalvm.truffle:truffle-tck-tests</dependency>
7470
</dependenciesToScan>
75-
<includes>
76-
<include>**/*TestSuite.java</include>
77-
<include>**/*Test.java</include>
78-
</includes>
7971
</configuration>
8072
</plugin>
8173
</plugins>
@@ -91,7 +83,6 @@
9183
</plugin>
9284
</plugins>
9385
</pluginManagement>
94-
<finalName>simplelanguage</finalName>
9586
</build>
9687
<dependencies>
9788
<dependency>
@@ -111,23 +102,11 @@
111102
<version>${graalvm.version}</version>
112103
<scope>test</scope>
113104
</dependency>
114-
<dependency>
115-
<groupId>org.graalvm.truffle</groupId>
116-
<artifactId>truffle-tck-common</artifactId>
117-
<version>${graalvm.version}</version>
118-
<scope>test</scope>
119-
</dependency>
120105
<dependency>
121106
<groupId>junit</groupId>
122107
<artifactId>junit</artifactId>
123108
<version>4.13.2</version>
124109
<scope>test</scope>
125110
</dependency>
126-
<dependency>
127-
<groupId>org.graalvm.truffle</groupId>
128-
<artifactId>truffle-tck-instrumentation</artifactId>
129-
<version>${graalvm.version}</version>
130-
<scope>test</scope>
131-
</dependency>
132111
</dependencies>
133112
</project>

0 commit comments

Comments
 (0)