test_extract_tar_lz4.c revision 302001
11539Srgrimes/*-
21539Srgrimes * Copyright (c) 2012,2014 Michihiro NAKAJIMA
31539Srgrimes * All rights reserved.
41539Srgrimes *
51539Srgrimes * Redistribution and use in source and binary forms, with or without
61539Srgrimes * modification, are permitted provided that the following conditions
71539Srgrimes * are met:
81539Srgrimes * 1. Redistributions of source code must retain the above copyright
91539Srgrimes *    notice, this list of conditions and the following disclaimer.
101539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111539Srgrimes *    notice, this list of conditions and the following disclaimer in the
121539Srgrimes *    documentation and/or other materials provided with the distribution.
13203964Simp *
141539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
151539Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
161539Srgrimes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
171539Srgrimes * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
181539Srgrimes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
191539Srgrimes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
201539Srgrimes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
211539Srgrimes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
221539Srgrimes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
231539Srgrimes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
241539Srgrimes */
251539Srgrimes#include "test.h"
261539Srgrimes__FBSDID("$FreeBSD: stable/10/contrib/libarchive/tar/test/test_extract_tar_lz4.c 302001 2016-06-17 22:40:10Z mm $");
271539Srgrimes
281539SrgrimesDEFINE_TEST(test_extract_tar_lz4)
291539Srgrimes{
3067708Sphk	const char *reffile = "test_extract.tar.lz4";
3167708Sphk	int f;
321539Srgrimes
331539Srgrimes	extract_reference_file(reffile);
341539Srgrimes	f = systemf("%s -tf %s >test.out 2>test.err", testprog, reffile);
351539Srgrimes	if (f == 0 || canLz4()) {
361539Srgrimes		assertEqualInt(0, systemf("%s -xf %s >test.out 2>test.err",
3799594Smike		    testprog, reffile));
38123257Smarcel
39102227Smike		assertFileExists("file1");
401539Srgrimes		assertTextFileContents("contents of file1.\n", "file1");
41102227Smike		assertFileExists("file2");
421539Srgrimes		assertTextFileContents("contents of file2.\n", "file2");
43102777Smike		assertEmptyFile("test.out");
44102227Smike		assertEmptyFile("test.err");
45102227Smike	} else {
46102227Smike		skipping("It seems lz4 is not supported on this platform");
4715483Sbde	}
4815483Sbde}
4915483Sbde