diff --git a/cli/core.c b/cli/core.c index 44bdcca..840de42 100644 --- a/cli/core.c +++ b/cli/core.c @@ -351,7 +351,7 @@ apply_path(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int max } static bool -apply_variable(pkgconf_client_t *client, pkgconf_pkg_t *world, void *variable, int maxdepth) +apply_variable(pkgconf_client_t *client, pkgconf_pkg_t *world, const void *variable, int maxdepth) { pkgconf_node_t *iter; (void) maxdepth; @@ -501,7 +501,7 @@ apply_env_variables(pkgconf_client_t *client, pkgconf_pkg_t *world, const char * } static bool -apply_env(pkgconf_client_t *client, pkgconf_pkg_t *world, void *env_prefix_p, int maxdepth) +apply_env(pkgconf_client_t *client, pkgconf_pkg_t *world, const void *env_prefix_p, int maxdepth) { pkgconf_cli_state_t *state = client->client_data; const char *want_env_prefix = env_prefix_p, *it; diff --git a/cli/core.h b/cli/core.h index 886678f..0cf5668 100644 --- a/cli/core.h +++ b/cli/core.h @@ -77,9 +77,9 @@ typedef struct { int maximum_traverse_depth; size_t maximum_package_count; - char *want_variable; - char *want_fragment_filter; - char *want_env_prefix; + const char *want_variable; + const char *want_fragment_filter; + const char *want_env_prefix; char *required_pkgconfig_version; char *required_exact_module_version; diff --git a/tests/test-runner.c b/tests/test-runner.c index 7d19dbd..370427a 100644 --- a/tests/test-runner.c +++ b/tests/test-runner.c @@ -41,6 +41,8 @@ typedef struct test_case_ { uint64_t wanted_flags; pkgconf_list_t env_vars; + + pkgconf_buffer_t want_env_prefix; } pkgconf_test_case_t; typedef struct test_state_ { @@ -345,6 +347,7 @@ static const pkgconf_test_keyword_pair_t test_keyword_pairs[] = { {"PackageSearchPath", test_keyword_set_path_list, offsetof(pkgconf_test_case_t, search_path)}, {"Query", test_keyword_set_buffer, offsetof(pkgconf_test_case_t, query)}, {"WantedFlags", test_keyword_set_wanted_flags, offsetof(pkgconf_test_case_t, wanted_flags)}, + {"WantEnvPrefix", test_keyword_set_buffer, offsetof(pkgconf_test_case_t, want_env_prefix)}, }; static void @@ -517,10 +520,12 @@ annotate_result(const pkgconf_test_case_t *testcase, int ret, const pkgconf_test fprintf(stderr, "stderr: [%s]\n" "expected-stderr: [%s] (%s)\n" + "want-env-prefix: [%s]\n" "--------------------------------------------------------------------------------\n", pkgconf_buffer_str_or_empty(&out->o_stderr), pkgconf_buffer_str_or_empty(&testcase->expected_stderr), - testcase->match_stderr == MATCH_PARTIAL ? "partial" : "exact"); + testcase->match_stderr == MATCH_PARTIAL ? "partial" : "exact", + pkgconf_buffer_str_or_empty(&testcase->want_env_prefix)); pkgconf_buffer_finalize(&search_path_buf); pkgconf_buffer_finalize(&wanted_flags_buf); @@ -535,6 +540,7 @@ run_test_case(const pkgconf_test_case_t *testcase) pkgconf_cross_personality_t *personality = personality_for_test(testcase); pkgconf_test_state_t state = { .cli_state.want_flags = testcase->wanted_flags, + .cli_state.want_env_prefix = pkgconf_buffer_str(&testcase->want_env_prefix), .testcase = testcase, };