Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[runtimes] Add missing test dependencies to check-all #72955

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

tstellar
Copy link
Collaborator

The test-depends target contained all the dependencies needed to run the runtimes tests, but it was never added as a dependency of check-all. This caused some of the tsan tests to fail, since the custom libcxx build the tests were looking for was never built. Besides the tsan failures, this fixes all the other test failures I was seeing with:
cmake -G Ninja -B release-build -S llvm
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_ASSERTIONS=OFF
-DLLVM_ENABLE_PROJECTS="clang;lld"
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt"

This is the same configuration the test-release.sh script uses, so I'm hoping this will also fix all the test failures we've been seeing when building the releases.

Fixes #58680

The test-depends target contained all the dependencies needed to run the
runtimes tests, but it was never added as a dependency of check-all.
This led to some of the tsan tests to fail, since the custom libcxx
build they were using was never built.

Fixes llvm#58680
@petrhosek
Copy link
Member

I don't think this is correct, test-depends only makes sense in the LLVM build but the issue described in #58680 affects the runtimes build which is a subbuild (and the libc++ used by TSan is a subbuild of the runtimes). The missing dependency should be probably added inside the runtimes subbuild.

Copy link
Member

@petrhosek petrhosek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot that we treat check-all specially and rather than running separate lit instances for runtimes, we collect all test suites from subbuilds and run a single instance. Given that, I think this is the correct solution. Thanks for figuring this out!

@tstellar tstellar merged commit 7f215b1 into llvm:main Nov 22, 2023
3 checks passed
tru pushed a commit that referenced this pull request Nov 27, 2023
The test-depends target contained all the dependencies needed to run the
runtimes tests, but it was never added as a dependency of check-all.
This caused some of the tsan tests to fail, since the custom libcxx
build the tests were looking for was never built. Besides the tsan
failures, this fixes all the other test failures I was seeing with:
cmake -G Ninja -B release-build -S llvm \
        -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
        -DCMAKE_BUILD_TYPE=Release \
        -DLLVM_ENABLE_ASSERTIONS=OFF \
        -DLLVM_ENABLE_PROJECTS="clang;lld" \
        -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt"

This is the same configuration the test-release.sh script uses, so I'm
hoping this will also fix all the test failures we've been seeing when
building the releases.

Fixes #58680

(cherry picked from commit 7f215b1)
@zmodem
Copy link
Collaborator

zmodem commented Nov 27, 2023

Heads up that we're seeing builds fail with "unknown target 'runtimes-test-depends'" which is most likely due to this. (https://crbug.com/1505361). I'll try to verify that and come up with some kind of reproducer.

@zmodem
Copy link
Collaborator

zmodem commented Nov 27, 2023

A reproducer on Linux:

