1324145Smm/*-
2324145Smm * Copyright (c) 2017 Sean Purcell
3324145Smm * All rights reserved.
4324145Smm *
5324145Smm * Redistribution and use in source and binary forms, with or without
6324145Smm * modification, are permitted provided that the following conditions
7324145Smm * are met:
8324145Smm * 1. Redistributions of source code must retain the above copyright
9324145Smm *    notice, this list of conditions and the following disclaimer.
10324145Smm * 2. Redistributions in binary form must reproduce the above copyright
11324145Smm *    notice, this list of conditions and the following disclaimer in the
12324145Smm *    documentation and/or other materials provided with the distribution.
13324145Smm *
14324145Smm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15324145Smm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16324145Smm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17324145Smm * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18324145Smm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19324145Smm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20324145Smm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21324145Smm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22324145Smm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23324145Smm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24324145Smm */
25324145Smm#include "test.h"
26324145Smm__FBSDID("$FreeBSD: stable/11/contrib/libarchive/cpio/test/test_extract_cpio_zstd.c 324417 2017-10-08 20:54:53Z mm $");
27324145Smm
28324145SmmDEFINE_TEST(test_extract_cpio_zstd)
29324145Smm{
30324145Smm	const char *reffile = "test_extract.cpio.zst";
31324145Smm	int f;
32324145Smm
33324145Smm	extract_reference_file(reffile);
34324145Smm	f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
35324145Smm	if (f == 0 || canZstd()) {
36324145Smm		assertEqualInt(0, systemf("%s -i < %s >test.out 2>test.err",
37324145Smm		    testprog, reffile));
38324145Smm
39324145Smm		assertFileExists("file1");
40324145Smm		assertTextFileContents("contents of file1.\n", "file1");
41324145Smm		assertFileExists("file2");
42324145Smm		assertTextFileContents("contents of file2.\n", "file2");
43324145Smm		assertEmptyFile("test.out");
44324145Smm		assertTextFileContents("1 block\n", "test.err");
45324145Smm	} else {
46324145Smm		skipping("It seems zstd is not supported on this platform");
47324145Smm	}
48324145Smm}
49