diff --git a/run-tests.sh b/run-tests.sh index 901dfbe..1f985b7 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -38,6 +38,7 @@ TESTS_CPP_DLL="tlstest-lib" TESTS_SSP="stacksmash" TESTS_ASAN="stacksmash" TESTS_UBSAN="ubsan" +TESTS_UWP="uwp-error" for arch in $ARCHS; do case $arch in i686|x86_64) @@ -92,6 +93,29 @@ for arch in $ARCHS; do 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_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 + UWP_ERROR=$? + set -e + case $target_os in + mingw32uwp) + if [ $UWP_ERROR -eq 0 ]; then + echo "UWP compilation should have failed for test $test!" + exit 1 + fi + ;; + *) + if [ $UWP_ERROR -eq 0 ]; then + TESTS_EXTRA="$TESTS_EXTRA $test" + else + echo "$test failed to compile for non-UWP target!" + exit 1 + fi + ;; + esac + done for test in $TESTS_ASAN; do case $arch in # Sanitizers on windows only support x86. diff --git a/test/uwp-error.c b/test/uwp-error.c new file mode 100644 index 0000000..364dd36 --- /dev/null +++ b/test/uwp-error.c @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2019 Steve Lhomme + * + * 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. + */ + +#include +#include + +int main(int argc, char *argv[]) { + UINT res = GetOEMCP(); + fprintf(stderr, "Windows OEM CP is %u\n", res); + return 0; +}