-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[llvm-lit][test] Resolved typo in raising InternalShellError for export command in lit's internal shell #105961
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
[llvm-lit][test] Resolved typo in raising InternalShellError for export command in lit's internal shell #105961
Conversation
command This patch fixes a typo in lit's built-in export command, which returns an InternalShellError when more than one argument is given to the export. The InternalShellError was missing the cmd parameter when raised, leading to issues when a test using export fails in high-address-dereference.c in compiler-rt.
This patch fixes the incorrect usage of lit's built-in export command in this compiler-rt test. The export command only allows for one argument, but %env_asan_opts expands to "env ASAN_OPTIONS", which gives export two arguments instead of only one. Instead of using export, which propogates the environment variable value to all subsequent commands, the environment variable is manually set before all RUN lines following the original export line.
@llvm/pr-subscribers-testing-tools @llvm/pr-subscribers-compiler-rt-sanitizer Author: Connie Zhu (connieyzhu) ChangesThis patch fixes the incorrect usage of lit's built-in First, a typo in raising the error itself is resolved. The error being raised had the wrong number of parameters passed in. Then, the Fixes #102386. Full diff: https://github.com/llvm/llvm-project/pull/105961.diff 2 Files Affected:
diff --git a/compiler-rt/test/asan/TestCases/Posix/high-address-dereference.c b/compiler-rt/test/asan/TestCases/Posix/high-address-dereference.c
index 845e126d3f89b9..37a7b1702e982e 100644
--- a/compiler-rt/test/asan/TestCases/Posix/high-address-dereference.c
+++ b/compiler-rt/test/asan/TestCases/Posix/high-address-dereference.c
@@ -5,12 +5,11 @@
// REQUIRES: x86_64-target-arch
// RUN: %clang_asan %s -o %t
-// RUN: export %env_asan_opts=print_scariness=1
-// RUN: not %run %t 0x0000000000000000 2>&1 | FileCheck %s --check-prefixes=ZERO,HINT-PAGE0
-// RUN: not %run %t 0x0000000000000FFF 2>&1 | FileCheck %s --check-prefixes=LOW1,HINT-PAGE0
-// RUN: not %run %t 0x0000000000001000 2>&1 | FileCheck %s --check-prefixes=LOW2,HINT-NONE
-// RUN: not %run %t 0x4141414141414141 2>&1 | FileCheck %s --check-prefixes=HIGH,HINT-HIGHADDR
-// RUN: not %run %t 0xFFFFFFFFFFFFFFFF 2>&1 | FileCheck %s --check-prefixes=MAX,HINT-HIGHADDR
+// RUN: %env_asan_opts=print_scariness=1 not %run %t 0x0000000000000000 2>&1 | FileCheck %s --check-prefixes=ZERO,HINT-PAGE0
+// RUN: %env_asan_opts=print_scariness=1 not %run %t 0x0000000000000FFF 2>&1 | FileCheck %s --check-prefixes=LOW1,HINT-PAGE0
+// RUN: %env_asan_opts=print_scariness=1 not %run %t 0x0000000000001000 2>&1 | FileCheck %s --check-prefixes=LOW2,HINT-NONE
+// RUN: %env_asan_opts=print_scariness=1 not %run %t 0x4141414141414141 2>&1 | FileCheck %s --check-prefixes=HIGH,HINT-HIGHADDR
+// RUN: %env_asan_opts=print_scariness=1 not %run %t 0xFFFFFFFFFFFFFFFF 2>&1 | FileCheck %s --check-prefixes=MAX,HINT-HIGHADDR
#include <stdint.h>
#include <stdlib.h>
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index da7fa86fd39173..63ab5e4c183494 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -356,7 +356,7 @@ def executeBuiltinPopd(cmd, shenv):
def executeBuiltinExport(cmd, shenv):
"""executeBuiltinExport - Set an environment variable."""
if len(cmd.args) != 2:
- raise InternalShellError("'export' supports only one argument")
+ raise InternalShellError(cmd, "'export' supports only one argument")
updateEnv(shenv, cmd.args)
return ShellCommandResult(cmd, "", "", 0, False)
|
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.
I'm fine w/ the code change in TestRunner.py, but
- this needs a test in lit's test suite
- the compiler-rt change should be split out on its own
// RUN: export %env_asan_opts=print_scariness=1 | ||
// RUN: not %run %t 0x0000000000000000 2>&1 | FileCheck %s --check-prefixes=ZERO,HINT-PAGE0 | ||
// RUN: not %run %t 0x0000000000000FFF 2>&1 | FileCheck %s --check-prefixes=LOW1,HINT-PAGE0 | ||
// RUN: not %run %t 0x0000000000001000 2>&1 | FileCheck %s --check-prefixes=LOW2,HINT-NONE | ||
// RUN: not %run %t 0x4141414141414141 2>&1 | FileCheck %s --check-prefixes=HIGH,HINT-HIGHADDR | ||
// RUN: not %run %t 0xFFFFFFFFFFFFFFFF 2>&1 | FileCheck %s --check-prefixes=MAX,HINT-HIGHADDR | ||
// RUN: %env_asan_opts=print_scariness=1 not %run %t 0x0000000000000000 2>&1 | FileCheck %s --check-prefixes=ZERO,HINT-PAGE0 | ||
// RUN: %env_asan_opts=print_scariness=1 not %run %t 0x0000000000000FFF 2>&1 | FileCheck %s --check-prefixes=LOW1,HINT-PAGE0 | ||
// RUN: %env_asan_opts=print_scariness=1 not %run %t 0x0000000000001000 2>&1 | FileCheck %s --check-prefixes=LOW2,HINT-NONE | ||
// RUN: %env_asan_opts=print_scariness=1 not %run %t 0x4141414141414141 2>&1 | FileCheck %s --check-prefixes=HIGH,HINT-HIGHADDR | ||
// RUN: %env_asan_opts=print_scariness=1 not %run %t 0xFFFFFFFFFFFFFFFF 2>&1 | FileCheck %s --check-prefixes=MAX,HINT-HIGHADDR |
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.
This seems unrelated to this patch, is there a reason its included here?
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.
I included it because it was related to the RUN line that caused the InternalShellError. I will split it out into it's own patch.
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.
I think that's preferable.
This patch creates a test to show the failing behavior for lit's built-in export command when given more than one 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.
LGTM.
…nts (#106143) This patch fixes the incorrect usage of lit's built-in export command in this compiler-rt test. The export command only allows for one argument, but %env_asan_opts expands to "env ASAN_OPTIONS", which gives export two arguments instead of only one. Instead of using export, which propogates the environment variable value to all subsequent commands, the environment variable is manually set before all RUN lines following the original export line. This patch depends on #105961. Fixes #106142.
This patch fixes the incorrect usage of lit's built-in
export
command. There is a typo in raising the error itself where the error being raised had the wrong number of parameters passed in.Fixes #102386.