Skip to content

Commit 695bf4f

Browse files
committed
Let GameTest harness own benchmark shutdown
1 parent d471891 commit 695bf4f

10 files changed

Lines changed: 43 additions & 16 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ jobs:
132132
if-no-files-found: error
133133
retention-days: 30
134134
path: |
135-
build/libs/OreSpawn-4.0.15.119041.jar
136-
build/libs/OreSpawn-4.0.15.119041-sources.jar
137-
build/libs/OreSpawn-4.0.15.119041-javadoc.jar
135+
build/libs/OreSpawn-4.0.16.119041.jar
136+
build/libs/OreSpawn-4.0.16.119041-sources.jar
137+
build/libs/OreSpawn-4.0.16.119041-javadoc.jar
138138
build/release/SHA256SUMS
139139
CHANGELOG.txt
140140

‎CHANGELOG.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Version 4.0.16.119041
2+
3+
* Leave benchmark shutdown to the GameTest harness when a benchmark is run
4+
through Forge's GameTest server, preventing a null test-tracker crash and
5+
allowing the harness to report its real test result.
6+
* Ordinary dedicated benchmark servers still stop automatically when requested.
7+
18
Version 4.0.15.119041
29

310
* Classify generated geology and public geology samples through the same

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ End" policy used by mods such as Base Metals.
1717
This is not the unrelated mod that adds mobs and dimensions under the same
1818
name.
1919

20-
This branch builds target-qualified version `4.0.15.119041`: the OreSpawn 4.0.15
20+
This branch builds target-qualified version `4.0.16.119041`: the OreSpawn 4.0.16
2121
feature set for Minecraft 1.19.4 and Forge. See the
2222
[versioning policy](docs/VERSIONS.md) for the encoding and release convention.
2323

