1248590Smm/*-
2248590Smm * Copyright (c) 2012 Michihiro NAKAJIMA
3248590Smm * All rights reserved.
4248590Smm *
5248590Smm * Redistribution and use in source and binary forms, with or without
6248590Smm * modification, are permitted provided that the following conditions
7248590Smm * are met:
8248590Smm * 1. Redistributions of source code must retain the above copyright
9248590Smm *    notice, this list of conditions and the following disclaimer.
10248590Smm * 2. Redistributions in binary form must reproduce the above copyright
11248590Smm *    notice, this list of conditions and the following disclaimer in the
12248590Smm *    documentation and/or other materials provided with the distribution.
13248590Smm *
14248590Smm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15248590Smm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16248590Smm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17248590Smm * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18248590Smm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19248590Smm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20248590Smm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21248590Smm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22248590Smm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23248590Smm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24248590Smm */
25248590Smm#include "test.h"
26248590Smm__FBSDID("$FreeBSD$");
27248590Smm
28248590SmmDEFINE_TEST(test_extract_cpio_lzma)
29248590Smm{
30248590Smm	const char *reffile = "test_extract.cpio.lzma";
31248590Smm	int f;
32248590Smm
33248590Smm	extract_reference_file(reffile);
34248590Smm	f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
35248590Smm	if (f == 0 || canLzma()) {
36248590Smm		assertEqualInt(0, systemf("%s -i < %s >test.out 2>test.err",
37248590Smm		    testprog, reffile));
38248590Smm
39248590Smm		assertFileExists("file1");
40248590Smm		assertTextFileContents("contents of file1.\n", "file1");
41248590Smm		assertFileExists("file2");
42248590Smm		assertTextFileContents("contents of file2.\n", "file2");
43248590Smm		assertEmptyFile("test.out");
44248590Smm		assertTextFileContents("1 block\n", "test.err");
45248590Smm	} else {
46248590Smm		skipping("It seems lzma is not supported on this platform");
47248590Smm	}
48248590Smm}
49