From 0448bd616ae9a7c10fca9404f7c44316e9ad64a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 13 Aug 2018 13:39:02 +0300 Subject: [PATCH] Build tests in a separate subdirectory for each arch This eases cases when testcases contain DLLs, whose names won't contain the arch name. --- Dockerfile.dev | 6 ++++-- run-tests.sh | 23 +++++++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index ceca16e..30ab16a 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -55,8 +55,9 @@ ENV PATH=$TOOLCHAIN_PREFIX/bin:$PATH COPY test/*.c ./test/ RUN cd test && \ for arch in $TOOLCHAIN_ARCHS; do \ + mkdir -p $arch && \ for test in hello hello-tls crt-test setjmp; do \ - $arch-w64-mingw32-clang $test.c -o $test-$arch.exe || exit 1; \ + $arch-w64-mingw32-clang $test.c -o $arch/$test.exe || exit 1; \ done; \ done @@ -68,8 +69,9 @@ RUN ./build-libcxx.sh $TOOLCHAIN_PREFIX COPY test/*.cpp ./test/ RUN cd test && \ for arch in $TOOLCHAIN_ARCHS; do \ + mkdir -p $arch && \ for test in hello-cpp hello-exception tlstest-main; do \ - $arch-w64-mingw32-clang++ $test.cpp -o $test-$arch.exe || exit 1; \ + $arch-w64-mingw32-clang++ $test.cpp -o $arch/$test.exe || exit 1; \ done; \ $arch-w64-mingw32-clang++ tlstest-lib.cpp -shared -o tlstest-lib-$arch.dll || exit 1; \ done diff --git a/run-tests.sh b/run-tests.sh index e970657..a8730ee 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -15,19 +15,24 @@ cd test TESTS_C="hello hello-tls crt-test setjmp" TESTS_C_NO_BUILTIN="crt-test" TESTS_CPP="hello-cpp hello-exception tlstest-main" +TESTS_CPP_DLL="tlstest-lib" for arch in $ARCHS; do + mkdir -p $arch for test in $TESTS_C; do - $arch-w64-mingw32-clang $test.c -o $test-$arch.exe + $arch-w64-mingw32-clang $test.c -o $arch/$test.exe done TESTS_EXTRA="" for test in $TESTS_C_NO_BUILTIN; do - $arch-w64-mingw32-clang $test.c -o $test-no-builtin-$arch.exe -fno-builtin + $arch-w64-mingw32-clang $test.c -o $arch/$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-$arch.exe + $arch-w64-mingw32-clang++ $test.cpp -o $arch/$test.exe done - $arch-w64-mingw32-clang++ tlstest-lib.cpp -shared -o tlstest-lib-$arch.dll + for test in $TESTS_CPP_DLL; do + $arch-w64-mingw32-clang++ $test.cpp -shared -o $arch/$test.dll + done + DLL="$TESTS_CPP_DLL" case $arch in i686|x86_64) RUN=wine @@ -42,12 +47,14 @@ for arch in $ARCHS; do COPY="$COPY_AARCH64" ;; esac - cp tlstest-lib-$arch.dll tlstest-lib.dll + cd $arch if [ -n "$COPY" ]; then - $COPY tlstest-lib.dll + for i in $DLL; do + $COPY $i.dll + done fi for test in $TESTS_C $TESTS_CPP $TESTS_EXTRA; do - file=$test-$arch.exe + file=$test.exe if [ -n "$COPY" ]; then $COPY $file fi @@ -55,5 +62,5 @@ for arch in $ARCHS; do $RUN $file fi done - rm -f tlstest-lib.dll + cd .. done