aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/StringRefTest.cpp
diff options
context:
space:
mode:
authorHarini0924 <79345568+Harini0924@users.noreply.github.com>2024-08-21 10:48:32 -0700
committerGitHub <noreply@github.com>2024-08-21 10:48:32 -0700
commitc975dc1da03d684604ddf787b07b63fb8e903648 (patch)
tree1098cb09ba311732d4b0ae743555a76c73cea5af /llvm/unittests/ADT/StringRefTest.cpp
parentae48affd25ac8e211a5bc1c72ef208615fc7eb7d (diff)
downloadllvm-c975dc1da03d684604ddf787b07b63fb8e903648.zip
llvm-c975dc1da03d684604ddf787b07b63fb8e903648.tar.gz
llvm-c975dc1da03d684604ddf787b07b63fb8e903648.tar.bz2
[clang] [test] Use lit Syntax for Environment Variables in Clang subproject (#102647)
This patch updates the clang tests by replacing shell command substitutions with lit-compatible syntax for setting and referencing environment variables. Specifically, the use of shell-style variable substitution (e.g., `DEFAULT_TRIPLE=`and `EXPECTED_RESOURCE_DIR=`) has been replaced with `env` and `%{env}` to align with lit's internal shell requirements. These changes ensure that environment variables are properly set and accessed within the lit environment. When using the lit internal shell with the command `LIT_USE_INTERNAL_SHELL=1 ninja check-clang`, one common error encountered is: ``` FAIL: Clang :: Driver/program-path-priority.c (19 of 20640) ******************** TEST 'Clang :: Driver/program-path-priority.c' FAILED ******************** Exit Code: 127 Command Output (stdout): -- # RUN: at line 90 DEFAULT_TRIPLE=`/usr/local/google/home/harinidonthula/llvm-project/build/tools/clang/test/Driver/Output/program-path-priority.c.tmp/clang --version | grep "Target:" | cut -d ' ' -f2` # executed command: 'DEFAULT_TRIPLE=`/usr/local/google/home/harinidonthula/llvm-project/build/tools/clang/test/Driver/Output/program-path-priority.c.tmp/clang' --version # .---command stderr------------ # | 'DEFAULT_TRIPLE=`/usr/local/google/home/harinidonthula/llvm-project/build/tools/clang/test/Driver/Output/program-path-priority.c.tmp/clang': command not found # `----------------------------- # error: command failed with exit status: 127 ``` To fix this issue, the patch replaces traditional shell substitutions with lit's environment variable handling, ensuring compatibility with the lit internal shell framework. This update applies to both the handling of the `DEFAULT_TRIPLE` and `EXPECTED_RESOURCE_DIR` variables, allowing the tests to pass when using the lit internal shell. The patch also adds `env` to the `PWD` variable setting in the following command to ensure the environment variable is correctly set within the lit internal shell: ``` // RUN: %if system-linux %{ env PWD=/proc/self/cwd %clang -### -c --coverage %s -o foo/bar.o 2>&1 | FileCheck --check-prefix=PWD %s %} ``` fixes: #102395 [link to RFC](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179)
Diffstat (limited to 'llvm/unittests/ADT/StringRefTest.cpp')
0 files changed, 0 insertions, 0 deletions