$ curl -LO https://dl.google.com/android/repository/android-ndk-r26b-linux.zip
$ unzip android-ndk-r26b-linux.zip
$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release "-DLLVM_ENABLE_PROJECTS=clang" -DLLVM_ENABLE_RUNTIMES=compiler-rt "-DLLVM_TARGETS_TO_BUILD=X86;AArch64" -DRUNTIMES_aarch64-linux-android21_LLVM_ENABLE_RUNTIMES=compiler-rt -DBUILTINS_aarch64-linux-android21_LLVM_ENABLE_RUNTIMES=compiler-rt -DRUNTIMES_aarch64-linux-android21_CMAKE_BUILD_TYPE=RelWithDebInfo -DBUILTINS_aarch64-linux-android21_CMAKE_BUILD_TYPE=RelWithDebInfo "-DRUNTIMES_aarch64-linux-android21_CMAKE_C_FLAGS=--sysroot=$PWD/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot --unwindlib=none -mbranch-protection=standard" "-DBUILTINS_aarch64-linux-android21_CMAKE_C_FLAGS=--sysroot=$PWD/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot --unwindlib=none -mbranch-protection=standard" "-DRUNTIMES_aarch64-linux-android21_CMAKE_CXX_FLAGS=--sysroot=$PWD/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot --unwindlib=none -mbranch-protection=standard" "-DBUILTINS_aarch64-linux-android21_CMAKE_CXX_FLAGS=--sysroot=$PWD/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot --unwindlib=none -mbranch-protection=standard" "-DRUNTIMES_aarch64-linux-android21_CMAKE_ASM_FLAGS=--sysroot=$PWD/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot --unwindlib=none -mbranch-protection=standard" "-DBUILTINS_aarch64-linux-android21_CMAKE_ASM_FLAGS=--sysroot=$PWD/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot --unwindlib=none -mbranch-protection=standard" -DRUNTIMES_aarch64-linux-android21_COMPILER_RT_USE_BUILTINS_LIBRARY=ON -DBUILTINS_aarch64-linux-android21_COMPILER_RT_USE_BUILTINS_LIBRARY=ON -DRUNTIMES_aarch64-linux-android21_SANITIZER_CXX_ABI=libcxxabi -DBUILTINS_aarch64-linux-android21_SANITIZER_CXX_ABI=libcxxabi -DRUNTIMES_aarch64-linux-android21_CMAKE_SHARED_LINKER_FLAGS=-Wl,-u__cxa_demangle -DBUILTINS_aarch64-linux-android21_CMAKE_SHARED_LINKER_FLAGS=-Wl,-u__cxa_demangle -DRUNTIMES_aarch64-linux-android21_ANDROID=1 -DBUILTINS_aarch64-linux-android21_ANDROID=1 -DRUNTIMES_aarch64-linux-android21_LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DBUILTINS_aarch64-linux-android21_LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DRUNTIMES_aarch64-linux-android21_LLVM_INCLUDE_TESTS=OFF -DBUILTINS_aarch64-linux-android21_LLVM_INCLUDE_TESTS=OFF -DRUNTIMES_aarch64-linux-android21_ANDROID_NATIVE_API_LEVEL=21 -DBUILTINS_aarch64-linux-android21_ANDROID_NATIVE_API_LEVEL=21 -DRUNTIMES_aarch64-linux-android21_COMPILER_RT_BUILD_CRT=ON -DRUNTIMES_aarch64-linux-android21_COMPILER_RT_BUILD_LIBFUZZER=OFF -DRUNTIMES_aarch64-linux-android21_COMPILER_RT_BUILD_MEMPROF=OFF -DRUNTIMES_aarch64-linux-android21_COMPILER_RT_BUILD_ORC=OFF -DRUNTIMES_aarch64-linux-android21_COMPILER_RT_BUILD_PROFILE=ON -DRUNTIMES_aarch64-linux-android21_COMPILER_RT_BUILD_SANITIZERS=ON -DRUNTIMES_aarch64-linux-android21_COMPILER_RT_BUILD_XRAY=OFF "-DRUNTIMES_aarch64-linux-android21_COMPILER_RT_SANITIZERS_TO_BUILD=asan;dfsan;msan;hwasan;tsan;cfi" -DRUNTIMES_aarch64-linux-android21_COMPILER_RT_DEFAULT_TARGET_ONLY=ON "-DLLVM_BUILTIN_TARGETS=aarch64-linux-android21" "-DLLVM_RUNTIME_TARGETS=aarch64-linux-android21" ../llvm
$ ninja check-all

...
[4693/4697] cd /work/llvm-project/build.xxx/runtimes/runtimes-aarch64-linux-android21-bins && /usr/bin/cmake --build /work/llvm-project/build.xxx/runtimes/runtimes-aarch64-linux-android21-bins/ --target runtimes-test-depends --config Release
ninja: error: unknown target 'runtimes-test-depends'
FAILED: runtimes/CMakeFiles/runtimes-test-depends-aarch64-linux-android21 /work/llvm-project/build.xxx/runtimes/CMakeFiles/runtimes-test-depends-aarch64-linux-android21

@zmodem
Copy link
Collaborator

zmodem commented Nov 27, 2023

I'll revert until this can be fixed. We should probably revert from the release branch too.

zmodem added a commit that referenced this pull request Nov 27, 2023
This caused some runtimes builds to fail with:
error: unknown target 'runtimes-test-depends'

