Fix shermes Windows CC path splitting (#1994)#2089
Conversation
|
Hi @tangtaizong666! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
lavenzg
left a comment
There was a problem hiding this comment.
Thanks for making the PR. Left some comments here.
| else() | ||
| set(SHERMES_CC_PATH_SEPARATOR ":") | ||
| endif() | ||
| string(CONCAT SHERMES_CC_INCLUDE_PATH_DEFAULT |
There was a problem hiding this comment.
Done in 79a4ab3 — switched to list(JOIN ...). The include and lib paths are now built from *_ENTRIES lists joined with SHERMES_CC_PATH_SEPARATOR (; on a Windows host, : otherwise), instead of hardcoding : inside a string(CONCAT ...).
| // RUN: (CC=cmd %shermes -v -o %t.exe %s || true) 2>&1 | %FileCheck %s | ||
|
|
||
| // CHECK: cmd.exe | ||
| // CHECK-NOT: {{(^| )-IC( |$)}} |
There was a problem hiding this comment.
There is no guarantee that SHERMES_CC_INCLUDE_PATH and SHERMES_CC_LIB_PATH will point to C: drive right?
There was a problem hiding this comment.
Right — fixed in 79a4ab3. The CHECK-NOT patterns no longer assume the C: drive: they match any drive letter (-I[A-Za-z], -L[A-Za-z], -Wl,-rpath [A-Za-z]) and also assert the colon-joined DRIVE:...:DRIVE: shape ({{[A-Za-z]:[^ ]*:[A-Za-z]:}}) is absent, so the test catches the regression regardless of which drive the build tree lives on.
| */ | ||
|
|
||
| // REQUIRES: windows | ||
| // RUN: (CC=cmd %shermes -v -o %t.exe %s || true) 2>&1 | %FileCheck %s |
There was a problem hiding this comment.
I understand that we don't really need to compile the file, just use it to print out the include/lib paths. But it's still weird to pass cmd to CC. Could we just pass a fake flag here so that we can still get the full failed command and do check on the paths?
There was a problem hiding this comment.
Switched to a fake flag in 79a4ab3: -Wc,--shermes-invalid-cc-option is forwarded to CC, which fails, so we still get the full failed CC invocation to FileCheck against (// CHECK: --shermes-invalid-cc-option) while no longer overriding CC=cmd.
Summary:
llvh::sys::EnvPathSeparator.Test Plan:
cmake -U SHERMES_CC_INCLUDE_PATH -U SHERMES_CC_LIB_PATH -S work\hermes-git -B work\hermes-git\cmake-build-asan -G Ninja -DCMAKE_BUILD_TYPE=Debug -DHERMES_ENABLE_ADDRESS_SANITIZER=ON -DHERMES_ENABLE_NAPI=OFF -DHERMES_TEST_EXTRA_ARGS="--path C:/application/Git/usr/bin" -DCMAKE_MAKE_PROGRAM="C:\application\vs\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe"cmake --build work\hermes-git\cmake-build-asan --target check-shermes --parallel 4withLIT_FILTER=windows-cc-path-separatorFixes #1994