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
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4845f0c
Merge pull request #347 from jjfumero/fix/examples
jjfumero Mar 7, 2024
c27eea8
Refactor TornadoHelper in unit tests for optimization.
mikepapadim Mar 17, 2024
18b4468
Remove junit-vintage-engine dependency from pom.xml
mikepapadim Mar 17, 2024
343e8d9
Refactor TestBatches for Junit5
mikepapadim Mar 18, 2024
f601427
fix merge
mikepapadim Mar 19, 2024
5da10da
Fix merge conflicts
mikepapadim Mar 21, 2024
a674053
Fix merge conflicts
mikepapadim Mar 21, 2024
84e6826
Merge remote-tracking branch 'oss/develop' into mikepapadim/junit5
mikepapadim Apr 16, 2024
2aadad4
Update unit tests to use JUnit 5
mikepapadim Apr 16, 2024
80e9825
Merge branch 'develop' of github.com:beehive-lab/TornadoVM into mikep…
mikepapadim Apr 16, 2024
a176e55
Merge branch 'develop' into mikepapadim/junit5
mikepapadim Apr 23, 2024
c0d9a2c
Partial fix for segfaults in OpenCL
mikepapadim Apr 23, 2024
8520559
Refactor memory allocation and test methods
mikepapadim Apr 23, 2024
1b50d07
Merge branch 'develop' into mikepapadim/junit5
mikepapadim Apr 29, 2024
3d25f40
Migrate unit tests to JUnit5
mikepapadim Apr 29, 2024
582228e
Fix PTX code cache using an invalid module
gigiblender May 20, 2024
1533ff4
Merge branch 'develop' of github.com:beehive-lab/TornadoVM into mikep…
mikepapadim May 21, 2024
d4ee6c3
Merge branch 'develop' of github.com:beehive-lab/TornadoVM into mikep…
mikepapadim Sep 3, 2024
c7960a1
Update JUnit versions in POM files
mikepapadim Sep 3, 2024
0214abc
Switch from JUnit 4 to JUnit 5 and refactor asserts
mikepapadim Sep 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<jmh.version>1.29</jmh.version>
<tornadojmhjar.name>jmhbenchmarks</tornadojmhjar.name>
<checkstyle.config.location>tornado-assembly/src/etc/checkstyle.xml</checkstyle.config.location>
<junit.jupiter.version>5.10.2</junit.jupiter.version>
<junit.platform.version>1.9.0</junit.platform.version>
</properties>

<profiles>
Expand Down Expand Up @@ -2007,9 +2009,19 @@
<version>10.12.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
Expand Down
38 changes: 32 additions & 6 deletions tornado-unittests/pom.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<properties>
<junit.jupiter.version>5.9.0</junit.jupiter.version>
<junit.platform.version>1.9.0</junit.platform.version>
</properties>
<parent>
<groupId>tornado</groupId>
<artifactId>tornado</artifactId>
Expand All @@ -18,13 +22,35 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
5 changes: 4 additions & 1 deletion tornado-unittests/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
open module tornado.unittests {
requires transitive junit;
requires transitive tornado.api;
requires lucene.core;
requires java.desktop;
requires transitive org.junit.jupiter.api;
requires org.junit.platform.commons;
requires org.junit.jupiter.engine;
requires org.junit.platform.launcher;

exports uk.ac.manchester.tornado.unittests;
exports uk.ac.manchester.tornado.unittests.api;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@

package uk.ac.manchester.tornado.unittests;

import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;

import uk.ac.manchester.tornado.api.ImmutableTaskGraph;
import uk.ac.manchester.tornado.api.TaskGraph;
import uk.ac.manchester.tornado.api.TornadoExecutionPlan;
import uk.ac.manchester.tornado.api.annotations.Parallel;
import uk.ac.manchester.tornado.api.types.arrays.IntArray;
import uk.ac.manchester.tornado.api.enums.DataTransferMode;
import uk.ac.manchester.tornado.api.enums.TornadoVMBackendType;
import uk.ac.manchester.tornado.api.exceptions.Debug;
import uk.ac.manchester.tornado.api.types.arrays.IntArray;
import uk.ac.manchester.tornado.unittests.common.TornadoTestBase;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

/**
* <p>
* How to run.
Expand Down Expand Up @@ -93,9 +94,9 @@ public void testHello() {

try {
executionPlan.execute();
assertTrue("Task was executed.", true);
assertTrue(true, "Task was executed.");
} catch (Exception e) {
assertTrue("Task was not executed.", false);
assertTrue(false, "Task was not executed.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

package uk.ac.manchester.tornado.unittests.api;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.ValueLayout;
import java.util.stream.IntStream;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import uk.ac.manchester.tornado.api.DataRange;
import uk.ac.manchester.tornado.api.ImmutableTaskGraph;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
*/
package uk.ac.manchester.tornado.unittests.api;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.stream.IntStream;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import uk.ac.manchester.tornado.api.ImmutableTaskGraph;
import uk.ac.manchester.tornado.api.TaskGraph;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

package uk.ac.manchester.tornado.unittests.arrays;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.util.Random;
import java.util.stream.IntStream;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import uk.ac.manchester.tornado.api.GridScheduler;
import uk.ac.manchester.tornado.api.ImmutableTaskGraph;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
package uk.ac.manchester.tornado.unittests.arrays;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import uk.ac.manchester.tornado.api.ImmutableTaskGraph;
import uk.ac.manchester.tornado.api.TaskGraph;
import uk.ac.manchester.tornado.api.TornadoExecutionPlan;
Expand All @@ -33,7 +33,7 @@
import java.util.Random;
import java.util.stream.IntStream;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* How to test?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -17,30 +17,30 @@
*/
package uk.ac.manchester.tornado.unittests.arrays;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.util.Random;
import java.util.stream.IntStream;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import uk.ac.manchester.tornado.api.ImmutableTaskGraph;
import uk.ac.manchester.tornado.api.TaskGraph;
import uk.ac.manchester.tornado.api.TornadoExecutionPlan;
import uk.ac.manchester.tornado.api.annotations.Parallel;
import uk.ac.manchester.tornado.api.annotations.Reduce;
import uk.ac.manchester.tornado.api.enums.DataTransferMode;
import uk.ac.manchester.tornado.api.types.arrays.FloatArray;
import uk.ac.manchester.tornado.api.types.arrays.IntArray;
import uk.ac.manchester.tornado.api.enums.DataTransferMode;
import uk.ac.manchester.tornado.unittests.common.TornadoNotSupported;
import uk.ac.manchester.tornado.unittests.common.TornadoTestBase;

/**
* How to test?
*
* <code>
* tornado-test -V --fast uk.ac.manchester.tornado.unittests.arrays.TestNewArrays
* tornado-test -V --fast uk.ac.manchester.tornado.unittests.arrays.TestNewArrays
* </code>
*/
public class TestNewArrays extends TornadoTestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

package uk.ac.manchester.tornado.unittests.atomics;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import uk.ac.manchester.tornado.api.ImmutableTaskGraph;
import uk.ac.manchester.tornado.api.TaskGraph;
Expand Down
Loading