test_extract_cpio_gz.c revision 256281
1236769Sobrien/*- 2236769Sobrien * Copyright (c) 2012 Michihiro NAKAJIMA 3236769Sobrien * All rights reserved. 4236769Sobrien * 5236769Sobrien * Redistribution and use in source and binary forms, with or without 6236769Sobrien * modification, are permitted provided that the following conditions 7236769Sobrien * are met: 8236769Sobrien * 1. Redistributions of source code must retain the above copyright 9236769Sobrien * notice, this list of conditions and the following disclaimer. 10236769Sobrien * 2. Redistributions in binary form must reproduce the above copyright 11236769Sobrien * notice, this list of conditions and the following disclaimer in the 12236769Sobrien * documentation and/or other materials provided with the distribution. 13236769Sobrien * 14236769Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15236769Sobrien * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16236769Sobrien * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17236769Sobrien * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18236769Sobrien * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19236769Sobrien * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20236769Sobrien * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21236769Sobrien * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22236769Sobrien * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23236769Sobrien * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24236769Sobrien */ 25236769Sobrien#include "test.h" 26236769Sobrien__FBSDID("$FreeBSD$"); 27236769Sobrien 28236769SobrienDEFINE_TEST(test_extract_cpio_gz) 29236769Sobrien{ 30236769Sobrien const char *reffile = "test_extract.cpio.gz"; 31236769Sobrien int f; 32236769Sobrien 33236769Sobrien extract_reference_file(reffile); 34236769Sobrien f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile); 35236769Sobrien if (f == 0 || canGzip()) { 36236769Sobrien assertEqualInt(0, systemf("%s -i < %s >test.out 2>test.err", 37236769Sobrien testprog, reffile)); 38236769Sobrien 39236769Sobrien assertFileExists("file1"); 40236769Sobrien assertTextFileContents("contents of file1.\n", "file1"); 41236769Sobrien assertFileExists("file2"); 42236769Sobrien assertTextFileContents("contents of file2.\n", "file2"); 43236769Sobrien assertEmptyFile("test.out"); 44236769Sobrien assertTextFileContents("1 block\n", "test.err"); 45236769Sobrien } else { 46236769Sobrien skipping("It seems gzip is not supported on this platform"); 47236769Sobrien } 48236769Sobrien} 49236769Sobrien