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