Skip to content

Commit e8cd3e4

Browse files
committed
[SYCLomatic][intercept-build] Fix lit tests related to intercept-build run failed in the env that toolchain is not available from environment variable PATH
The related cases are as follows: 1. dpct/cmp-cmds-linker-entry-src-files/one.cu 2. dpct/dpct-intercept-build/main.cpp 3. dpct/gen_build_script2/hello.cu 4. dpct/gen_build_script3/hello.cu Signed-off-by: chenwei.sun <[email protected]>
1 parent 950c271 commit e8cd3e4

File tree

1 file changed

+13
-7
lines changed
  • clang/tools/scan-build-py/lib/libear

1 file changed

+13
-7
lines changed

clang/tools/scan-build-py/lib/libear/ear.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,11 @@ int eaccess(const char *pathname, int mode) {
494494
}
495495

496496
int nvcc_available = 0;
497-
char *value = getenv("INTERCEPT_COMPILE_PATH");
498-
if (value) {
497+
char *value_compile = getenv("INTERCEPT_COMPILE_PATH");
498+
char *value_env = getenv("IS_INTERCEPT_COMPILE_PATH_FROM_ENV_PATH");
499+
500+
// Consider tool chain is avaialbe only when it is available from env path.
501+
if (value_env && *value_env == '1' && value_compile) {
499502
nvcc_available = 1;
500503
}
501504

@@ -1727,17 +1730,20 @@ int is_tool_available(char const *argv[], size_t const argc) {
17271730
int is_nvcc = 0;
17281731
int is_nvcc_available = 0;
17291732

1730-
char *value = getenv("INTERCEPT_COMPILE_PATH");
1731-
if (value) {
1732-
is_nvcc_available = 1;
1733+
int nvcc_available = 0;
1734+
char *value_compile = getenv("INTERCEPT_COMPILE_PATH");
1735+
char *value_env = getenv("IS_INTERCEPT_COMPILE_PATH_FROM_ENV_PATH");
1736+
1737+
// Consider tool chain is avaialbe only when it is available from env path.
1738+
if (value_env && *value_env == '1' && value_compile) {
1739+
nvcc_available = 1;
17331740
}
17341741

17351742
if (len == 4 && pathname[3] == 'c' && pathname[2] == 'c' &&
17361743
pathname[1] == 'v' && pathname[0] == 'n') {
17371744
// To handle case like "nvcc"
17381745
is_nvcc = 1;
1739-
value = getenv("IS_INTERCEPT_COMPILE_PATH_FROM_ENV_PATH");
1740-
if (value && *value == '0') {
1746+
if (nvcc_available == '0') {
17411747
return 0;
17421748
}
17431749
}

0 commit comments

Comments
 (0)