]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-serialize: allocate long_string dynamically
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 26 Oct 2018 11:17:44 +0000 (13:17 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 26 Oct 2018 11:17:44 +0000 (13:17 +0200)
src/test/test-serialize.c

index 5959455411999ba8c65ae5d2db12cff4f1012ccb..e38b48fdbc3b4e519d1c2d251c2c7c97fa9f3684 100644 (file)
 #include "strv.h"
 #include "tests.h"
 
-#define sixteen(x) x x x x x x x x x x x x x x x x
-#define million(x) sixteen(sixteen(sixteen(sixteen(sixteen(x)))))
-
-#define long_string million("x")
-assert_cc(STRLEN(long_string) == LONG_LINE_MAX);
+char long_string[LONG_LINE_MAX+1];
 
 static void test_serialize_item(void) {
         _cleanup_(unlink_tempfilep) char fn[] = "/tmp/test-serialize.XXXXXX";
@@ -140,6 +136,9 @@ static void test_serialize_strv(void) {
 int main(int argc, char *argv[]) {
         test_setup_logging(LOG_INFO);
 
+        memset(long_string, 'x', sizeof(long_string)-1);
+        char_array_0(long_string);
+
         test_serialize_item();
         test_serialize_item_escaped();
         test_serialize_usec();