xref: /freebsd/contrib/libarchive/tar/test/test_empty_mtree.c (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2003-2009 Tim Kientzle
5  * All rights reserved.
6  */
7 #include "test.h"
8 
9 /*
10  * Regression test:  We used to get a bogus error message when we
11  * asked tar to copy entries out of an empty archive.  See
12  * Issue 51 on libarchive.googlecode.com for details.
13  */
14 DEFINE_TEST(test_empty_mtree)
15 {
16 	int r;
17 
18 	assertMakeFile("test1.mtree", 0777, "#mtree\n");
19 
20 	r = systemf("%s cf test1.tar @test1.mtree >test1.out 2>test1.err",
21 	    testprog);
22 	failure("Error invoking %s cf", testprog);
23 	assertEqualInt(r, 0);
24 	assertEmptyFile("test1.out");
25 	assertEmptyFile("test1.err");
26 }
27