Skip to content

Commit 1990d8d

Browse files
authored
[llvm-lit][test] Resolved typo in raising InternalShellError for export command in lit's internal shell (#105961)
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.
1 parent ce2b488 commit 1990d8d

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

llvm/utils/lit/lit/TestRunner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def executeBuiltinPopd(cmd, shenv):
356356
def executeBuiltinExport(cmd, shenv):
357357
"""executeBuiltinExport - Set an environment variable."""
358358
if len(cmd.args) != 2:
359-
raise InternalShellError("'export' supports only one argument")
359+
raise InternalShellError(cmd, "'export' supports only one argument")
360360
updateEnv(shenv, cmd.args)
361361
return ShellCommandResult(cmd, "", "", 0, False)
362362

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## Test export command with too many arguments.
2+
# RUN: export FOO=1 BAR=2
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import lit.formats
2+
3+
config.name = "shtest-export"
4+
config.suffixes = [".txt"]
5+
config.test_format = lit.formats.ShTest()
6+
config.test_source_root = None
7+
config.test_exec_root = None

llvm/utils/lit/tests/shtest-export.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Test the export command.
2+
3+
# RUN: not %{lit} -a -v %{inputs}/shtest-export \
4+
# RUN: | FileCheck -match-full-lines %s
5+
#
6+
# END.
7+
8+
# CHECK: FAIL: shtest-export :: export-too-many-args.txt {{.*}}
9+
# CHECK: export FOO=1 BAR=2
10+
# CHECK: # executed command: export FOO=1 BAR=2
11+
# CHECK: # | 'export' supports only one argument
12+
# CHECK: # error: command failed with exit status: {{.*}}

0 commit comments

Comments
 (0)