[dpdk-dev] [PATCH 2/3] test: remove no longer valid tests
Stephen Hemminger
stephen at networkplumber.org
Tue Jun 24 18:03:45 CEST 2014
Since GCC catches calling snprintf() with NULL argument at compile time
(which is even better). These string function tests are unnecessary
and no longer compile.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
--- a/app/test/test_string_fns.c 2014-06-24 08:48:52.558007950 -0700
+++ b/app/test/test_string_fns.c 2014-06-24 08:48:52.558007950 -0700
@@ -149,32 +149,6 @@ test_snprintf(void)
return -1;
}
- memset(buf, DATA_BYTE, sizeof(buf));
- /* call with a NULL format and zero-size should return error
- * without affecting the buffer */
- if (snprintf(buf, 0, NULL) != -1 ||
- errno != EINVAL) {
- LOG("Failed to get suitable error when passing NULL buffer\n");
- return -1;
- }
- if (buf[0] != DATA_BYTE) {
- LOG("Error, zero-length buffer modified after call with NULL"
- " format string\n");
- return -1;
- }
-
- /* call with a NULL format should return error but also null-terminate
- * the buffer */
- if (snprintf(buf, sizeof(buf), NULL) != -1 ||
- errno != EINVAL) {
- LOG("Failed to get suitable error when passing NULL buffer\n");
- return -1;
- }
- if (buf[0] != '\0') {
- LOG("Error, buffer not null-terminated after call with NULL"
- " format string\n");
- return -1;
- }
} while (0);
LOG("%s - PASSED\n", __func__);
More information about the dev
mailing list