3 from os
.path
import exists
5 from lldbsuite
.test
.decorators
import *
6 from lldbsuite
.test
.lldbtest
import *
7 from lldbsuite
.test
import lldbutil
11 features
= subprocess
.check_output(["sysctl", "machdep.cpu"])
12 return "AVX2" in features
.decode("utf-8")
16 features
= subprocess
.check_output(["sysctl", "machdep.cpu"])
17 return "Apple M" in features
.decode("utf-8")
20 def rosetta_debugserver_installed():
21 return exists("/Library/Apple/usr/libexec/oah/debugserver")
24 class TestLaunchProcessPosixSpawn(TestBase
):
25 NO_DEBUG_INFO_TESTCASE
= True
29 return "Current CPU is not Haswell"
32 def no_apple_silicon(self
):
33 if not apple_silicon():
34 return "Current CPU is not Apple Silicon"
37 def run_arch(self
, exe
, arch
):
38 self
.runCmd("target create -arch {} {}".format(arch
, exe
))
41 process
= self
.dbg
.GetSelectedTarget().process
42 self
.assertState(process
.GetState(), lldb
.eStateExited
)
43 self
.assertIn("slice: {}".format(arch
), process
.GetSTDOUT(1000))
47 @skipIfLLVMTargetMissing("AArch64")
48 @skipIfLLVMTargetMissing("X86")
49 @skipTestIfFn(no_haswell
)
50 def test_haswell(self
):
52 exe
= self
.getBuildArtifact("fat.out")
53 self
.run_arch(exe
, "x86_64")
54 self
.run_arch(exe
, "x86_64h")
58 @skipIfLLVMTargetMissing("AArch64")
59 @skipIfLLVMTargetMissing("X86")
60 @skipTestIfFn(no_apple_silicon
)
61 def test_apple_silicon(self
):
63 exe
= self
.getBuildArtifact("fat.out")
64 if rosetta_debugserver_installed():
65 self
.run_arch(exe
, "x86_64")
66 self
.run_arch(exe
, "arm64")