run-tests: Don't build all tests for mingw32uwp, restrict it to the specific uwp-error test

Build one single test to verify that building generic code for mingw32uwp
works, but skip building all of the tests for this target.

Keep building the uwp-error test for all targets, to verify that it
builds successfully for mingw32 but fails for mingw32uwp.

This reduces the runtime for the tests by around a third.
This commit is contained in:
Martin Storsjö committed 2020-03-05 15:39:30 +02:00
1 parent 6b9b4ef1e3
commit 551b046498
1 file changed
+103 -99
+103 -99
View File
@@ -70,6 +70,7 @@ TESTS_SSP="stacksmash"
TESTS_ASAN="stacksmash"
TESTS_UBSAN="ubsan"
TESTS_UWP="uwp-error"
TESTS_OTHER_TARGETS="hello"
for arch in $ARCHS; do
case $arch in
i686|x86_64)
@@ -89,57 +90,65 @@ for arch in $ARCHS; do
;;
esac
TEST_DIR="$arch"
mkdir -p $TEST_DIR
for test in $TESTS_C; do
$arch-w64-mingw32-clang $test.c -o $TEST_DIR/$test.exe
done
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
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_C_ANSI_STDIO; do
$arch-w64-$target_os-clang $test.c -o $TEST_DIR/$test-ansi-stdio.exe -D__USE_MINGW_ANSI_STDIO=1
TESTS_EXTRA="$TESTS_EXTRA $test-ansi-stdio"
done
for test in $TESTS_CPP $TESTS_CPP_EXCEPTIONS; do
$arch-w64-$target_os-clang++ $test.cpp -o $TEST_DIR/$test.exe
done
for test in $TESTS_CPP_EXCEPTIONS; do
$arch-w64-$target_os-clang++ $test.cpp -O2 -o $TEST_DIR/$test-opt.exe
done
if [ "$arch" != "aarch64" ] || [ -n "$NATIVE_AARCH64" ]; then
for test in $TESTS_CPP_EXCEPTIONS; do
TESTS_EXTRA="$TESTS_EXTRA $test $test-opt"
done
# Check that some generic tests build successfully for other targets.
# These tests are included in other groups, so skip the for the default
# mingw32 target, only test them for e.g. UWP.
# These tests are only built, not run, because the Windows Store specific
# CRT DLL isn't usually available outside of such a context.
if [ "$target_os" = "mingw32" ]; then
continue
fi
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"
for test in $TESTS_OTHER_TARGETS; do
$arch-w64-$target_os-clang $test.c -o $TEST_DIR/$test-$target_os.exe
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_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_C_ANSI_STDIO; do
$arch-w64-mingw32-clang $test.c -o $TEST_DIR/$test-ansi-stdio.exe -D__USE_MINGW_ANSI_STDIO=1
TESTS_EXTRA="$TESTS_EXTRA $test-ansi-stdio"
done
for test in $TESTS_CPP $TESTS_CPP_EXCEPTIONS; do
$arch-w64-mingw32-clang++ $test.cpp -o $TEST_DIR/$test.exe
done
for test in $TESTS_CPP_EXCEPTIONS; do
$arch-w64-mingw32-clang++ $test.cpp -O2 -o $TEST_DIR/$test-opt.exe
done
if [ "$arch" != "aarch64" ] || [ -n "$NATIVE_AARCH64" ]; then
for test in $TESTS_CPP_EXCEPTIONS; do
TESTS_EXTRA="$TESTS_EXTRA $test $test-opt"
done
fi
for test in $TESTS_CPP_LOAD_DLL; do
$arch-w64-mingw32-clang++ $test.cpp -o $TEST_DIR/$test.exe
TESTS_EXTRA="$TESTS_EXTRA $test"
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 target_os in $TARGET_OSES; do
for test in $TESTS_UWP; do
set +e
# compilation should fail for UWP and WinRT
$arch-w64-$target_os-clang $test.c -o $TEST_DIR/$test.exe -Wimplicit-function-declaration -Werror
$arch-w64-$target_os-clang $test.c -o $TEST_DIR/$test-$target_os.exe -Wimplicit-function-declaration -Werror
UWP_ERROR=$?
set -e
case $target_os in
@@ -151,7 +160,7 @@ for arch in $ARCHS; do
;;
*)
if [ $UWP_ERROR -eq 0 ]; then
TESTS_EXTRA="$TESTS_EXTRA $test"
TESTS_EXTRA="$TESTS_EXTRA $test-$target_os"
else
echo "$test failed to compile for non-UWP target!"
exit 1
@@ -159,60 +168,55 @@ for arch in $ARCHS; do
;;
esac
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
if [ "$target_os" != "mingw32" ]; then
# The Windows Store specific CRT DLL is usually not available
# outside of such contexts, so skip trying to run those tests.
continue
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
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
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,$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-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
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
echo All tests succeeded