1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 02:21:44 +03:00

test-serialize: allocate long_string dynamically

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-10-26 13:17:44 +02:00
parent 40a4c4b38d
commit fa2951def7

View File

@ -10,11 +10,7 @@
#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();