Skip to content

Commit 4f40dd1

Browse files
keith-packardcarlescufi
authored andcommitted
tests/strerror: Remove test for non-standard strerror_r function
Zephyr does not include this function under Rule A.4: C Standard Library Usage Restrictions in Zephyr Kernel, hence a conforming C library need not provide it. Signed-off-by: Keith Packard <[email protected]>
1 parent 57057b1 commit 4f40dd1

File tree

1 file changed

+0
-42
lines changed
  • tests/lib/c_lib/strerror/src

1 file changed

+0
-42
lines changed

tests/lib/c_lib/strerror/src/main.c

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -55,46 +55,4 @@ ZTEST(libc_strerror, test_strerror)
5555
}
5656
}
5757

58-
ZTEST(libc_strerror, test_strerror_r)
59-
{
60-
const char *expected;
61-
char actual[] = {'1', 'n', 'v', 'a', '1', '1', 'd', ' ', 'a',
62-
'2', 'g', 'u', 'm', '3', 'n', '7', 0x00, 0x42};
63-
static const size_t n = sizeof(actual);
64-
65-
if (IS_ENABLED(CONFIG_NEWLIB_LIBC) || IS_ENABLED(CONFIG_ARCMWDT_LIBC)) {
66-
/* FIXME: Please see Issue #46846 */
67-
ztest_test_skip();
68-
}
69-
70-
errno = 4242;
71-
if (IS_ENABLED(CONFIG_MINIMAL_LIBC_DISABLE_STRING_ERROR_TABLE)) {
72-
expected = "";
73-
zassert_equal(0, strerror_r(EINVAL, actual, n), "");
74-
zassert_equal(0, strncmp(expected, actual, n),
75-
"mismatch: exp: %s act: %s", expected, actual);
76-
} else {
77-
expected = "Invalid argument";
78-
zassert_equal(0, strerror_r(EINVAL, actual, n), "%d",
79-
strerror_r(EINVAL, actual, n));
80-
zassert_equal(0, strncmp(expected, actual, n),
81-
"mismatch: exp: %s act: %s", expected, actual);
82-
/* only the necessary buffer area is written */
83-
zassert_equal(0x42, (uint8_t)actual[n - 1],
84-
"exp: %02x act: %02x", 0x42,
85-
(uint8_t)actual[n - 1]);
86-
87-
zassert_equal(ERANGE, strerror_r(EINVAL, actual, 0), "");
88-
}
89-
90-
/* do not change errno on success */
91-
zassert_equal(4242, errno, "");
92-
93-
errno = 0;
94-
zassert_equal(EINVAL, strerror_r(-42, actual, n), "");
95-
zassert_equal(EINVAL, strerror_r(4242, actual, n), "");
96-
/* do not change errno on failure */
97-
zassert_equal(0, errno, "");
98-
}
99-
10058
ZTEST_SUITE(libc_strerror, NULL, NULL, NULL, NULL, NULL);

0 commit comments

Comments
 (0)