Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/libarchive/cpio/test/test_option_B_upper.c
39507 views
1
/*-
2
* SPDX-License-Identifier: BSD-2-Clause
3
*
4
* Copyright (c) 2003-2007 Tim Kientzle
5
* All rights reserved.
6
*/
7
#include "test.h"
8
9
DEFINE_TEST(test_option_B_upper)
10
{
11
struct stat st;
12
int r;
13
14
/*
15
* Create a file on disk.
16
*/
17
assertMakeFile("file", 0644, NULL);
18
19
/* Create an archive without -B; this should be 512 bytes. */
20
r = systemf("echo file | %s -o > small.cpio 2>small.err", testprog);
21
assertEqualInt(r, 0);
22
assertTextFileContents("1 block\n", "small.err");
23
assertEqualInt(0, stat("small.cpio", &st));
24
assertEqualInt(512, st.st_size);
25
26
/* Create an archive with -B; this should be 5120 bytes. */
27
r = systemf("echo file | %s -oB > large.cpio 2>large.err", testprog);
28
assertEqualInt(r, 0);
29
assertTextFileContents("1 block\n", "large.err");
30
assertEqualInt(0, stat("large.cpio", &st));
31
assertEqualInt(5120, st.st_size);
32
}
33
34