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