See comments on the PR.

> The test-depends target contained all the dependencies needed to run the
> runtimes tests, but it was never added as a dependency of check-all.
> This caused some of the tsan tests to fail, since the custom libcxx
> build the tests were looking for was never built. Besides the tsan
> failures, this fixes all the other test failures I was seeing with:
> cmake -G Ninja -B release-build -S llvm \
>         -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
>         -DCMAKE_BUILD_TYPE=Release \
>         -DLLVM_ENABLE_ASSERTIONS=OFF \
>         -DLLVM_ENABLE_PROJECTS="clang;lld" \
>         -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt"
>
> This is the same configuration the test-release.sh script uses, so I'm
> hoping this will also fix all the test failures we've been seeing when
> building the releases.
>
> Fixes #58680

This reverts commit 7f215b1.
@tstellar
Copy link
Collaborator Author

@zmodem I think there are some steps missing in the reproducer script. Is the sdk supposed to be unpacked into the llvm-project directory? Where do I run the cmake invocation from?

@zmodem
Copy link
Collaborator

zmodem commented Nov 27, 2023

I think there are some steps missing in the reproducer script.

Sorry, I suppose the missing first line would be: "run the commands from a build directory under llvm-project/, e.g. llvm-project/build/" (or adjust the ../llvm source path in the cmake invocation)

@tstellar
Copy link
Collaborator Author

@zmodem I got it working now, thanks.

@tstellar
Copy link
Collaborator Author

It looks like this change uncovered an existing problem where the code in llvm/runtimes/CMakeLists.txt assumes that if LLVM_INCLUDE_TESTS=ON is set that tests will be enabled for the runtime builds too. However, this configuration breaks this assumption by passing -DRUNTIMES_aarch64-linux-android21_LLVM_INCLUDE_TESTS=OFF, which disables the tests for the runtime build. Even without this change, trying to use targets like 'ninja test-dependsorninja check-compiler-rt-aarch64-linux-android21` will fail.

I think I can come up with a fix to make this patch work, but it seems like there may be some other problems here that haven't been uncovered yet.

@petrhosek
Copy link
Member

I can also take a look but I don't want to duplicate effort, @tstellar please let me know if you need help.

@tstellar
Copy link
Collaborator Author

@zmodem @petrhosek I have a fix here: #73610

If the fix is good, then I'll push it first and let it sit in main awhile before re-committing the reverted patch.

tru added a commit that referenced this pull request Nov 28, 2023
This reverts commit e957e6d.

The commit was reverted on main because of issues. We will not carry
this in the release branch for 17.x
Guzhu-AMD pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Nov 30, 2023
Local branch amd-gfx 83aac61 Merged main:f21a70f9fe21 into amd-gfx:41205cbd2f82
Remote branch main a9e3d23 Revert "[runtimes] Add missing test dependencies to check-all (llvm#72955)"
MingcongBai pushed a commit to AOSC-Tracking/llvm-project that referenced this pull request Mar 26, 2024
The test-depends target contained all the dependencies needed to run the
runtimes tests, but it was never added as a dependency of check-all.
This caused some of the tsan tests to fail, since the custom libcxx
build the tests were looking for was never built. Besides the tsan
failures, this fixes all the other test failures I was seeing with:
cmake -G Ninja -B release-build -S llvm \
        -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
        -DCMAKE_BUILD_TYPE=Release \
        -DLLVM_ENABLE_ASSERTIONS=OFF \
        -DLLVM_ENABLE_PROJECTS="clang;lld" \
        -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt"

This is the same configuration the test-release.sh script uses, so I'm
hoping this will also fix all the test failures we've been seeing when
building the releases.

Fixes llvm#58680

(cherry picked from commit 7f215b1)
MingcongBai pushed a commit to AOSC-Tracking/llvm-project that referenced this pull request Mar 26, 2024
…2955)"

This reverts commit e957e6d.

The commit was reverted on main because of issues. We will not carry
this in the release branch for 17.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compiler-rt build missing library file
3 participants