test: Prepare the test scripts for testing native Windows tools via WSL
Use the TOOLEXT variable in run-tests.sh in the same way as in the Makefile. The Makefile sets this variable automatically if invoked by mingw32-make, but if running run-tests.sh in WSL with native Windows compilers, then we need to set TOOLEXT manually when calling run-tests.sh. Allow skipping the cfguard failure tests when run in such a configuration, since Linux make in WSL can't easily run cmd.exe like in MSYS2.
This commit is contained in:
1 parent
9d96e5745f
commit
241a1cd148
2 files changed
+7
-3
No files matched your search
+3
-3
@@ -52,14 +52,14 @@ cat<<EOF > is-ucrt.c
|
|||||||
#endif
|
#endif
|
||||||
EOF
|
EOF
|
||||||
ANY_ARCH=$(echo $ARCHS | awk '{print $1}')
|
ANY_ARCH=$(echo $ARCHS | awk '{print $1}')
|
||||||
if ! $ANY_ARCH-w64-mingw32-gcc -E is-ucrt.c > /dev/null 2>&1; then
|
if ! $ANY_ARCH-w64-mingw32-gcc$TOOLEXT -E is-ucrt.c > /dev/null 2>&1; then
|
||||||
# If the default CRT isn't UCRT, we can't build for mingw32uwp.
|
# If the default CRT isn't UCRT, we can't build for mingw32uwp.
|
||||||
unset HAVE_UWP
|
unset HAVE_UWP
|
||||||
fi
|
fi
|
||||||
rm -f is-ucrt.c
|
rm -f is-ucrt.c
|
||||||
|
|
||||||
if (echo "int main(){}" | $ANY_ARCH-w64-mingw32-clang -x c++ - -o has-cfguard-test.exe -mguard=cf); then
|
if (echo "int main(){}" | $ANY_ARCH-w64-mingw32-clang$TOOLEXT -x c++ - -o has-cfguard-test.exe -mguard=cf); then
|
||||||
if llvm-readobj --coff-load-config has-cfguard-test.exe | grep -q 'CF_INSTRUMENTED (0x100)'; then
|
if llvm-readobj$TOOLEXT --coff-load-config has-cfguard-test.exe | grep -q 'CF_INSTRUMENTED (0x100)'; then
|
||||||
HAVE_CFGUARD=1
|
HAVE_CFGUARD=1
|
||||||
elif [ -n "$HAVE_CFGUARD" ]; then
|
elif [ -n "$HAVE_CFGUARD" ]; then
|
||||||
echo "error: Toolchain doesn't seem to include Control Flow Guard support." 1>&2
|
echo "error: Toolchain doesn't seem to include Control Flow Guard support." 1>&2
|
||||||
|
|||||||
@@ -252,8 +252,12 @@ ifeq ($(CMD),)
|
|||||||
FAILURE_TEST_TARGETS = $(addprefix .failtested., $(FAILURE_TESTS))
|
FAILURE_TEST_TARGETS = $(addprefix .failtested., $(FAILURE_TESTS))
|
||||||
CUSTOM1_FAILURE_TEST_TARGETS = .customtest1.bufferoverflow-fortify$(EXEEXT)
|
CUSTOM1_FAILURE_TEST_TARGETS = .customtest1.bufferoverflow-fortify$(EXEEXT)
|
||||||
ifneq ($(HAVE_CFGUARD),)
|
ifneq ($(HAVE_CFGUARD),)
|
||||||
|
ifeq ($(WSL),)
|
||||||
|
# These tests do special calling of cmd.exe, which don't quite
|
||||||
|
# work when running with Linux make in WSL.
|
||||||
CUSTOM2_FAILURE_TEST_TARGETS = .customtest2.cfguard-test$(EXEEXT)
|
CUSTOM2_FAILURE_TEST_TARGETS = .customtest2.cfguard-test$(EXEEXT)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user