From 591a5c2ddc0a8f6aae83816b538afbbd224f26a0 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Mon, 11 Mar 2019 13:56:54 +0100 Subject: [PATCH] tests: also test UWP targets the tests with LoadLibrary will not work on these, so skip them --- run-tests.sh | 156 +++++++++++++++++++++++++++------------------------ 1 file changed, 84 insertions(+), 72 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index fc83f97..901dfbe 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -10,6 +10,7 @@ PREFIX="$1" export PATH=$PREFIX/bin:$PATH : ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}} +: ${TARGET_OSES:=${TOOLCHAIN_TARGET_OSES-mingw32 mingw32uwp}} if [ -z "$RUN_X86" ]; then case $(uname) in @@ -31,15 +32,13 @@ TESTS_C="hello hello-tls crt-test setjmp" TESTS_C_DLL="autoimport-lib" TESTS_C_LINK_DLL="autoimport-main" TESTS_C_NO_BUILTIN="crt-test" -TESTS_CPP="hello-cpp hello-exception tlstest-main exception-locale" +TESTS_CPP="hello-cpp hello-exception exception-locale" +TESTS_CPP_LOAD_DLL="tlstest-main" TESTS_CPP_DLL="tlstest-lib" TESTS_SSP="stacksmash" TESTS_ASAN="stacksmash" TESTS_UBSAN="ubsan" for arch in $ARCHS; do - TEST_DIR="$arch" - mkdir -p $TEST_DIR - case $arch in i686|x86_64) RUN="$RUN_X86" @@ -58,76 +57,89 @@ for arch in $ARCHS; do ;; esac - for test in $TESTS_C; do - $arch-w64-mingw32-clang $test.c -o $TEST_DIR/$test.exe - done - for test in $TESTS_C_DLL; do - $arch-w64-mingw32-clang $test.c -shared -o $TEST_DIR/$test.dll -Wl,--out-implib,$TEST_DIR/lib$test.dll.a - done - for test in $TESTS_C_LINK_DLL; do - $arch-w64-mingw32-clang $test.c -o $TEST_DIR/$test.exe -L$TEST_DIR -l${test%-main}-lib - done - TESTS_EXTRA="" - for test in $TESTS_C_NO_BUILTIN; do - $arch-w64-mingw32-clang $test.c -o $TEST_DIR/$test-no-builtin.exe -fno-builtin - TESTS_EXTRA="$TESTS_EXTRA $test-no-builtin" - done - for test in $TESTS_CPP; do - $arch-w64-mingw32-clang++ $test.cpp -o $TEST_DIR/$test.exe - done - for test in $TESTS_CPP_DLL; do - $arch-w64-mingw32-clang++ $test.cpp -shared -o $TEST_DIR/$test.dll - done - for test in $TESTS_SSP; do - $arch-w64-mingw32-clang $test.c -o $TEST_DIR/$test.exe -fstack-protector-strong - done - for test in $TESTS_ASAN; do - case $arch in - # Sanitizers on windows only support x86. - i686|x86_64) ;; - *) continue ;; - esac - $arch-w64-mingw32-clang $test.c -o $TEST_DIR/$test-asan.exe -fsanitize=address -g -gcodeview -Wl,-pdb,$arch/$test-asan.pdb - # Only run these tests on native windows; asan doesn't run in wine. - if [ -n "$NATIVE" ]; then - TESTS_EXTRA="$TESTS_EXTRA $test" - fi - done - for test in $TESTS_UBSAN; do - case $arch in - # Ubsan might not require anything too x86 specific, but we don't - # build any of the sanitizer libs for anything else than x86. - i686|x86_64) ;; - *) continue ;; - esac - $arch-w64-mingw32-clang $test.c -o $TEST_DIR/$test.exe -fsanitize=undefined - TESTS_EXTRA="$TESTS_EXTRA $test" - done - DLL="$TESTS_C_DLL $TESTS_CPP_DLL" - compiler_rt_arch=$arch - if [ "$arch" = "i686" ]; then - compiler_rt_arch=i386 - fi - for i in libc++ libunwind libssp-0 libclang_rt.asan_dynamic-$compiler_rt_arch; do - if [ -f $PREFIX/$arch-w64-mingw32/bin/$i.dll ]; then - cp $PREFIX/$arch-w64-mingw32/bin/$i.dll $TEST_DIR - DLL="$DLL $i" - fi - done - cd $TEST_DIR - if [ -n "$COPY" ]; then - for i in $DLL; do - $COPY $i.dll + for target_os in $TARGET_OSES; do + TEST_DIR="$arch-$target_os" + mkdir -p $TEST_DIR + for test in $TESTS_C; do + $arch-w64-$target_os-clang $test.c -o $TEST_DIR/$test.exe done - fi - for test in $TESTS_C $TESTS_C_LINK_DLL $TESTS_CPP $TESTS_EXTRA $TESTS_SSP; do - file=$test.exe + for test in $TESTS_C_DLL; do + $arch-w64-$target_os-clang $test.c -shared -o $TEST_DIR/$test.dll -Wl,--out-implib,$TEST_DIR/lib$test.dll.a + done + for test in $TESTS_C_LINK_DLL; do + $arch-w64-$target_os-clang $test.c -o $TEST_DIR/$test.exe -L$TEST_DIR -l${test%-main}-lib + done + TESTS_EXTRA="" + for test in $TESTS_C_NO_BUILTIN; do + $arch-w64-$target_os-clang $test.c -o $TEST_DIR/$test-no-builtin.exe -fno-builtin + TESTS_EXTRA="$TESTS_EXTRA $test-no-builtin" + done + for test in $TESTS_CPP; do + $arch-w64-$target_os-clang++ $test.cpp -o $TEST_DIR/$test.exe + done + for test in $TESTS_CPP_LOAD_DLL; do + case $target_os in + # DLLs can't be loaded without a Windows package + mingw32uwp) continue ;; + *) ;; + esac + $arch-w64-$target_os-clang++ $test.cpp -o $TEST_DIR/$test.exe + TESTS_EXTRA="$TESTS_EXTRA $test" + done + for test in $TESTS_CPP_DLL; do + $arch-w64-$target_os-clang++ $test.cpp -shared -o $TEST_DIR/$test.dll + done + for test in $TESTS_SSP; do + $arch-w64-$target_os-clang $test.c -o $TEST_DIR/$test.exe -fstack-protector-strong + done + for test in $TESTS_ASAN; do + case $arch in + # Sanitizers on windows only support x86. + i686|x86_64) ;; + *) continue ;; + esac + $arch-w64-$target_os-clang $test.c -o $TEST_DIR/$test-asan.exe -fsanitize=address -g -gcodeview -Wl,-pdb,$TEST_DIR/$test-asan.pdb + # Only run these tests on native windows; asan doesn't run in wine. + if [ -n "$NATIVE" ]; then + TESTS_EXTRA="$TESTS_EXTRA $test" + fi + done + for test in $TESTS_UBSAN; do + case $arch in + # Ubsan might not require anything too x86 specific, but we don't + # build any of the sanitizer libs for anything else than x86. + i686|x86_64) ;; + *) continue ;; + esac + $arch-w64-$target_os-clang $test.c -o $TEST_DIR/$test.exe -fsanitize=undefined + TESTS_EXTRA="$TESTS_EXTRA $test" + done + DLL="$TESTS_C_DLL $TESTS_CPP_DLL" + compiler_rt_arch=$arch + if [ "$arch" = "i686" ]; then + compiler_rt_arch=i386 + fi + for i in libc++ libunwind libssp-0 libclang_rt.asan_dynamic-$compiler_rt_arch; do + if [ -f $PREFIX/$arch-w64-mingw32/bin/$i.dll ]; then + cp $PREFIX/$arch-w64-mingw32/bin/$i.dll $TEST_DIR + DLL="$DLL $i" + fi + done + cd $TEST_DIR if [ -n "$COPY" ]; then - $COPY $file - fi - if [ -n "$RUN" ]; then - $RUN $file + for i in $DLL; do + $COPY $i.dll + done fi + for test in $TESTS_C $TESTS_C_LINK_DLL $TESTS_CPP $TESTS_EXTRA $TESTS_SSP; do + file=$test.exe + if [ -n "$COPY" ]; then + $COPY $file + fi + if [ -n "$RUN" ]; then + $RUN $file + fi + done + cd .. done - cd .. done