‎build.gradle‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ def preparedReleaseDir = providers.gradleProperty('preparedReleaseDir')
845845
tasks.register('verifyReleaseConfiguration') {
846846
group = 'verification'
847847
doLast {
848-
if (project.mod_version != '4.0.15.119041'
848+
if (project.mod_version != '4.0.16.119041'
849849
|| project.mod_group != expectedMavenGroup
850850
|| project.minecraft_version != '1.19.4'
851851
|| project.forge_version != '45.4.0'
@@ -859,9 +859,9 @@ tasks.register('verifyReleaseConfiguration') {
859859
throw new GradleException('Unexpected dispatcher or Java target metadata')
860860
}
861861
List<String> expectedPublicArtifacts = [
862-
'OreSpawn-4.0.15.119041.jar',
863-
'OreSpawn-4.0.15.119041-sources.jar',
864-
'OreSpawn-4.0.15.119041-javadoc.jar'
862+
'OreSpawn-4.0.16.119041.jar',
863+
'OreSpawn-4.0.16.119041-sources.jar',
864+
'OreSpawn-4.0.16.119041-javadoc.jar'
865865
]
866866
if (base.archivesName.get() != expectedMavenArtifact
867867
|| expectedReleaseFiles.get().collect { it.toString() } != expectedPublicArtifacts) {
@@ -878,7 +878,7 @@ tasks.register('verifyReleaseConfiguration') {
878878
'src/main/java/zone/moddev/mc/orespawn/worldgen/LegacyMineralogyProfileMigration.java',
879879
'README.md', 'CHANGELOG.txt'
880880
].each { path ->
881-
if (!file(path).getText('UTF-8').contains('4.0.15.119041')) {
881+
if (!file(path).getText('UTF-8').contains('4.0.16.119041')) {
882882
throw new GradleException("Release identity missing from ${path}")
883883
}
884884
}

‎docs/VERSIONS.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Examples:
5757
| 1.16.5 | Forge | `116051` | `4.0.9.116051` |
5858
| 1.17.1 | Forge | `117011` | `4.0.9.117011` |
5959
| 1.18.2 | Forge | `118021` | `4.0.10.118021` |
60-
| 1.19.4 | Forge | `119041` | `4.0.15.119041` |
60+
| 1.19.4 | Forge | `119041` | `4.0.16.119041` |
6161
| 1.20.6 | Forge | `120061` | `4.0.6.120061` |
6262
| 1.21.11 | Forge | `121111` | `4.0.6.121111` |
6363
| 26.1.2 | Forge | `2601021` | `4.0.6.2601021` |
@@ -164,7 +164,9 @@ restore API biome-filter parity and accept provider-namespaced geomes in the
164164
creation editor, and to `4.0.14.119041` to convert exposed one-layer Snow
165165
without touching buried or authored weather materials. It then advanced to
166166
`4.0.15.119041` so generated geology and public samples use the same stable
167-
quart-biome cell at three-dimensional biome boundaries.
167+
quart-biome cell at three-dimensional biome boundaries, and to
168+
`4.0.16.119041` so GameTest benchmark runs leave shutdown and result reporting
169+
to the test harness.
168170

169171
This provides three useful guarantees:
170172

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mcp_version=20230314.122934
1919
mod_id=orespawn
2020
mod_name=MMD OreSpawn
2121
mod_license=LGPL-2.1
22-
mod_version=4.0.15.119041
22+
mod_version=4.0.16.119041
2323
mod_group=zone.moddev.mc.orespawn
2424
mod_authors=SkyBlade1978, dshadowwolf, the MMD Team
2525
mod_description=Configurable, provider-driven terrain, ore, and deposit generation.

‎src/main/java/zone/moddev/mc/orespawn/worldgen/LegacyConfigMigrator.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ private static void writeReport(Path config, List<String> lines) {
358358

359359
private static void writeUpgradeReport(Path config, int imported, List<String> detail) {
360360
List<String> lines = new ArrayList<>();
361-
lines.add("OreSpawn 4.0.15.119041 Upgrade Report");
361+
lines.add("OreSpawn 4.0.16.119041 Upgrade Report");
362362
lines.add("================================");
363363
lines.add("");
364364
lines.add("RESULT: Legacy OreSpawn settings were imported into the OS4 profile.");

‎src/main/java/zone/moddev/mc/orespawn/worldgen/LegacyMineralogyProfileMigration.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private static void writeUpgradeReport(Path worldRoot, Path configPath,
204204
Path report = worldRoot.resolve("serverconfig/orespawn-upgrade-report.txt");
205205
List<String> missing = missingBlocks(igneous, metamorphic, sedimentary);
206206
List<String> lines = new ArrayList<>();
207-
lines.add("OreSpawn 4.0.15.119041 Upgrade Report");
207+
lines.add("OreSpawn 4.0.16.119041 Upgrade Report");
208208
lines.add("================================");
209209
lines.add("");
210210
lines.add("RESULT: Existing Mineralogy " + identity.version + " world detected.");

‎src/main/java/zone/moddev/mc/orespawn/worldgen/WorldgenBenchmark.java‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
import net.minecraft.core.Registry;
1616
import net.minecraft.core.registries.BuiltInRegistries;
1717
import net.minecraft.core.registries.Registries;
18+
import net.minecraft.gametest.framework.GameTestServer;
1819
import net.minecraft.resources.ResourceKey;
1920
import net.minecraft.resources.ResourceLocation;
21+
import net.minecraft.server.MinecraftServer;
2022
import net.minecraft.server.level.ServerLevel;
2123
import net.minecraft.world.level.Level;
2224
import net.minecraft.world.level.block.Block;
@@ -140,11 +142,19 @@ MODE, chunks, repetitions, format(median), format(median / chunks),
140142
throw new IllegalStateException("Benchmark fluid audit found no successful deposits");
141143
}
142144
if (Boolean.getBoolean("orespawn.worldgenBenchmarkStopServer")) {
143-
LOGGER.info("ORESPAWN_BENCHMARK stopping server after completed benchmark");
144-
event.getServer().halt(false);
145+
if (ownsServerShutdown(event.getServer().getClass())) {
146+
LOGGER.info("ORESPAWN_BENCHMARK stopping server after completed benchmark");
147+
event.getServer().halt(false);
148+
} else {
149+
LOGGER.info("ORESPAWN_BENCHMARK leaving shutdown to the GameTest harness");
150+
}
145151
}
146152
}
147153

154+
static boolean ownsServerShutdown(Class<? extends MinecraftServer> serverType) {
155+
return !GameTestServer.class.isAssignableFrom(serverType);
156+
}
157+
148158
static ResourceKey<Level> benchmarkDimensionKey(String configured) {
149159
String dimensionName = configured.trim().toLowerCase(Locale.ROOT);
150160
return switch (dimensionName) {

‎src/test/java/zone/moddev/mc/orespawn/worldgen/WorldgenBenchmarkTest.java‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

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

8+
import net.minecraft.gametest.framework.GameTestServer;
89
import net.minecraft.core.registries.Registries;
910
import net.minecraft.resources.ResourceKey;
1011
import net.minecraft.resources.ResourceLocation;
12+
import net.minecraft.server.MinecraftServer;
1113
import net.minecraft.world.level.Level;
1214

1315
class WorldgenBenchmarkTest {
@@ -26,4 +28,10 @@ void rejectsInvalidCustomDimensionIds() {
2628
assertThrows(IllegalArgumentException.class,
2729
() -> WorldgenBenchmark.benchmarkDimensionKey("not a dimension"));
2830
}
31+
32+
@Test
33+
void leavesGameTestHarnessInControlOfServerShutdown() {
34+
assertEquals(false, WorldgenBenchmark.ownsServerShutdown(GameTestServer.class));
35+
assertEquals(true, WorldgenBenchmark.ownsServerShutdown(MinecraftServer.class));
36+
}
2937
}

0 commit comments

Comments
 (0)