Path: blob/main/contrib/libarchive/cpio/test/test_option_B_upper.c
39507 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2003-2007 Tim Kientzle4* All rights reserved.5*/6#include "test.h"78DEFINE_TEST(test_option_B_upper)9{10struct stat st;11int r;1213/*14* Create a file on disk.15*/16assertMakeFile("file", 0644, NULL);1718/* Create an archive without -B; this should be 512 bytes. */19r = systemf("echo file | %s -o > small.cpio 2>small.err", testprog);20assertEqualInt(r, 0);21assertTextFileContents("1 block\n", "small.err");22assertEqualInt(0, stat("small.cpio", &st));23assertEqualInt(512, st.st_size);2425/* Create an archive with -B; this should be 5120 bytes. */26r = systemf("echo file | %s -oB > large.cpio 2>large.err", testprog);27assertEqualInt(r, 0);28assertTextFileContents("1 block\n", "large.err");29assertEqualInt(0, stat("large.cpio", &st));30assertEqualInt(5120, st.st_size);31}323334