For internal use only.
This test program is used to test the operation of the tc_path() function.
Definition in file t_tc_path.c.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "test-harness.h"
#include "treeconf_int.h"
Include dependency graph for t_tc_path.c:
Go to the source code of this file.
Data Structures | |
struct | test |
Describe a test. More... | |
struct | test_elem |
Test "file" information. More... | |
Defines | |
#define | TEST_ACCESS |
Can access file. | |
#define | TEST_XSEARCHED |
Search expected. | |
#define | TEST_XCALLED |
Callback expected. | |
#define | TEST_SEARCHED |
File searched. | |
#define | TEST_CALLED |
Callback called. | |
#define | TEST_EXPECTED |
Expected mask. | |
#define | TEST_ACTUAL |
Actual mask. | |
#define | TEST_ELEM(name, flags, ret) |
Initialize test file element. | |
#define | TEST_PATH(test, path, default, flags, xret, cnt, elems, s_cnt, subs) |
Initialize test. | |
#define | TEST_ELEMS(elems) |
Count elements in a struct test_elem array. | |
#define | NUM_SUBSTS |
Test substitutions count. | |
#define | NUM_TESTS |
Number of tests. | |
Functions | |
int | access (const char *pathname, int mode) |
Overridden access() function. | |
unsigned int | callback (const char *file, void *data) |
Test callback function. | |
void | do_test (struct test *test) |
Execute a test case. | |
int | main (int argc, char **argv) |
Test program for tc_path(). | |
Variables | |
test * | curr_test |
Current test. | |
test_elem | basic_elems [] |
Basic test file elements. | |
test_elem | all_elems [] |
Test file elements for all test. | |
treeconf_subst_t | substs [] |
Test substitutions. | |
test_elem | subst_elems [] |
Test file elements for substitution tests. | |
test_elem | secure_elems [] |
Test file elements for secure substitution tests. | |
test | tests [] |
Tests. |
|
For internal use only. This macro is defined to the number of substitutions in the substs array. Definition at line 338 of file t_tc_path.c. |
|
For internal use only. This macro contains the count of the number of tests to be performed. Definition at line 391 of file t_tc_path.c. |
|
For internal use only. This flag, if set, indicates that our overridden access() function should return true. Definition at line 81 of file t_tc_path.c. Referenced by access(). |
|
For internal use only. This mask returns the actual results of the test for the "file". Definition at line 127 of file t_tc_path.c. |
|
For internal use only. This flag, if set, indicates that the callback function was called on this file. Definition at line 113 of file t_tc_path.c. |
|
For internal use only. This macro initializes one member of a test file element array.
Definition at line 138 of file t_tc_path.c. |
|
For internal use only.
This macro simply returns the number of elements in the struct test_elem array
Definition at line 168 of file t_tc_path.c. |
|
For internal use only. This mask returns the expectation flags for the "file". Definition at line 120 of file t_tc_path.c. |
|
For internal use only. This macro initializes one member of the test array.
Definition at line 156 of file t_tc_path.c. |
|
For internal use only. This flag, if set, indicates that access() was called for this function. Definition at line 105 of file t_tc_path.c. |
|
For internal use only. This flag, if set, indicates that we expect the callback function to be called on this file. Definition at line 97 of file t_tc_path.c. |
|
For internal use only. This flag, if set, indicates that we expect access() to be called on this file name. Definition at line 89 of file t_tc_path.c. |
|
For internal use only. This is an override of the C library's access() function. Since it's not ANSI, we're supposed to be able to do so. We need to do this since the files we want to check for don't actually exist, and we want to know if tc_path() calls access() anyway.
Definition at line 194 of file t_tc_path.c. References curr_test, test::elem_cnt, test::elem_loc, test::elems, test::test, TEST_ACCESS, and test_elem::test_flags. Referenced by _subst(). |
|
For internal use only. This is a treeconf_file_t callback function for testing tc_path().
Definition at line 226 of file t_tc_path.c. References curr_test, test::elem_cnt, test::elem_loc, test::elems, test_elem::ret_val, test::test, and test_elem::test_flags. |
|
For internal use only.
This function executes the test case designated by the
Definition at line 255 of file t_tc_path.c. References callback(), curr_test, test::def, test::elem_cnt, test::elems, test_elem::filename, test::flags, test::path, test::subst_cnt, test::substs, tc_path(), test::test, test_elem::test_flags, and test::xret. Referenced by main(). |
Here is the call graph for this function:
|
For internal use only. This program is used for testing the treeconf library's tc_path() utility routine. Definition at line 400 of file t_tc_path.c. References callback(), do_test(), tc_path(), and tests. |
Here is the call graph for this function:
|
For internal use only. This array contains the file elements for a test of tc_path() with the TC_PATH_ALL flag. Definition at line 312 of file t_tc_path.c. |
|
For internal use only. This array contains the file elements for a basic test of tc_path(). Definition at line 297 of file t_tc_path.c. |
|
For internal use only. This is a pointer to the current test being executed, for the convenience of access() and callback(). Definition at line 176 of file t_tc_path.c. Referenced by access(), callback(), and do_test(). |
|
For internal use only. This array contains the file elements for verifying that tc_path() performs substitutions properly under security conditions. Definition at line 364 of file t_tc_path.c. |
|
For internal use only. This array contains the file elements for verifying that tc_path() performs substitutions properly. Definition at line 349 of file t_tc_path.c. |
|
For internal use only. This array contains substitutions for testing the substitution machinery of tc_path(). Definition at line 325 of file t_tc_path.c. |
|
For internal use only. This array contains the tests to perform on tc_path(). Definition at line 374 of file t_tc_path.c. Referenced by main(). |