From 8d26757ecddb50e0d050b78ccfb288136c3df5da Mon Sep 17 00:00:00 2001 From: JohnBraham Date: Fri, 30 Oct 2026 10:49:37 +0000 Subject: [PATCH] Prepare native client inputs before Eclipse verification --- tools/native117_ci.py | 11 ++++++++--- tools/test_native117_ci.py | 15 +++++++++++++++ tools/test_runtime_diagnostics.py | 13 +++++++++++-- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/tools/native117_ci.py b/tools/native117_ci.py index a494517..4288ae9 100644 --- a/tools/native117_ci.py +++ b/tools/native117_ci.py @@ -36,7 +36,7 @@ def build(): first=Path(os.environ.get('RUNNER_TEMP',tempfile.gettempdir()))/'lootablebodies117-first-build' first.mkdir(exist_ok=False) # Commands survive clean; no previous evidence directory is overwritten. - tasks=('clean','build','javadoc','verifyEclipseProductionClasspath','preparePackagedIntegrationProbe','preparePackagedForgeControl','prepareReleaseBundle') + tasks=('clean','build','javadoc','preparePackagedIntegrationProbe','preparePackagedForgeControl','prepareReleaseBundle') for number in (1,2): log=first/('build-'+str(number)+'.log') args=[str(PROJECT/('gradlew.bat' if os.name=='nt' else 'gradlew')),*tasks,'--no-daemon','--console=plain','--stacktrace','--no-build-cache'] @@ -54,11 +54,16 @@ def build(): target=PROJECT/'build/ci117-build-proof';shutil.copytree(first,target) (target/'result.json').write_text(json.dumps({'two_clean_uncached_builds':True,'second_build_offline':True,'junit_each':tests,'files':expected},indent=2)+'\n') +def native_sdk_and_eclipse(java): + python('native-server-install.log','native_runtime.py','--java',java,'--output','build/native-server-distribution') + python('native-client-install.log','native_runtime.py','--java',java,'--output','build/native-client-distribution','--client') + gradle('eclipse-and-assets.log','prepareMinecraftAssets','verifyEclipseProductionClasspath', + '-PminecraftNativesDirectory=build/native-client-distribution/prepared-inputs/natives') + def prepare(): java=Path(os.environ['JAVA_HOME_16_X64'])/'bin/java' java8=Path(os.environ['JAVA_HOME_8_X64'])/'bin/java' - python('native-server-install.log','native_runtime.py','--java',java,'--output','build/native-server-distribution') - python('native-client-install.log','native_runtime.py','--java',java,'--output','build/native-client-distribution','--client') + native_sdk_and_eclipse(java) from native_runtime import prepare_server,run_java,HISTORICAL_JVM_ARGS from audit_runtime_logs import audit control=PROJECT/'build/control-test-mod/forge-platform-control-reobf.jar' diff --git a/tools/test_native117_ci.py b/tools/test_native117_ci.py index a952e97..4b24feb 100644 --- a/tools/test_native117_ci.py +++ b/tools/test_native117_ci.py @@ -4,6 +4,21 @@ import native117_ci as ci class Native117CITests(unittest.TestCase): + def test_eclipse_gate_receives_the_real_prepared_client_natives_after_sdk_install(self): + with tempfile.TemporaryDirectory() as d,patch.object(ci,'PROJECT',Path(d)): + events=[];natives=Path(d)/'build/native-client-distribution/prepared-inputs/natives' + def installer(name,tool,*args,**kwargs): + events.append(name) + if '--client' in args:natives.mkdir(parents=True) + def eclipse(name,*tasks,**kwargs): + self.assertTrue(natives.is_dir(),'IDE verification ran before actual client input preparation') + self.assertIn('verifyEclipseProductionClasspath',tasks) + self.assertIn('-PminecraftNativesDirectory=build/native-client-distribution/prepared-inputs/natives',tasks) + events.append(name) + with patch.object(ci,'python',side_effect=installer),patch.object(ci,'gradle',side_effect=eclipse): + ci.native_sdk_and_eclipse(Path(d)/'jdk/bin/java') + self.assertEqual(['native-server-install.log','native-client-install.log','eclipse-and-assets.log'],events) + def test_only_the_six_accepted_bytes_can_be_promoted(self): with tempfile.TemporaryDirectory() as d,patch.object(ci,'PROJECT',Path(d)): target=Path(d)/'bundle';target.mkdir();expected={} diff --git a/tools/test_runtime_diagnostics.py b/tools/test_runtime_diagnostics.py index a6156e4..018f7de 100644 --- a/tools/test_runtime_diagnostics.py +++ b/tools/test_runtime_diagnostics.py @@ -120,10 +120,19 @@ def test_failed_attach_is_retained_and_does_not_mask_the_runtime_timeout(self): with self.assertRaises(subprocess.TimeoutExpired): self.run_child(home, 'import time; time.sleep(30)', collector=[sys.executable, '-c', - 'import sys; print("attach refused"); sys.exit(9)']) + 'from pathlib import Path; import sys,time; ' + 'seen=Path("attach-seen"); ' + 'time.sleep(30) if seen.exists() else None; ' + 'seen.touch(); print("attach refused", flush=True); sys.exit(9)']) report = json.loads((home/'phase.diagnostics/result.json').read_text()) self.assertTrue(report['timed_out']) - self.assertTrue(all(c['returncode'] == 9 for c in report['captures'])) + self.assertTrue(any(c['returncode'] == 9 for c in report['captures'])) + # A later attach may still be running at the fixed deadline. It + # must be reaped, rather than extending the runtime to obtain 9. + self.assertTrue(any(c['timed_out'] for c in report['captures'])) + self.assertTrue(all(c['returncode'] == 9 or + (c['timed_out'] and c['returncode'] is not None) + for c in report['captures'])) self.assertIn('attach refused', (home/'phase.diagnostics'/report['captures'][0]['file']).read_text())