Skip to content
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
11 changes: 8 additions & 3 deletions tools/native117_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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'
Expand Down
15 changes: 15 additions & 0 deletions tools/test_native117_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={}
Expand Down
13 changes: 11 additions & 2 deletions tools/test_runtime_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
Loading