xref: /freebsd/contrib/libarchive/cpio/test/test_extract_cpio_bz2.c (revision bd66c1b43e33540205dbc1187c2f2a15c58b57ba)
1acc60b03SMartin Matuska /*-
2*bd66c1b4SMartin Matuska  * SPDX-License-Identifier: BSD-2-Clause
3*bd66c1b4SMartin Matuska  *
4acc60b03SMartin Matuska  * Copyright (c) 2012 Michihiro NAKAJIMA
5acc60b03SMartin Matuska  * All rights reserved.
6acc60b03SMartin Matuska  */
7acc60b03SMartin Matuska #include "test.h"
8acc60b03SMartin Matuska 
DEFINE_TEST(test_extract_cpio_bz2)9acc60b03SMartin Matuska DEFINE_TEST(test_extract_cpio_bz2)
10acc60b03SMartin Matuska {
11acc60b03SMartin Matuska 	const char *reffile = "test_extract.cpio.bz2";
12acc60b03SMartin Matuska 	int f;
13acc60b03SMartin Matuska 
14acc60b03SMartin Matuska 	extract_reference_file(reffile);
15acc60b03SMartin Matuska 	f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
16acc60b03SMartin Matuska 	if (f == 0 || canBzip2()) {
17acc60b03SMartin Matuska 		assertEqualInt(0, systemf("%s -i < %s >test.out 2>test.err",
18acc60b03SMartin Matuska 		    testprog, reffile));
19acc60b03SMartin Matuska 
20acc60b03SMartin Matuska 		assertFileExists("file1");
21acc60b03SMartin Matuska 		assertTextFileContents("contents of file1.\n", "file1");
22acc60b03SMartin Matuska 		assertFileExists("file2");
23acc60b03SMartin Matuska 		assertTextFileContents("contents of file2.\n", "file2");
24acc60b03SMartin Matuska 		assertEmptyFile("test.out");
25acc60b03SMartin Matuska 		assertTextFileContents("1 block\n", "test.err");
26acc60b03SMartin Matuska 	} else {
27acc60b03SMartin Matuska 		skipping("It seems bzip2 is not supported on this platform");
28acc60b03SMartin Matuska 	}
29acc60b03SMartin Matuska }
30