MCPcopy Create free account
hub / github.com/ElementsProject/lightning / main

Function main

cli/test/run-large-input.c:95–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93#define TAILER "] } }"
94
95int main(int argc UNUSED, char *argv[])
96{
97 common_setup(argv[0]);
98
99 char *fake_argv[] = { argv[0], "--lightning-dir=/tmp/", "test", "-N", "none", NULL };
100
101 /* sizeof() is an overestimate, but we don't care. */
102 response = tal_arr(NULL, char,
103 sizeof(HEADER)
104 + sizeof(LOG_ENTRY) * NUM_ENTRIES
105 + sizeof(TAILER));
106
107 strcpy(response, HEADER);
108 response_off = strlen(HEADER);
109
110 /* Append a huge log */
111 for (size_t i = 0; i < NUM_ENTRIES; i++) {
112 memcpy(response + response_off, LOG_ENTRY, sizeof(LOG_ENTRY)-1);
113 response_off += sizeof(LOG_ENTRY)-1;
114 }
115
116 memcpy(response + response_off, TAILER, sizeof(TAILER)-1);
117 response_off += sizeof(TAILER)-1;
118 response[response_off++] = '\0';
119 assert(strlen(response) == response_off - 1);
120 assert(response_off < tal_count(response));
121
122 response_off = 0;
123 max_read_return = -1;
124 assert(test_main(5, fake_argv) == 0);
125 tal_free(response);
126 common_shutdown();
127 return 0;
128}

Callers

nothing calls this directly

Calls 3

common_setupFunction · 0.85
tal_freeFunction · 0.85
common_shutdownFunction · 0.85

Tested by

no test coverage detected