Limit concurrent NativeAOT compiles to stop MSBuild nodes dying of memory pressure [CI]
This commit is contained in:
1 parent
f2658b24f7
commit
3654d37da5
4 files changed
+51
-4
No files matched your search
@@ -198,6 +198,26 @@ esac
|
||||
self.assertEqual(package.getmember('moshiro-agent').mode, 0o755)
|
||||
subprocess.run(['sha256sum', '-c', archive.name + '.sha256'], cwd=output, check=True, capture_output=True)
|
||||
|
||||
def test_aot_slots_limit_concurrent_compiles_and_free_on_exit(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
slots = Path(temp) / 'slots'
|
||||
env = dict(os.environ, MOSHIRO_AOT_SLOTS='1', MOSHIRO_AOT_SLOT_DIR=str(slots), MOSHIRO_AOT_SLOT_WAIT='1')
|
||||
script = str(ROOT / 'ci/with-aot-slot.sh')
|
||||
holder = subprocess.Popen(['bash', script, 'sleep', '5'], env=env)
|
||||
try:
|
||||
deadline = time.monotonic() + 5
|
||||
while not (slots / 'slot-0').exists() and time.monotonic() < deadline:
|
||||
time.sleep(0.05)
|
||||
time.sleep(0.3)
|
||||
busy = subprocess.run(['bash', script, 'true'], env=env, capture_output=True, text=True)
|
||||
self.assertEqual(busy.returncode, 1, busy.stderr)
|
||||
self.assertIn('no NativeAOT slot', busy.stderr)
|
||||
finally:
|
||||
holder.kill()
|
||||
holder.wait()
|
||||
env['MOSHIRO_AOT_SLOT_WAIT'] = '5'
|
||||
self.assertEqual(subprocess.run(['bash', script, 'sh', '-c', 'exit 7'], env=env).returncode, 7)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
||||
Reference in new issue
Block a user