1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2011 Michihiro NAKAJIMA
5 * All rights reserved.
6 */
7 #include "test.h"
8
DEFINE_TEST(test_print_longpath)9 DEFINE_TEST(test_print_longpath)
10 {
11 const char *reffile = "test_print_longpath.tar.Z";
12 char buff[2048];
13 int i, j, k;
14
15 /* Reference file has one entry "file" with a very old timestamp. */
16 extract_reference_file(reffile);
17
18 /* Build long path pattern. */
19 memset(buff, 0, sizeof(buff));
20 for (k = 0; k < 4; k++) {
21 for (j = 0; j < k+1; j++) {
22 for (i = 0; i < 10; i++)
23 strncat(buff, "0123456789",
24 sizeof(buff) - strlen(buff) -1);
25 strncat(buff, "/", sizeof(buff) - strlen(buff) -1);
26 }
27 strncat(buff, "\n", sizeof(buff) - strlen(buff) -1);
28 }
29 buff[sizeof(buff)-1] = '\0';
30
31 assertEqualInt(0,
32 systemf("%s -tf %s >test.out 2>test.err", testprog, reffile));
33 assertTextFileContents(buff, "test.out");
34 assertEmptyFile("test.err");
35 }
36