def test_eq(): ep0 = EntryPoint("test0", subdir="/root/") ep1 = EntryPoint("test1", subdir="/home/krun/") assert ep0 == ep0 assert ep1 == ep1 assert not ep0 == ep1 assert not ep0 == list()
def _check_jvmci_server_enabled(self): """Runs fake benchmark crashing if the Graal JVMCI JIT is disabled""" ep = EntryPoint("JavaCheckJVMCIServerEnabled", subdir=VM_SANITY_CHECKS_DIR) spawn_sanity_check(self.platform, ep, self, "JavaCheckJVMCIServerEnabled")
def test_sync_disks0002(self, monkeypatch): """We throw away the results from sanity checks, so there's no need to sync disks (and wait).""" stdout = json.dumps({ "wallclock_times": [123.4], "core_cycle_counts": [[1], [2], [3], [4]], "aperf_counts": [[5], [6], [7], [8]], "mperf_counts": [[9], [10], [11], [12]], }) config = Config() platform = MockPlatform(None, config) ep = EntryPoint("test") vm_def = PythonVMDef('/dummy/bin/python') sync_called = [False] def fake_sync_disks(): sync_called[0] = True monkeypatch.setattr(platform, "sync_disks", fake_sync_disks) def fake_run_exec_popen(args, stderr_file=None): return stdout, "", 0, False # stdout, stderr, exit_code, timed_out monkeypatch.setattr(vm_def, "_run_exec_popen", fake_run_exec_popen) util.spawn_sanity_check(platform, ep, vm_def, "test") assert sync_called == [False]
def _check_truffle_enabled(self): """Runs fake benchmark crashing if the Truffle is disabled in JRuby""" debug("Running jruby_check_truffle_enabled sanity check") ep = EntryPoint("jruby_check_graal_enabled.rb") spawn_sanity_check(self.platform, ep, self, "jruby_check_graal_enabled.rb", force_dir=VM_SANITY_CHECKS_DIR)
def _sanity_check_scheduler(self): from krun.vm_defs import NativeCodeVMDef from krun import EntryPoint ep = EntryPoint("check_linux_scheduler.so") vd = NativeCodeVMDef() util.spawn_sanity_check(self, ep, vd, "Scheduler", force_dir=PLATFORM_SANITY_CHECK_DIR)
def _sanity_check_cpu_affinity(self): from krun.vm_defs import NativeCodeVMDef from krun import EntryPoint ep = EntryPoint("check_linux_cpu_affinity.so") vd = NativeCodeVMDef() util.spawn_sanity_check(self, ep, vd, "CPU affinity", force_dir=PLATFORM_SANITY_CHECK_DIR)
def _sanity_check_nice_priority(self): from krun.vm_defs import NativeCodeVMDef from krun import EntryPoint ep = EntryPoint("check_nice_priority.so") vd = NativeCodeVMDef() util.spawn_sanity_check(self, ep, vd, "Process priority", force_dir=PLATFORM_SANITY_CHECK_DIR)
def _sanity_check_user_change(self): from krun.vm_defs import PythonVMDef from krun import EntryPoint ep = EntryPoint("check_user_change.py") vd = PythonVMDef(sys.executable) # run under the VM that runs *this* util.spawn_sanity_check(self, ep, vd, "UNIX user change", force_dir=PLATFORM_SANITY_CHECK_DIR)
def _malloc_options_sanity_check(self): """Checks MALLOC_OPTIONS are set""" from krun import EntryPoint ep = EntryPoint("check_openbsd_malloc_options.so") from krun.vm_defs import NativeCodeVMDef, SANITY_CHECK_HEAP_KB vd = NativeCodeVMDef() util.spawn_sanity_check(self, ep, vd, "OpenBSD malloc options", force_dir=PLATFORM_SANITY_CHECK_DIR)
def test_sync_disks0002(self, monkeypatch): """We throw away the results from sanity checks, so there's no need to sync disks (and wait).""" platform = MockPlatform(None) ep = EntryPoint("test") vm_def = PythonVMDef('/dummy/bin//python') sync_called = [False] def fake_sync_disks(): sync_called[0] = True monkeypatch.setattr(platform, "sync_disks", fake_sync_disks) def fake_run_exec_popen(args): return "[1]", "", 0 # stdout, stderr, exit_code monkeypatch.setattr(vm_def, "_run_exec_popen", fake_run_exec_popen) util.spawn_sanity_check(platform, ep, vm_def, "test") assert sync_called == [False]
def test_sync_disks0001(self, monkeypatch): """Check disk sync method is called""" platform = MockPlatform(None) ep = EntryPoint("test") vm_def = PythonVMDef('/dummy/bin//python') vm_def.set_platform(platform) sync_called = [False] def fake_sync_disks(): sync_called[0] = True monkeypatch.setattr(platform, "sync_disks", fake_sync_disks) def fake_run_exec_popen(args): return "[1]", "", 0 # stdout, stderr, exit_code monkeypatch.setattr(vm_def, "_run_exec_popen", fake_run_exec_popen) vm_def.run_exec(ep, "test", 1, 1, 1, 1) assert sync_called == [True]
def test_sync_disks0001(self, monkeypatch): """Check disk sync method is called""" config = Config() platform = MockPlatform(None, config) ep = EntryPoint("test") vm_def = PythonVMDef('/dummy/bin/python') vm_def.set_platform(platform) sync_called = [False] def fake_sync_disks(): sync_called[0] = True monkeypatch.setattr(platform, "sync_disks", fake_sync_disks) def fake_run_exec_popen(args, stderr_file=None): return "[1]", "", 0, False # stdout, stderr, exit_code, timed_out monkeypatch.setattr(vm_def, "_run_exec_popen", fake_run_exec_popen) vm_def.run_exec(ep, 1, 1, 1, 1, "test:dummyvm:default", 0) assert sync_called == [True]