diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb01788..a30bc12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -266,7 +266,7 @@ jobs: ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb $ARGS .github/workflows/store-version.sh install/llvm-mingw/versions.txt ./copy-msys-dependencies.sh $(pwd)/install/llvm-mingw ${{matrix.sys}} - ./test-libcxx-module.sh $(pwd)/install/llvm-mingw + NATIVE=1 ./test-libcxx-module.sh $(pwd)/install/llvm-mingw ./run-tests.sh $(pwd)/install/llvm-mingw cd install NAME=llvm-mingw-$TAG-ucrt-msys2-${{matrix.sys}} @@ -362,7 +362,7 @@ jobs: - uses: actions/checkout@v4 - name: Run tests run: | - ./test-libcxx-module.sh /llvm-mingw + NATIVE=1 ./test-libcxx-module.sh /llvm-mingw ./run-tests.sh /llvm-mingw ./run-lldb-tests.sh /llvm-mingw diff --git a/test-libcxx-module.sh b/test-libcxx-module.sh index edd9c5a..628a97e 100755 --- a/test-libcxx-module.sh +++ b/test-libcxx-module.sh @@ -30,4 +30,10 @@ for arch in $ARCHS; do # TODO: This should ideally use "$CXX -print-file-name=libc++.modules.json", then parse the json to find the relevant cppm file and include directory. $arch-w64-mingw32-clang++ -I$PREFIX/share/libc++/v1 -std=gnu++23 -Wno-reserved-module-identifier -x c++-module -fmodule-output=std.pcm -o std.cppm.obj -c $PREFIX/share/libc++/v1/std.cppm $arch-w64-mingw32-clang++ -I$PREFIX/share/libc++/v1 -std=gnu++23 -Wno-reserved-module-identifier -x c++-module -fmodule-output=std.compat.pcm -fmodule-file=std=std.pcm -o std.compat.cppm.obj -c $PREFIX/share/libc++/v1/std.compat.cppm + $arch-w64-mingw32-clang-scan-deps -format=p1689 -- $arch-w64-mingw32-clang++ -std=c++23 -c test/test-scan-deps.cpp -DEXPECT_$arch done + +if [ -n "$NATIVE" ]; then + # Test the unprefixed clang-scan-deps wrapper. + clang-scan-deps -format=p1689 -- clang++ -std=c++23 -c test/test-scan-deps.cpp -DEXPECT_$(clang++ -dumpmachine | sed 's/-.*//') +fi diff --git a/test/test-scan-deps.cpp b/test/test-scan-deps.cpp new file mode 100644 index 0000000..46b1823 --- /dev/null +++ b/test/test-scan-deps.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Martin Storsjo + * + * This file is part of llvm-mingw. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +// Test that clang-scan-deps can locate c++ standard library headers +#include + +// Test that we have set the expected architecture defines. +#if defined(__x86_64__) +#ifndef EXPECT_x86_64 +#include +#endif +#elif defined(__i386__) +#ifndef EXPECT_i686 +#include +#endif +#elif defined(__aarch64__) +#ifndef EXPECT_aarch64 +#include +#endif +#elif defined(__arm__) +#ifndef EXPECT_armv7 +#include +#endif +#endif