aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llvm/utils/lit/lit/TestRunner.py2
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-export/export-too-many-args.txt2
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-export/lit.cfg7
-rw-r--r--llvm/utils/lit/tests/shtest-export.py12
4 files changed, 22 insertions, 1 deletions
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index 4dad141..e3ca9b1 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)
diff --git a/llvm/utils/lit/tests/Inputs/shtest-export/export-too-many-args.txt b/llvm/utils/lit/tests/Inputs/shtest-export/export-too-many-args.txt
new file mode 100644
index 0000000..b282e1a
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-export/export-too-many-args.txt
@@ -0,0 +1,2 @@
+## Test export command with too many arguments.
+# RUN: export FOO=1 BAR=2
diff --git a/llvm/utils/lit/tests/Inputs/shtest-export/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-export/lit.cfg
new file mode 100644
index 0000000..22ddf13
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-export/lit.cfg
@@ -0,0 +1,7 @@
+import lit.formats
+
+config.name = "shtest-export"
+config.suffixes = [".txt"]
+config.test_format = lit.formats.ShTest()
+config.test_source_root = None
+config.test_exec_root = None
diff --git a/llvm/utils/lit/tests/shtest-export.py b/llvm/utils/lit/tests/shtest-export.py
new file mode 100644
index 0000000..f2de8e8
--- /dev/null
+++ b/llvm/utils/lit/tests/shtest-export.py
@@ -0,0 +1,12 @@
+## Test the export command.
+
+# RUN: not %{lit} -a -v %{inputs}/shtest-export \
+# RUN: | FileCheck -match-full-lines %s
+#
+# END.
+
+# CHECK: FAIL: shtest-export :: export-too-many-args.txt {{.*}}
+# CHECK: export FOO=1 BAR=2
+# CHECK: # executed command: export FOO=1 BAR=2
+# CHECK: # | 'export' supports only one argument
+# CHECK: # error: command failed with exit status: {{.*}}