Skip to content

[lldb] Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host #115337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
21 changes: 11 additions & 10 deletions lldb/packages/Python/lldbsuite/test/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,13 +989,16 @@ def skipUnlessAArch64MTELinuxCompiler(func):

def is_toolchain_with_mte():
compiler_path = lldbplatformutil.getCompiler()
compiler = os.path.basename(compiler_path)
f = tempfile.NamedTemporaryFile()
f = tempfile.NamedTemporaryFile(delete=False)
if lldbplatformutil.getPlatform() == "windows":
return "MTE tests are not compatible with 'windows'"

cmd = "echo 'int main() {}' | %s -x c -o %s -" % (compiler_path, f.name)
if os.popen(cmd).close() is not None:
# Note hostos may be Windows.
f.close()

cmd = f"{compiler_path} -x c -o {f.name} -"
if subprocess.run(cmd, input="int main() {}".encode()).returncode != 0:
os.remove(f.name)
# Cannot compile at all, don't skip the test
# so that we report the broken compiler normally.
return None
Expand All @@ -1010,12 +1013,10 @@ def is_toolchain_with_mte():
int main() {
void* ptr = __arm_mte_create_random_tag((void*)(0), 0);
}"""
cmd = "echo '%s' | %s -march=armv8.5-a+memtag -x c -o %s -" % (
test_src,
compiler_path,
f.name,
)
if os.popen(cmd).close() is not None:
cmd = f"{compiler_path} -march=armv8.5-a+memtag -x c -o {f.name} -"
res = subprocess.run(cmd, input=test_src.encode())
os.remove(f.name)
if res.returncode != 0:
return "Toolchain does not support MTE"
return None

Expand Down
Loading