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