xref: /freebsd/contrib/libarchive/cat/test/test_expand_lz4.c (revision cdf63a700c77204252e3c2e38d7106965559f3c6)
1*cdf63a70SMartin Matuska /*-
2*cdf63a70SMartin Matuska  * Copyright (c) 2014 Mike Kazantsev
3*cdf63a70SMartin Matuska  * Copyright (c) 2012, 2014 Michihiro NAKAJIMA
4*cdf63a70SMartin Matuska  * All rights reserved.
5*cdf63a70SMartin Matuska  *
6*cdf63a70SMartin Matuska  * Redistribution and use in source and binary forms, with or without
7*cdf63a70SMartin Matuska  * modification, are permitted provided that the following conditions
8*cdf63a70SMartin Matuska  * are met:
9*cdf63a70SMartin Matuska  * 1. Redistributions of source code must retain the above copyright
10*cdf63a70SMartin Matuska  *    notice, this list of conditions and the following disclaimer.
11*cdf63a70SMartin Matuska  * 2. Redistributions in binary form must reproduce the above copyright
12*cdf63a70SMartin Matuska  *    notice, this list of conditions and the following disclaimer in the
13*cdf63a70SMartin Matuska  *    documentation and/or other materials provided with the distribution.
14*cdf63a70SMartin Matuska  *
15*cdf63a70SMartin Matuska  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16*cdf63a70SMartin Matuska  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17*cdf63a70SMartin Matuska  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18*cdf63a70SMartin Matuska  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19*cdf63a70SMartin Matuska  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20*cdf63a70SMartin Matuska  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*cdf63a70SMartin Matuska  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*cdf63a70SMartin Matuska  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*cdf63a70SMartin Matuska  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24*cdf63a70SMartin Matuska  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*cdf63a70SMartin Matuska  */
26*cdf63a70SMartin Matuska #include "test.h"
27*cdf63a70SMartin Matuska 
28*cdf63a70SMartin Matuska DEFINE_TEST(test_expand_lz4)
29*cdf63a70SMartin Matuska {
30*cdf63a70SMartin Matuska 	const char *reffile = "test_expand.lz4";
31*cdf63a70SMartin Matuska 	int f;
32*cdf63a70SMartin Matuska 
33*cdf63a70SMartin Matuska 	extract_reference_file(reffile);
34*cdf63a70SMartin Matuska 	f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
35*cdf63a70SMartin Matuska 	if (f == 0 || canLz4()) {
36*cdf63a70SMartin Matuska 		assertEqualInt(0, f);
37*cdf63a70SMartin Matuska 		assertTextFileContents("contents of test_expand.lz4.\n", "test.out");
38*cdf63a70SMartin Matuska 		assertEmptyFile("test.err");
39*cdf63a70SMartin Matuska 	} else {
40*cdf63a70SMartin Matuska 		skipping("It seems lz4 is not supported on this platform");
41*cdf63a70SMartin Matuska 	}
42*cdf63a70SMartin Matuska }
43