tests/qtest: Fix pxe-test build failure on Win32 due to missing memmem()
PATCH v2 1/1 tests/qtest: Fix pxe-test build failure on Win32 due to missing memmem()
The s390x PXE tests use memmem() to probe the s390-ccw.img firmware for device support strings before running each test. MinGW-w64 does not provide memmem(), breaking the MSYS2/GCC build.
On Win32, skip the bios scan and return true; if the feature is absent the test will time out rather than skip.
--- tests/qtest/pxe-test.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
tests/qtest/pxe-test.c +11 -0
@@ -59,6 +59,7 @@ static testdef_t ppc64_tests_slow[] = { { NULL }, }; +#ifndef _WIN32 static const char *s390_bios_load(gsize *len) { static char *cached_contents;
@@ -106,9 +107,18 @@ out: *len = cached_len; return cached_contents; } +#endif static bool s390_bios_has_string (const char *needle) { +#ifdef _WIN32 +/* +* memmem() is not available on win32; assume the string is present. +* If it is not, the test will timeout instead of detecting missing support. +*/ +g_test_message ("\"%s\" assumed in bios" , needle); +return true; +#else const char *contents;gsize len;bool found;
@@ -118,6 +128,7 @@ static bool s390_bios_has_string(const char *needle)g_test_message ("\"%s\" %s in bios" , needle, found ?"found" :"not found" );return found; +#endif }static bool s390_bios_has_net_ccw (void )
Signature · 1 line
2.56.0
Quoted 4 lines · Zhuoying Cai
The s390x PXE tests use
memmem()to probe the s390-ccw.img firmware for device support strings before running each test. MinGW-w64 does not providememmem(), breaking the MSYS2/GCC build.
Quoted 8 lines
On Win32, skip the bios scan and return true; if the feature is absent the test will time out rather than skip.
Signed-off-by Zhuoying Cai <[email protected]>Reported-by Bernhard Beschow <[email protected]>--- tests/qtest/pxe-test.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
Either this or Yonggang Luo's series works for me...
Quoted 40 lines
tests/qtest/pxe-test.c +11
-0@@ -59,6 +59,7 @@ static testdef_t ppc64_tests_slow[] = { { NULL }, }; +#ifndef _WIN32 static const char *s390_bios_load(gsize *len) { static char *cached_contents;@@ -106,9 +107,18 @@ out: *len = cached_len; return cached_contents; } +#endif static bool s390_bios_has_string (const char *needle) { +#ifdef _WIN32 +/* +* memmem() is not available on win32; assume the string is present. +* If it is not, the test will timeout instead of detecting missing support. +*/ +g_test_message ("\"%s\" assumed in bios" , needle); +return true; +#else const char *contents;gsize len;bool found;@@ -118,6 +128,7 @@ static bool s390_bios_has_string(const char *needle)g_test_message ("\"%s\" %s in bios" , needle, found ?"found" :"not found" );return found; +#endif }static bool s390_bios_has_net_ccw (void )
Hi Eric,
Quoted 16 lines · Eric Farman
Quoted 4 lines · Zhuoying Cai
The s390x PXE tests use
memmem()to probe the s390-ccw.img firmware for device support strings before running each test. MinGW-w64 does not providememmem(), breaking the MSYS2/GCC build.Quoted 8 lines
On Win32, skip the bios scan and return true; if the feature is absent the test will time out rather than skip.
Signed-off-by Zhuoying Cai <[email protected]>Reported-by Bernhard Beschow <[email protected]>---
tests/qtest/pxe-test.c| 11 +++++++++++1 file changed, 11 insertions(+)
Quoted 4 lines
Either this or Yonggang Luo's series works for me...
Tested-by Eric Farman <[email protected]>
I'm pulling Yonggang implementation, which keeps the same behavior on all OS.
Regards,
Pierrick