test_extract_cpio_lzma.c revision 256281
11573Srgrimes/*- 2290494Sbapt * Copyright (c) 2012 Michihiro NAKAJIMA 3290494Sbapt * All rights reserved. 4128004Stjr * 51573Srgrimes * Redistribution and use in source and binary forms, with or without 61573Srgrimes * modification, are permitted provided that the following conditions 71573Srgrimes * are met: 81573Srgrimes * 1. Redistributions of source code must retain the above copyright 91573Srgrimes * notice, this list of conditions and the following disclaimer. 101573Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 11227753Stheraven * notice, this list of conditions and the following disclaimer in the 12227753Stheraven * documentation and/or other materials provided with the distribution. 13227753Stheraven * 14227753Stheraven * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15227753Stheraven * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 161573Srgrimes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 171573Srgrimes * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 181573Srgrimes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 191573Srgrimes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 201573Srgrimes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 211573Srgrimes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 221573Srgrimes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 231573Srgrimes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24290494Sbapt */ 251573Srgrimes#include "test.h" 261573Srgrimes__FBSDID("$FreeBSD$"); 271573Srgrimes 281573SrgrimesDEFINE_TEST(test_extract_cpio_lzma) 291573Srgrimes{ 301573Srgrimes const char *reffile = "test_extract.cpio.lzma"; 311573Srgrimes int f; 321573Srgrimes 331573Srgrimes extract_reference_file(reffile); 341573Srgrimes f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile); 351573Srgrimes if (f == 0 || canLzma()) { 361573Srgrimes assertEqualInt(0, systemf("%s -i < %s >test.out 2>test.err", 371573Srgrimes testprog, reffile)); 381573Srgrimes 391573Srgrimes assertFileExists("file1"); 401573Srgrimes assertTextFileContents("contents of file1.\n", "file1"); 411573Srgrimes assertFileExists("file2"); 421573Srgrimes assertTextFileContents("contents of file2.\n", "file2"); 431573Srgrimes assertEmptyFile("test.out"); 44128004Stjr assertTextFileContents("1 block\n", "test.err"); 4592986Sobrien } else { 461573Srgrimes skipping("It seems lzma is not supported on this platform"); 471573Srgrimes } 48128004Stjr} 49121893Stjr