[PATCH v2 0/2] MR4071: msvcrt/tests: Add tests for wcsdup.
These tests are to resolve the concerns about relying on the tested behaviors, that were brought up at <https://gitlab.winehq.org/wine/wine/-/merge_requests/4060#note_48218>. -- v2: msvcrt/tests: Add tests for wcsdup. msvcrt/tests: Check errno after strdup(NULL). https://gitlab.winehq.org/wine/wine/-/merge_requests/4071
From: Alex Henrie <alexhenrie24(a)gmail.com> --- dlls/msvcrt/tests/string.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 6a9dc23d4f0..10c7fea4439 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -642,10 +642,11 @@ static void test_mbsspnp( void) static void test_strdup(void) { - char *str; - str = _strdup( 0 ); - ok( str == 0, "strdup returns %s should be 0\n", str); - free( str ); + char *str; + errno = 0xdeadbeef; + str = strdup(0); + ok(str == 0, "strdup returned %s, expected NULL\n", wine_dbgstr_a(str)); + ok(errno == 0xdeadbeef, "errno is %d, expected 0xdeadbeef\n", errno); } static void test_strcmp(void) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4071
From: Alex Henrie <alexhenrie24(a)gmail.com> --- dlls/msvcrt/tests/string.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 10c7fea4439..cdc19736832 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -649,6 +649,15 @@ static void test_strdup(void) ok(errno == 0xdeadbeef, "errno is %d, expected 0xdeadbeef\n", errno); } +static void test_wcsdup(void) +{ + WCHAR *str; + errno = 0xdeadbeef; + str = wcsdup(0); + ok(str == 0, "wcsdup returned %s, expected NULL\n", wine_dbgstr_w(str)); + ok(errno == 0xdeadbeef, "errno is %d, expected 0xdeadbeef\n", errno); +} + static void test_strcmp(void) { int ret = p_strcmp( "abc", "abcd" ); @@ -4705,6 +4714,7 @@ START_TEST(string) test_mbsspn(); test_mbsspnp(); test_strdup(); + test_wcsdup(); test_strcmp(); test_strcpy_s(); test_memcpy_s(); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4071
Alex Henrie <wine(a)gitlab.winehq.org> wrote:
+static void test_wcsdup(void) +{ + WCHAR *str; + errno = 0xdeadbeef; + str = wcsdup(0);
Please use NULL instead of 0.
+ ok(str == 0, "wcsdup returned %s, expected NULL\n", wine_dbgstr_w(str));
Same here, these are pointers. -- Dmitry.
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=138694 Your paranoid android. === build (build log) === error: patch failed: dlls/msvcrt/tests/string.c:649 Task: Patch failed to apply === debian11 (build log) === error: patch failed: dlls/msvcrt/tests/string.c:649 Task: Patch failed to apply === debian11b (build log) === error: patch failed: dlls/msvcrt/tests/string.c:649 Task: Patch failed to apply
On Wed Oct 11 15:21:36 2023 +0000, Piotr Caban wrote:
Please set errno before calling `wcsdup(0)`. Sorry, that was a stupid mistake. It's fixed now.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4071#note_48366
This merge request was approved by Piotr Caban. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4071
participants (5)
-
Alex Henrie -
Alex Henrie (@alexhenrie) -
Dmitry Timoshkov -
Marvin -
Piotr Caban (@piotr)