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

Separate long-running tests into a separate task #38

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .github/workflows/gradleBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
with:
java-version: 17
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew build -x test
- name: Run tests
run: ./gradlew check
- uses: actions/upload-artifact@v2
with:
name: Compiled jars
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/gradleBuildPR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ jobs:
with:
java-version: 17
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew build -x test
- name: Run tests
run: ./gradlew check
41 changes: 31 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,6 @@ dependencies {
testImplementation("org.hamcrest:hamcrest:2.2")
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
jvmArgs("-ea", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true", "-Dmixin.checks.interfaces=true")
exclude "**/mixin*"
}

tasks.withType(ProcessResources).configureEach {
var replaceProperties = [
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
Expand Down Expand Up @@ -313,7 +304,9 @@ test {
maxHeapSize = "2048M"

dependsOn(project.tasks.named("unzipTests"))
useJUnitPlatform()
useJUnitPlatform {
excludeTags "longRunTest"
}

// Always run tests, even when nothing changed.
dependsOn("cleanTest")
Expand All @@ -322,6 +315,34 @@ test {
testLogging {
events("passed", "skipped", "failed")
}

jvmArgs("-ea", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true", "-Dmixin.checks.interfaces=true")
exclude "**/mixin*"
}

def longRunTest = tasks.register("longRunTest", Test) {
minHeapSize = "512M"
maxHeapSize = "2048M"

useJUnitPlatform {
includeTags "longRunTest"
}

// Show test results.
testLogging {
events("passed", "skipped", "failed")
}

jvmArgs("-ea", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true", "-Dmixin.checks.interfaces=true")
exclude "**/mixin*"

group = "Verification"
mustRunAfter project.tasks.named("unzipTests")
shouldRunAfter project.tasks.named("test")
}

tasks.named("check") {
dependsOn longRunTest
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import io.github.opencubicchunks.cubicchunks.mixin.test.common.server.level.ChunkHolderTestAccess;
import io.github.opencubicchunks.cubicchunks.mixin.test.common.server.level.ChunkMapTestAccess;
import io.github.opencubicchunks.cubicchunks.mixin.test.common.server.level.ServerChunkCacheTestAccess;
import io.github.opencubicchunks.cubicchunks.test.LongRunTest;
import io.github.opencubicchunks.cubicchunks.testutils.BaseTest;
import io.github.opencubicchunks.cubicchunks.testutils.CloseableReference;
import io.github.opencubicchunks.cubicchunks.world.level.chunklike.CloPos;
import io.github.opencubicchunks.cubicchunks.world.level.cube.LevelCube;
import net.minecraft.Util;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.ChunkLevel;
import net.minecraft.server.level.ChunkMap;
Expand Down Expand Up @@ -251,6 +251,7 @@ public void testSingleChunkAllDependenciesForStatus(ChunkStatus status) throws E
/**
* Load a single cube at full status
*/
@LongRunTest
@Test public void singleFullCube() throws Exception {
try(var serverChunkCacheRef = createServerChunkCache()) {
var serverChunkCache = serverChunkCacheRef.value();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.github.opencubicchunks.cubicchunks.test;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import org.junit.jupiter.api.Tag;

@Target({ TYPE, METHOD })
@Retention(RUNTIME)
@Tag("longRunTest")
public @interface LongRunTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package io.github.opencubicchunks.cubicchunks.test;

import javax.annotation.ParametersAreNonnullByDefault;

import io.github.opencubicchunks.cc_core.annotation.MethodsReturnNonnullByDefault;
Loading