diff options
-rw-r--r-- | test/build.mk | 3 | ||||
-rw-r--r-- | test/stdlib.c | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/test/build.mk b/test/build.mk index afe46453e0..e7cc18d2e8 100644 --- a/test/build.mk +++ b/test/build.mk @@ -91,6 +91,9 @@ test-list-host += sha256_unrolled test-list-host += shmalloc test-list-host += static_if test-list-host += static_if_error +# TODO(b/237823627): When building for the host, we're linking against the +# toolchain's C standard library, so these tests are actually testing the +# toolchain's C standard library. test-list-host += stdlib test-list-host += system test-list-host += thermal diff --git a/test/stdlib.c b/test/stdlib.c index 4d9a4d6f87..cd018af09b 100644 --- a/test/stdlib.c +++ b/test/stdlib.c @@ -120,7 +120,15 @@ static int test_strncpy(void) TEST_ASSERT_ARRAY_EQ("test", dest, 5); strncpy(dest, "12345", 6); TEST_ASSERT_ARRAY_EQ("12345", dest, 6); + /* + * gcc complains: + * error: ‘__builtin_strncpy’ output truncated copying 10 bytes from a + * string of length 12 [-Werror=stringop-truncation] + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy(dest, "testtesttest", 10); +#pragma GCC diagnostic pop TEST_ASSERT_ARRAY_EQ("testtestte", dest, 10); return EC_SUCCESS; |