diff mbox series

[v2,2/2] selftests/harness: Use 1024 in place of LINE_MAX

Message ID 20240509053113.43462-3-tao1.su@linux.intel.com (mailing list archive)
State Accepted
Commit 28d2188709d9c19a7c4601c6870edd9fa0527379
Headers show
Series Selftests: Fix compilation warnings due to missing _GNU_SOURCE definition | expand

Commit Message

Tao Su May 9, 2024, 5:31 a.m. UTC
Android was seeing a compilation error because its C library does not
define LINE_MAX. Since LINE_MAX is only used to determine the size of
test_name[] and 1024 should be enough for the test name, use 1024
instead of LINE_MAX.

Fixes: 38c957f07038 ("selftests: kselftest_harness: generate test name once")
Signed-off-by: Tao Su <tao1.su@linux.intel.com>
---
 tools/testing/selftests/kselftest_harness.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Simon Horman May 10, 2024, 12:33 p.m. UTC | #1
On Thu, May 09, 2024 at 01:31:13PM +0800, Tao Su wrote:
> Android was seeing a compilation error because its C library does not
> define LINE_MAX. Since LINE_MAX is only used to determine the size of
> test_name[] and 1024 should be enough for the test name, use 1024
> instead of LINE_MAX.
> 
> Fixes: 38c957f07038 ("selftests: kselftest_harness: generate test name once")
> Signed-off-by: Tao Su <tao1.su@linux.intel.com>

Reviewed-by: Simon Horman <horms@kernel.org>
diff mbox series

Patch

diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index ba3ddeda24bf..610642f50977 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -56,7 +56,6 @@ 
 #include <asm/types.h>
 #include <ctype.h>
 #include <errno.h>
-#include <limits.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -1159,7 +1158,7 @@  void __run_test(struct __fixture_metadata *f,
 		struct __test_metadata *t)
 {
 	struct __test_xfail *xfail;
-	char test_name[LINE_MAX];
+	char test_name[1024];
 	const char *diagnostic;
 
 	/* reset test struct */