summaryrefslogtreecommitdiffstats
path: root/llvm/utils/lit/tests/shtest-env.py
diff options
context:
space:
mode:
authorJoel E. Denny <jdenny.ornl@gmail.com>2019-10-30 14:22:16 -0400
committerJoel E. Denny <jdenny.ornl@gmail.com>2019-10-31 14:37:51 -0400
commit0d4e6519c5dd81034935d4da9c519c17e41b1202 (patch)
tree757e67ad8bf3eae10c948b0fe3305344a997c680 /llvm/utils/lit/tests/shtest-env.py
parent8e406204418895f7b09d1a9a3f8037e741a43968 (diff)
downloadbcm5719-llvm-0d4e6519c5dd81034935d4da9c519c17e41b1202.tar.gz
bcm5719-llvm-0d4e6519c5dd81034935d4da9c519c17e41b1202.zip
[lit] Fix internal env calling other internal commands
Without this patch, when using lit's internal shell, if `env` on a lit RUN line calls `cd`, `mkdir`, or any of the other in-process shell builtins that lit implements, lit accidentally searches for the latter as an external executable. This patch puts such builtins in a map so that boilerplate for them need be implemented only once. This patch moves that handling after processing of `env` so that `env` calling such a builtin can be detected. Finally, because such calls appear to be useless, this patch takes the safe approach of diagnosing them rather than supporting them. Reviewed By: probinson, mgorny, rnk Differential Revision: https://reviews.llvm.org/D66506
Diffstat (limited to 'llvm/utils/lit/tests/shtest-env.py')
-rw-r--r--llvm/utils/lit/tests/shtest-env.py37
1 files changed, 35 insertions, 2 deletions
diff --git a/llvm/utils/lit/tests/shtest-env.py b/llvm/utils/lit/tests/shtest-env.py
index e89bfd6156b..3b547dff85e 100644
--- a/llvm/utils/lit/tests/shtest-env.py
+++ b/llvm/utils/lit/tests/shtest-env.py
@@ -7,7 +7,7 @@
# Make sure env commands are included in printed commands.
-# CHECK: -- Testing: 7 tests{{.*}}
+# CHECK: -- Testing: 13 tests{{.*}}
# CHECK: FAIL: shtest-env :: env-args-last-is-assign.txt ({{[^)]*}})
# CHECK: Error: 'env' requires a subcommand
@@ -25,19 +25,52 @@
# CHECK: Error: 'env' requires a subcommand
# CHECK: error: command failed with exit status: {{.*}}
+# CHECK: FAIL: shtest-env :: env-calls-cd.txt ({{[^)]*}})
+# CHECK: $ "env" "-u" "FOO" "BAR=3" "cd" "foobar"
+# CHECK: Error: 'env' cannot call 'cd'
+# CHECK: error: command failed with exit status: {{.*}}
+
+# CHECK: FAIL: shtest-env :: env-calls-colon.txt ({{[^)]*}})
+# CHECK: $ "env" "-u" "FOO" "BAR=3" ":"
+# CHECK: Error: 'env' cannot call ':'
+# CHECK: error: command failed with exit status: {{.*}}
+
+# CHECK: FAIL: shtest-env :: env-calls-echo.txt ({{[^)]*}})
+# CHECK: $ "env" "-u" "FOO" "BAR=3" "echo" "hello" "world"
+# CHECK: Error: 'env' cannot call 'echo'
+# CHECK: error: command failed with exit status: {{.*}}
+
+# CHECK: FAIL: shtest-env :: env-calls-export.txt ({{[^)]*}})
+# CHECK: $ "env" "-u" "FOO" "BAR=3" "export" "BAZ=3"
+# CHECK: Error: 'env' cannot call 'export'
+# CHECK: error: command failed with exit status: {{.*}}
+
+# CHECK: FAIL: shtest-env :: env-calls-mkdir.txt ({{[^)]*}})
+# CHECK: $ "env" "-u" "FOO" "BAR=3" "mkdir" "foobar"
+# CHECK: Error: 'env' cannot call 'mkdir'
+# CHECK: error: command failed with exit status: {{.*}}
+
+# CHECK: FAIL: shtest-env :: env-calls-rm.txt ({{[^)]*}})
+# CHECK: $ "env" "-u" "FOO" "BAR=3" "rm" "foobar"
+# CHECK: Error: 'env' cannot call 'rm'
+# CHECK: error: command failed with exit status: {{.*}}
+
# CHECK: PASS: shtest-env :: env-u.txt ({{[^)]*}})
# CHECK: $ "{{[^"]*}}" "print_environment.py"
# CHECK: $ "env" "-u" "FOO" "{{[^"]*}}" "print_environment.py"
# CHECK: $ "env" "-u" "FOO" "-u" "BAR" "{{[^"]*}}" "print_environment.py"
+# CHECK-NOT: ${{.*}}print_environment.py
# CHECK: PASS: shtest-env :: env.txt ({{[^)]*}})
# CHECK: $ "env" "A_FOO=999" "{{[^"]*}}" "print_environment.py"
# CHECK: $ "env" "A_FOO=1" "B_BAR=2" "C_OOF=3" "{{[^"]*}}" "print_environment.py"
+# CHECK-NOT: ${{.*}}print_environment.py
# CHECK: PASS: shtest-env :: mixed.txt ({{[^)]*}})
# CHECK: $ "env" "A_FOO=999" "-u" "FOO" "{{[^"]*}}" "print_environment.py"
# CHECK: $ "env" "A_FOO=1" "-u" "FOO" "B_BAR=2" "-u" "BAR" "C_OOF=3" "{{[^"]*}}" "print_environment.py"
+# CHECK-NOT: ${{.*}}print_environment.py
# CHECK: Expected Passes : 3
-# CHECK: Unexpected Failures: 4
+# CHECK: Unexpected Failures: 10
# CHECK-NOT: {{.}}
OpenPOWER on IntegriCloud