-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
[lldb] Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host #115337
Conversation
… of Windows host Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host.
@llvm/pr-subscribers-lldb Author: Dmitry Vasilyev (slydiman) ChangesFixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host. Full diff: https://github.com/llvm/llvm-project/pull/115337.diff 1 Files Affected:
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index 34319e203a3177..d4c5e61a8fd95a 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -989,13 +989,27 @@ def skipUnlessAArch64MTELinuxCompiler(func):
def is_toolchain_with_mte():
compiler_path = lldbplatformutil.getCompiler()
- compiler = os.path.basename(compiler_path)
- f = tempfile.NamedTemporaryFile()
+ f_src = tempfile.NamedTemporaryFile(delete=False)
+ f_out = 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)
+ # Note hostos may be Windows.
+ f_src.close()
+ f_out.close()
+
+ with open(f_src.name, "w") as f:
+ f.write("int main() {}")
+ cmd = f"{compiler_path} -x c -o {f_out.name} {f_src.name}"
if os.popen(cmd).close() is not None:
+ try:
+ os.remove(f_src.name)
+ except OSError:
+ pass
+ try:
+ os.remove(f_out.name)
+ except OSError:
+ pass
# Cannot compile at all, don't skip the test
# so that we report the broken compiler normally.
return None
@@ -1010,12 +1024,21 @@ 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,
+ with open(f_src.name, "w") as f:
+ f.write(test_src)
+ cmd = (
+ f"{compiler_path} -march=armv8.5-a+memtag -x c -o {f_out.name} {f_src.name}"
)
- if os.popen(cmd).close() is not None:
+ res = os.popen(cmd).close()
+ try:
+ os.remove(f_src.name)
+ except OSError:
+ pass
+ try:
+ os.remove(f_out.name)
+ except OSError:
+ pass
+ if res is not None:
return "Toolchain does not support MTE"
return None
|
with open(f_src.name, "w") as f: | ||
f.write(test_src) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considered using the subprocess
module and passing the contents through the input
argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Thanks.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/195/builds/794 Here is the relevant piece of the build log for the reference
|
… of Windows host (llvm#115337) Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host.
Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host.