xref: /freebsd/contrib/libarchive/unzip/test/test_0.c (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
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 /*
10  * This first test does basic sanity checks on the environment.  For
11  * most of these, we just exit on failure.
12  */
13 #if !defined(_WIN32) || defined(__CYGWIN__)
14 #define DEV_NULL "/dev/null"
15 #else
16 #define DEV_NULL "NUL"
17 #endif
18 
19 DEFINE_TEST(test_0)
20 {
21 	struct stat st;
22 
23 	failure("File %s does not exist?!", testprog);
24 	if (!assertEqualInt(0, stat(testprogfile, &st))) {
25 		fprintf(stderr,
26 		    "\nFile %s does not exist; aborting test.\n\n",
27 		    testprog);
28 		exit(1);
29 	}
30 
31 	failure("%s is not executable?!", testprog);
32 	if (!assert((st.st_mode & 0111) != 0)) {
33 		fprintf(stderr,
34 		    "\nFile %s not executable; aborting test.\n\n",
35 		    testprog);
36 		exit(1);
37 	}
38 
39 	/* TODO: Ensure that our reference files are available. */
40 }
41