[llvm] [llvm-lit] Resolve env subcommand required error (PR #98414)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 02:58:17 PDT 2024


================
@@ -34,9 +34,9 @@
 # CHECK: --
 
 # CHECK: PASS: shtest-env :: env-args-none.txt ({{[^)]*}})
-# CHECK: env
+# CHECK: env | {{.*}}
 # CHECK: # executed command: env
-# CHECK-NOT: {{^[^#]}}
+# CHECK-NOT: {{^[^#]}} | {{.*}}
----------------
Harini0924 wrote:

I added `# CHECK: env | {{.*}}` to make sure that the test captures the full line where the env command is executed and its output is piped to FileCheck. The `{{.*}}`matches everything after `env |`, ensuring the entire command and its arguments are included in the test output. This verifies that the env command is executed properly within the test and its output is processed as expected. 
Other tests also use `| {{.*}}` to match the full lines of commands. For example, in tests like `shtest-env :: env-u.txt`, the commands include `[[PYTHON]] print_environment.py | {{.*}}` and `env -u FOO [[PYTHON]]` `print_environment.py | {{.*}}`. This approach ensures that the entire command line and its output are correctly captured and checked in the test output.

https://github.com/llvm/llvm-project/pull/98414


More information about the llvm-commits mailing list