From 7277135ced5a5795c9653cc9195e4c3c957c6198 Mon Sep 17 00:00:00 2001 From: Giovanni Simoni Date: Fri, 3 Jan 2025 12:47:45 +0100 Subject: [PATCH] fixup tests: avoid loading sconfdir conf --- tests/cfg.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/cfg.c b/tests/cfg.c index 7e3195e..a76dcbb 100644 --- a/tests/cfg.c +++ b/tests/cfg.c @@ -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);