Skip to content

Commit

Permalink
fixup tests: avoid loading sconfdir conf
Browse files Browse the repository at this point in the history
  • Loading branch information
dacav committed Jan 3, 2025
1 parent e9ae9c6 commit 7277135
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,24 +149,25 @@ static int str_opt_cmp(const char *s1, const char *s2) {
static void test_regular(void) {
// Ensure that all configuration options are loaded into the configuration:

const char *argv[] = {"prompt=hi",
const char *argv[] = {NULL,
"debug", // So we have a log file for the test
NULL};
"prompt=hi"};

struct conf_file cf;
int r;
cfg_t cfg, cfg_defaults;

conf_file_init(&cf, NULL);
argv[0] = cf.arg;

// 1. Load the default
r = cfg_init(&cfg_defaults, 0, 0, NULL);
r = cfg_init(&cfg_defaults, 0, 1, argv);
assert(r == PAM_SUCCESS);

// 2. Write the configuration file, changing every field.
conf_file_init(&cf, NULL);
config_flip_all(&cf, &cfg_defaults);

// 3. Load from the file
argv[2] = cf.arg;
r = cfg_init(&cfg, 0, sizeof(argv) / sizeof(*argv), argv);
assert(r == PAM_SUCCESS);
conf_file_clear(&cf);
Expand Down

0 comments on commit 7277135

Please sign in to comment.