1251881Speter/*- 2251881Speter * Copyright (c) 2012 Michihiro NAKAJIMA 3251881Speter * All rights reserved. 4251881Speter * 5251881Speter * Redistribution and use in source and binary forms, with or without 6251881Speter * modification, are permitted provided that the following conditions 7251881Speter * are met: 8251881Speter * 1. Redistributions of source code must retain the above copyright 9251881Speter * notice, this list of conditions and the following disclaimer. 10251881Speter * 2. Redistributions in binary form must reproduce the above copyright 11251881Speter * notice, this list of conditions and the following disclaimer in the 12251881Speter * documentation and/or other materials provided with the distribution. 13251881Speter * 14251881Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15251881Speter * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16251881Speter * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17251881Speter * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18251881Speter * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19251881Speter * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20251881Speter * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21251881Speter * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22251881Speter * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23251881Speter * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24251881Speter */ 25251881Speter#include "test.h" 26251881Speter 27251881SpeterDEFINE_TEST(test_extract_cpio_lzma) 28251881Speter{ 29251881Speter const char *reffile = "test_extract.cpio.lzma"; 30251881Speter int f; 31251881Speter 32251881Speter extract_reference_file(reffile); 33251881Speter f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile); 34251881Speter if (f == 0 || canLzma()) { 35251881Speter assertEqualInt(0, systemf("%s -i < %s >test.out 2>test.err", 36251881Speter testprog, reffile)); 37251881Speter 38251881Speter assertFileExists("file1"); 39251881Speter assertTextFileContents("contents of file1.\n", "file1"); 40251881Speter assertFileExists("file2"); 41251881Speter assertTextFileContents("contents of file2.\n", "file2"); 42251881Speter assertEmptyFile("test.out"); 43251881Speter assertTextFileContents("1 block\n", "test.err"); 44251881Speter } else { 45251881Speter skipping("It seems lzma is not supported on this platform"); 46251881Speter } 47251881Speter} 48251881Speter