File: test_missing_file.c

package info (click to toggle)
libarchive 3.8.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 27,896 kB
  • sloc: ansic: 172,236; sh: 6,022; makefile: 1,951; cpp: 1,535; awk: 770
file content (22 lines) | stat: -rw-r--r-- 831 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*-
 * SPDX-License-Identifier: BSD-2-Clause
 *
 * Copyright (c) 2016 Tim Kientzle
 * All rights reserved.
 */
#include "test.h"

DEFINE_TEST(test_missing_file)
{
	const char * invalid_stderr[] = { "INTERNAL ERROR", NULL };
	assertMakeFile("file1", 0644, "file1");
	assertMakeFile("file2", 0644, "file2");
	assert(0 == systemf("%s -cf archive.tar file1 file2 2>stderr1", testprog));
	assertEmptyFile("stderr1");
	assert(0 != systemf("%s -cf archive.tar file1 file2 file3 2>stderr2", testprog));
	assertFileContainsNoInvalidStrings("stderr2", invalid_stderr);
	assert(0 != systemf("%s -cf archive.tar 2>stderr3", testprog));
	assertFileContainsNoInvalidStrings("stderr3", invalid_stderr);
	assert(0 != systemf("%s -cf archive.tar file3 file4 2>stderr4", testprog));
	assertFileContainsNoInvalidStrings("stderr4", invalid_stderr);
}