1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2016 Tim Kientzle
5 * All rights reserved.
6 */
7 #include "test.h"
8
DEFINE_TEST(test_missing_file)9 DEFINE_TEST(test_missing_file)
10 {
11 int r;
12
13 assertMakeFile("file1", 0644, "file1");
14 assertMakeFile("file2", 0644, "file2");
15
16 assertMakeFile("filelist1", 0644, "file1\nfile2\n");
17 r = systemf("%s -o <filelist1 >stdout1 2>stderr1", testprog);
18 assertEqualInt(r, 0);
19 assertTextFileContents("1 block\n", "stderr1");
20
21 assertMakeFile("filelist2", 0644, "file1\nfile2\nfile3\n");
22 r = systemf("%s -o <filelist2 >stdout2 2>stderr2", testprog);
23 assert(r != 0);
24
25 assertMakeFile("filelist3", 0644, "");
26 r = systemf("%s -o <filelist3 >stdout3 2>stderr3", testprog);
27 assertEqualInt(r, 0);
28 assertTextFileContents("1 block\n", "stderr3");
29
30 assertMakeFile("filelist4", 0644, "file3\n");
31 r = systemf("%s -o <filelist4 >stdout4 2>stderr4", testprog);
32 assert(r != 0);
33 }
34