Path: blob/main/contrib/libarchive/cpio/test/test_option_C_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_C_upper)9{10int r;1112/*13* Create a file on disk.14*/15assertMakeFile("file", 0644, NULL);1617/* Create an archive without -C; this should be 512 bytes. */18r = systemf("echo file | %s -o > small.cpio 2>small.err", testprog);19assertEqualInt(r, 0);20assertTextFileContents("1 block\n", "small.err");21assertFileSize("small.cpio", 512);2223/* Create an archive with -C 513; this should be 513 bytes. */24r = systemf("echo file | %s -o -C 513 > 513.cpio 2>513.err",25testprog);26assertEqualInt(r, 0);27assertTextFileContents("1 block\n", "513.err");28assertFileSize("513.cpio", 513);2930/* Create an archive with -C 12345; this should be 12345 bytes. */31r = systemf("echo file | %s -o -C12345 > 12345.cpio 2>12345.err",32testprog);33assertEqualInt(r, 0);34assertTextFileContents("1 block\n", "12345.err");35assertFileSize("12345.cpio", 12345);3637/* Create an archive with invalid -C request */38assert(0 != systemf("echo file | %s -o -C > bad.cpio 2>bad.err",39testprog));40assertEmptyFile("bad.cpio");41}424344