Skip to content
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

Migrate from JUnit 4 to JUnit 5 #353

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

mikepapadim
Copy link
Member

Description

Describe the patch. What does it enhance? What does it fix?

This PR implements the migration unit testing framework from JUnit 4 (JUnit 4.13.2 last updated Feb 13, 2021) to JUnit 5. This migration includes updating dependencies, annotations, assertions, and test instance lifecycle management.

Key changes:

  • Updated Dependencies: Updated the Maven dependencies to include JUnit 5 libraries (junit-jupiter-api, junit-jupiter-engine).
  • Annotations Updates: Migrated JUnit 4 annotations to their JUnit 5 counterparts (e.g., @before to @beforeeach, @after to @AfterEach, @BeforeClass to @BeforeAll, @afterclass to @afterall).
  • Assertions Updates: Transitioned to JUnit 5's assertion API which offers better assertion capabilities and error messages (org.junit.jupiter.api.Assertions).

Backend/s tested

Mark the backends affected by this PR.

  • OpenCL
  • PTX
  • SPIRV

OS tested

Mark the OS where this PR is tested.

  • Linux
  • OSx
  • Windows

How to test the new patch?

make 
make tests

@jjfumero
Copy link
Member

jjfumero commented Mar 21, 2024

@mikepapadim , if you solve the conflicts, we can merge this PR

@mikepapadim
Copy link
Member Author

mikepapadim commented Mar 21, 2024

@mikepapadim , if you solve the conflicts, we can merge this PR

Lets hold this one.

I solved the conflicts with the latest develop, but now it seems that TestBatches cause a segfault

tornado -ea  --jvm "-Xmx6g -Dtornado.recover.bailout=False -Dtornado.unittests.verbose=True "  -m  tornado.unittests/uk.ac.manchester.tornado.unittests.tools.TornadoTestRunner  --params "uk.ac.manchester.tornado.unittests.batches.TestBatches"
WARNING: Using incubator modules: jdk.incubator.vector
Aborted (core dumped)

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007664629adb68, pid=79598, tid=79624
#
# JRE version: OpenJDK Runtime Environment (21.0+35) (build 21+35-2513)
# Java VM: OpenJDK 64-Bit Server VM (21+35-2513, mixed mode, tiered, jvmci, parallel gc, linux-amd64)
# Problematic frame:
# C  [libnvidia-opencl.so.1+0x1adb68]
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/mikepapadim/manchester/TornadoVM/core.79598)
#
# An error report file with more information is saved as:
# /home/mikepapadim/manchester/TornadoVM/hs_err_pid79598.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

The rest of the tests are in par with develop:

==================================================
              Unit tests report 
==================================================

{'[PASS]': 565, '[FAILED]': 7, '[UNSUPPORTED]': 30}
Coverage [PASS/(PASS+FAIL)]: 98.78%
Coverage [PASS/(PASS+FAIL+UNSUPPORTED)]: 93.85%

==================================================

@mikepapadim
Copy link
Member Author

mikepapadim commented Mar 25, 2024

[Update] SegFault also occurs with PTX for TestBatches

@mikepapadim
Copy link
Member Author

[Update] I merged it with the latest develop to check the event fix-up if it influences the batch processing failures.
Only, @gigiblender patch fixed the issue with batch processing, however, lazy copy-outs still fail.
Batch processing on PTX is still failing.

@mikepapadim
Copy link
Member Author

Thanks @gigiblender for the patch

@mikepapadim
Copy link
Member Author

@jjfumero @stratika @mairooni when you have time can we do another iteration on testing,.

Now, it it stable to merge after we test it.

@jjfumero
Copy link
Member

Let's check in OSx and Windows as well.

@jjfumero
Copy link
Member

The batch processing with PTX still failing:

tornado -ea  --jvm "-Xmx6g -Dtornado.recover.bailout=False -Dtornado.unittests.verbose=True "  -m  tornado.unittests/uk.ac.manchester.tornado.unittests.tools.TornadoTestRunner  --params "uk.ac.manchester.tornado.unittests.batches.TestBatches"
WARNING: Using incubator modules: jdk.incubator.vector
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007faeb1d79937, pid=53407, tid=53408
#
# JRE version: Java(TM) SE Runtime Environment (21.0.3+7) (build 21.0.3+7-LTS-152)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (21.0.3+7-LTS-152, mixed mode, tiered, jvmci, parallel gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x979937]  jni_GetArrayLength+0x87
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/juan/tornadovm/TornadoVM/core.53407)
#
# An error report file with more information is saved as:
# /home/juan/tornadovm/TornadoVM/hs_err_pid53407.log
[6.098s][warning][os] Loading hsdis library failed
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

@mikepapadim
Copy link
Member Author

The batch processing with PTX still failing:

tornado -ea  --jvm "-Xmx6g -Dtornado.recover.bailout=False -Dtornado.unittests.verbose=True "  -m  tornado.unittests/uk.ac.manchester.tornado.unittests.tools.TornadoTestRunner  --params "uk.ac.manchester.tornado.unittests.batches.TestBatches"
WARNING: Using incubator modules: jdk.incubator.vector
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007faeb1d79937, pid=53407, tid=53408
#
# JRE version: Java(TM) SE Runtime Environment (21.0.3+7) (build 21.0.3+7-LTS-152)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (21.0.3+7-LTS-152, mixed mode, tiered, jvmci, parallel gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x979937]  jni_GetArrayLength+0x87
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/juan/tornadovm/TornadoVM/core.53407)
#
# An error report file with more information is saved as:
# /home/juan/tornadovm/TornadoVM/hs_err_pid53407.log
[6.098s][warning][os] Loading hsdis library failed
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

thats weird cause in my configuration with Driver Version: 550.67 CUDA Version: 12.4 it works

@mikepapadim
Copy link
Member Author

@jjfumero @stratika @mairooni
I did another iteration on this one to sync it with the latest develop.
Batches now pass without causing a segfault.

However, now multithreaded.TestMultiThreadedExecutionPlans causes a segfault.

Also, I updated the version of JUNIT5 to the latest as per 5.11.0.

@jjfumero
Copy link
Member

jjfumero commented Sep 4, 2024

Thanks @mikepapadim . Let's sync next week to tackle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants