Skip to content

adding a Wasm test environment #4386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: series/3.x
Choose a base branch
from
Draft

Conversation

qxrein
Copy link
Contributor

@qxrein qxrein commented Apr 17, 2025

sorry, for closing #4308 due to wrong rebase so making a new PR for that

Cats over Wasm Implementation
Current Status:

Added a Wasm test environment:
❌ (passes All JS only tests)

@qxrein qxrein marked this pull request as draft April 17, 2025 21:07
@qxrein qxrein changed the title Rewrite tracing implementation for WASM compatibility adding a Wasm test environment Apr 17, 2025
@qxrein
Copy link
Contributor Author

qxrein commented Apr 23, 2025

this port passes >50% tests over WASM. Main issue: recurring java.lang.NullPointerException in IOFiber.runLoop during async execution in tests/js/target/scala-2.13/cats-effect-tests-test-fastopt/main.mjs. Errors show a consistent call stack: IOFiber.runLoopIOFiber.execRIOFiber.runBatchingMacrotaskExecutor$$anon$1.runMacrotaskExecutor$.executemain.mjs:3747:29.

Status : I’ve been debugging the failing suites but haven’t resolved the issues yet. I’m optimistic about fixing them, but my availability will be limited for the next 1-2 weeks due to semester exams. Practical exams this week slowed progress, and end-semester exams are upcoming. I’d appreciate it if someone could pick this up in the meantime. I’ll dive back in post-exams with renewed focus.

@djspiewak
Copy link
Member

NPEs of this type usually mean you've misaligned the continuation stack with the object stack (e.g. FlatMapK needs to pop a function when it "returns", and if that function isn't available you can get a NPE). It depends on the exact stack trace though. If you look at the line indicated in runLoop you should be able to pretty immediately narrow down exactly what is null and where it's supposed to be coming from.

@qxrein
Copy link
Contributor Author

qxrein commented May 1, 2025

[error] Failed: Total 2861, Failed 6, Errors 0, Passed 2855, Ignored 3
[error] Failed tests:
[error] 	cats.effect.tracing.TracingSuite
[error] 	cats.effect.std.DispatcherSuite
[error] 	tracing.TraceSuite
[error] 	cats.effect.std.MutexSuite
[error] (testsJS / Test / testOnly) sbt.TestsFailedException: Tests unsuccessful

I guess we're almost done with JSOnly suite port to WASM the failing tests includes three java.util.concurrent.TimeoutException inconsistent one 30s timeout and two 120s timeouts.
which can be easily resolved. I am more concerned about other 3 failing munit tests (munit.ComparisonFailException and munit.FailException) which in my attempt, I tried to fix and couldn't get the reason why they are failing, a small help that explains why these errors could be happening would mean a lot.

@qxrein
Copy link
Contributor Author

qxrein commented May 1, 2025

If i'd have to be specific failing tests are

[info] ==> X cats.effect.tracing.TracingSuite.IO.delay should generate identical traces 0.099s munit.FailException: tests/shared/src/test/scala/cats/effect/tracing/TracingSuite.scala:29 assertion failed
[info] 28:    (a, b) match {
[info] 29:      case (IO.Delay(_, eventA), IO.Delay(_, eventB)) => assert(eventA eq eventB)
[info] 30:      case _ => fail("expected IO.Delay")
[info] ==> X cats.effect.tracing.TracingSuite.Async.delay should generate identical traces 0.004s munit.FailException: tests/shared/src/test/scala/cats/effect/tracing/TracingSuite.scala:48 assertion failed
[info] 47:    (a, b) match {
[info] 48:      case (IO.Delay(_, eventA), IO.Delay(_, eventB)) => assert(eventA eq eventB)
[info] 49:      case _ => fail("expected IO.Delay")
[info] ==> X tracing.TraceSuite.have nice traces 0.121s munit.ComparisonFailException: tests/shared/src/test/scala/cats/effect/tracing/TraceSuite.scala:36
[info] 35:        case Left(ex) =>
[info] 36:          assertEquals(
[info] 37:            ex.getStackTrace.count { e =>
[info] values are not the same
[info] => Obtained
[info] 0
[info] => Diff (- expected, + obtained)
[info] -16
[info] +0
[info] ==> X cats.effect.std.DispatcherSuite.sequential dispatcher (cancelable = true) - await = false - invalidate cancelation action of task when complete 30.124s java.util.concurrent.TimeoutException: test timed out after 30 seconds
[info] ==> X cats.effect.std.MutexSuite.Mutex with dual constructors not deadlock when highly contended 133.880s java.util.concurrent.TimeoutException: test timed out after 120 seconds
[info] ==> X cats.effect.std.MutexSuite.MapK'd Mutex not deadlock when highly contended 120.020s java.util.concurrent.TimeoutException: test timed out after 120 seconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants