Path: blob/main/contrib/libarchive/tar/test/test_format_newc.c
39488 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2012 Michihiro NAKAJIMA4* All rights reserved.5*/6#include "test.h"78DEFINE_TEST(test_format_newc)9{1011assertMakeFile("file1", 0644, "file1");12assertMakeFile("file2", 0644, "file2");13assertMakeHardlink("file3", "file1");1415/* Test 1: Create an archive file with a newc format. */16assertEqualInt(0,17systemf("%s -cf test1.cpio --format newc file1 file2 file3",18testprog));19assertMakeDir("test1", 0755);20assertChdir("test1");21assertEqualInt(0,22systemf("%s -xf ../test1.cpio >test.out 2>test.err", testprog));23assertFileContents("file1", 5, "file1");24assertFileContents("file2", 5, "file2");25assertFileContents("file1", 5, "file3");26assertEmptyFile("test.out");27assertEmptyFile("test.err");28assertChdir("..");2930/* Test 2: Exclude one of hardlinked files. */31assertEqualInt(0,32systemf("%s -cf test2.cpio --format newc file1 file2",33testprog));34assertMakeDir("test2", 0755);35assertChdir("test2");36assertEqualInt(0,37systemf("%s -xf ../test2.cpio >test.out 2>test.err", testprog));38assertFileContents("file1", 5, "file1");39assertFileContents("file2", 5, "file2");40assertFileNotExists("file3");41assertEmptyFile("test.out");42assertEmptyFile("test.err");43assertChdir("..");44}454647