Closed wdanilo closed 9 months ago
Integrating Truffle TCK tests might help to prevent issues with interop, like the one mentioned in https://github.com/enso-org/enso/issues/7418
There has been some updates:
With Truffle Unchained, it took a bit longer than usual, but we finally updated simplelanguage to 23.1. I think the changes can be helpful to make this step for your own language implementation: https://github.com/graalvm/simplelanguage/commit/1b03a794efd52df067a6c95ea6cc150c11e04833Same for simpletool: https://github.com/graalvm/simpletool/commit/7c0e2a780d7f1e2a0b983fe1f7005e040ab394d0Interesting changes:
The Truffle TCK tests now run with Maven Surefire https://github.com/graalvm/simplelanguage/commit/1b03a794efd52df067a6c95ea6cc150c11e04833#diff-c7973ae892437cdc63d039[…]2f77d5cfaf8c326924b6ffa2dR72 The Native Image Integration, is now as simple as it gets: https://github.com/graalvm/simplelanguage/commit/1b03a794efd52df067a6c95ea6cc150c11e04833#diff-396c4e70a6bebf54d09f3f[…]2822fa4973571d7002da4e23R122 No more use of any of the shading plugins: https://github.com/graalvm/simplelanguage/commit/1b03a794efd52df067a6c95ea6cc150c11e04833#diff-3a0d467c7582e383ba6738[…]5ff63bfcc468d88ae1900270L105 JPMS Module descriptors for all the things: https://github.com/graalvm/simplelanguage/commit/1b03a794efd52df067a6c95ea6cc150c11e04833#diff-b899e2a79b87af31fd5031[…]8502f1e51693bc2be598cefb2R41
Time to take another look!
Tried to mimic SL pom.xml
configuration, but I don't fully understand our JMSUtils, so not all dependencies are satisfied. Anyway, this is what I have:
diff --git build.sbt build.sbt
index abf65aec3e..a0dd0a9b8f 100644
--- build.sbt
+++ build.sbt
@@ -1507,7 +1507,11 @@ lazy val `runtime-test-instruments` =
JPMSUtils.filterModulesFromUpdate(
update.value,
GraalVM.modules ++ Seq(
- "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion
+ "org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion,
+ "org.graalvm.truffle" % "truffle-tck" % graalMavenPackagesVersion,
+ "org.graalvm.truffle" % "truffle-tck-common" % graalMavenPackagesVersion,
+ "org.graalvm.truffle" % "truffle-tck-tests" % graalMavenPackagesVersion,
+ "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion
),
streams.value.log,
shouldContainAll = true
@@ -1515,6 +1519,7 @@ lazy val `runtime-test-instruments` =
},
libraryDependencies ++= GraalVM.modules,
libraryDependencies ++= Seq(
+ "org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion,
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided"
)
)
@@ -1557,6 +1562,12 @@ lazy val runtime = (project in file("engine/runtime"))
},
Test / parallelExecution := false,
Test / logBuffered := false,
+ Test / javaOptions ++= Seq(
+ "-Dtck.values=java-host,enso",
+ "-Dtck.language=enso",
+ "-Dtck.inlineVerifierInstrument=false",
+ "-Dpolyglot.engine.AllowExperimentalOptions=true"
+ ),
Test / testOptions += Tests.Argument(
"-oD"
), // show timings for individual tests
@@ -1569,8 +1580,9 @@ lazy val runtime = (project in file("engine/runtime"))
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided",
- "org.graalvm.truffle" % "truffle-tck" % graalMavenPackagesVersion % "provided",
- "org.graalvm.truffle" % "truffle-tck-common" % graalMavenPackagesVersion % "provided",
+ "org.graalvm.truffle" % "truffle-tck" % graalMavenPackagesVersion % Test,
+ "org.graalvm.truffle" % "truffle-tck-common" % graalMavenPackagesVersion % Test,
+ "org.graalvm.truffle" % "truffle-tck-tests" % graalMavenPackagesVersion % Test,
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"org.scalactic" %% "scalactic" % scalacticVersion % Test,
diff --git engine/runtime-test-instruments/src/main/java/module-info.java engine/runtime-test-instruments/src/main/java/module-info.java
index 7d3cfa8e86..6e816f6ba8 100644
--- engine/runtime-test-instruments/src/main/java/module-info.java
+++ engine/runtime-test-instruments/src/main/java/module-info.java
@@ -1,10 +1,15 @@
module org.enso.runtime.test {
requires org.graalvm.truffle;
requires org.openide.util.lookup.RELEASE180;
+ requires org.graalvm.polyglot;
+ requires org.graalvm.polyglot_tck;
exports org.enso.interpreter.test.instruments;
exports org.enso.interpreter.test.instruments.service;
+ provides org.graalvm.polyglot.tck.LanguageProvider with
+ org.enso.interpreter.test.instruments.tck.EnsoTckLanguageProvider;
+
provides com.oracle.truffle.api.instrumentation.provider.TruffleInstrumentProvider with
org.enso.interpreter.test.instruments.CodeIdsTestInstrumentProvider,
org.enso.interpreter.test.instruments.CodeLocationsTestInstrumentProvider,
diff --git engine/runtime-test-instruments/src/main/java/org/enso/interpreter/test/instruments/tck/EnsoTckLanguageProvider.java engine/runtime-test-instruments/src/main/java/org/enso/interpreter/test/instruments/tck/EnsoTckLanguageProvider.java
new file mode 100644
index 0000000000..b5dffeb78d
--- /dev/null
+++ engine/runtime-test-instruments/src/main/java/org/enso/interpreter/test/instruments/tck/EnsoTckLanguageProvider.java
@@ -0,0 +1,49 @@
+package org.enso.interpreter.test.instruments.tck;
+
+import java.util.Collection;
+
+import org.graalvm.polyglot.Context;
+import org.graalvm.polyglot.Source;
+import org.graalvm.polyglot.Value;
+import org.graalvm.polyglot.tck.LanguageProvider;
+import org.graalvm.polyglot.tck.Snippet;
+
+public class EnsoTckLanguageProvider implements LanguageProvider {
+ public EnsoTckLanguageProvider() {
+ }
+
+ @Override
+ public String getId() {
+ return "enso";
+ }
+
+ @Override
+ public Value createIdentityFunction(Context context) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Collection<? extends Snippet> createValueConstructors(Context context) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Collection<? extends Snippet> createExpressions(Context context) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Collection<? extends Snippet> createStatements(Context context) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Collection<? extends Snippet> createScripts(Context context) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Collection<? extends Source> createInvalidSyntaxScripts(Context context) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+}
\ No newline at end of file
diff --git engine/runtime/src/test/java/org/enso/interpreter/test/tck/EnsoTckErrorTypeTest.java engine/runtime/src/test/java/org/enso/interpreter/test/tck/EnsoTckErrorTypeTest.java
new file mode 100644
index 0000000000..9879dbbecc
--- /dev/null
+++ engine/runtime/src/test/java/org/enso/interpreter/test/tck/EnsoTckErrorTypeTest.java
@@ -0,0 +1,7 @@
+package org.enso.interpreter.test.tck;
+
+public class EnsoTckErrorTypeTest extends com.oracle.truffle.tck.tests.ErrorTypeTest {
+ public EnsoTckErrorTypeTest(com.oracle.truffle.tck.tests.TestRun r) {
+ super(r);
+ }
+}
however trying:
sbt:enso> runtime/testOnly *EnsoTckErrorTypeTest
Error occurred during initialization of boot layer
java.lang.module.FindException: Module org.graalvm.polyglot_tck not found, required by org.enso.runtime.test
@Akirathan, can you please take a look fix my --module-path
configuration mistakes? Thank you Pavel, for your changes: https://github.com/enso-org/enso/commit/ad4d991bc406e5b26de350b82c13b9257554e1f9 - branch wip/jtulach/Tck_5238 is now ready for further development.
Jaroslav Tulach reports a new STANDUP for yesterday (2024-01-07):
Progress: - ImportExportCache
: https://github.com/enso-org/enso/pull/8693/commits/9109ca03a9eef0f6317a226b61d311d6068a043e
sleep(100)
problem: https://github.com/enso-org/enso/issues/8698Next Day: TCK, interop & co.
Jaroslav Tulach reports a new STANDUP for yesterday (2024-01-08):
Progress: - Character
to Text
: https://github.com/enso-org/enso/pull/8685#issuecomment-1881310495
File_By_Line
: https://discord.com/channels/@me/960509000154247198/1193978784794300537 It should be finished by 2024-01-11.Next Day: TCK, interop, big decimal & bugfixes
DiscordDiscord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
DiscordDiscord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Jaroslav Tulach reports a new STANDUP for yesterday (2024-01-09):
Progress: - Fix CI & editions: https://github.com/enso-org/enso/pull/8685/commits/77deb711b77f8849cf09ea8a39061762535db313
File_By_Line
: https://github.com/enso-org/enso/issues/8710Next Day: TCK, interop, big decimal & bugfixes
DiscordDiscord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Jaroslav Tulach reports a new STANDUP for yesterday (2024-01-10):
Progress: - investigating TCK failures: https://github.com/enso-org/enso/pull/8685#issuecomment-1884177888
Text.codepoints
: https://github.com/enso-org/enso/pull/8685/commits/d41a9df84134966521c51d70061e7f4a1e46507dcompiler
benchmarks: https://github.com/enso-org/enso/issues/8419#issuecomment-1884680830FunctionPointer
problem: https://github.com/enso-org/enso/issues/8663#issuecomment-1885125148BigInteger
values: https://github.com/enso-org/enso/pull/8685/commits/7925be65a55b5da6f5430f795b5e47312630751cNext Day: Finish TCK integration
DiscordDiscord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
DiscordDiscord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Jaroslav Tulach reports a new STANDUP for yesterday (2024-01-11):
Progress: - PR is finally green: https://github.com/enso-org/enso/pull/8685
randomUUID
"removal": https://github.com/enso-org/enso/pull/8728#pullrequestreview-1814644219runner
sanity check: https://github.com/enso-org/enso/pull/8724#issuecomment-1886263147text_left
: https://github.com/enso-org/enso/pull/8691#discussion_r1448314929ArrowLanguage
: https://github.com/enso-org/enso/pull/8512#pullrequestreview-1813163173Next Day: Integrate TCK, look towards BigDecimal support
This task is automatically imported from the old Task Issue Board and it was originally created by Pavel Marek. Original issue is here.
Truffle provides a TCK for truffle languages, which tests interoperability. We should integrate these tests in Enso.
References: