Page MenuHomeFreeBSD

usr.bin/pkgconf: import the test suite
Needs ReviewPublic

Authored by khorben on Sat, Jul 4, 1:36 AM.
Tags
None
Referenced Files
F162024215: D58034.diff
Thu, Jul 9, 12:50 AM
Unknown Object (File)
Tue, Jul 7, 5:08 PM
Unknown Object (File)
Tue, Jul 7, 5:04 PM
Unknown Object (File)
Tue, Jul 7, 5:58 AM
Unknown Object (File)
Tue, Jul 7, 5:39 AM
Unknown Object (File)
Mon, Jul 6, 5:50 PM
Unknown Object (File)
Mon, Jul 6, 3:05 PM
Unknown Object (File)
Mon, Jul 6, 5:46 AM
Subscribers

Details

Reviewers
markj
Summary

This integrates pkgconf's own test suite with that of the base system.

Some tests are still missing (e.g., for memory allocation) but they require a Linux host.

Test Plan

I have been able to perform some of the tests successfully (log below) but I still have issues with 16 to 24 (those with the test-runner executable); I have to install the corresponding files required to complete the tests.

$ cd /usr/obj/.../src/usr.bin/pkgconf/tests
$ ./pkgconf_tests
1..25
# Log of test suite run on Wed Jul  8 23:27:56 CEST 2026
ok 1 pkgconf:api-audit
# test-api-audit -> test_audit_log_no_logfile_is_noop: PASS
# test-api-audit -> test_audit_set_log_and_write: PASS
# test-api-audit -> test_audit_log_multiple_writes: PASS
# test-api-audit -> test_audit_log_dependency_versionless: PASS
# test-api-audit -> test_audit_log_dependency_versioned: PASS
# test-api-audit -> test_audit_log_dependency_no_logfile_is_noop: PASS
ok 2 pkgconf:api-buffer
# test-api-buffer -> test_buffer_empty: PASS
# test-api-buffer -> test_buffer_append: PASS
# test-api-buffer -> test_buffer_append_slice: PASS
# test-api-buffer -> test_buffer_append_fmt: PASS
# test-api-buffer -> test_buffer_prepend: PASS
# test-api-buffer -> test_buffer_push_byte: PASS
# test-api-buffer -> test_buffer_trim_byte: PASS
# test-api-buffer -> test_buffer_reset: PASS
# test-api-buffer -> test_buffer_freeze: PASS
# test-api-buffer -> test_buffer_copy: PASS
# test-api-buffer -> test_buffer_join: PASS
# test-api-buffer -> test_buffer_contains: PASS
# test-api-buffer -> test_buffer_match: PASS
# test-api-buffer -> test_buffer_has_prefix: PASS
# test-api-buffer -> test_buffer_subst: PASS
# test-api-buffer -> test_buffer_subst_empty_pattern: PASS
# test-api-buffer -> test_buffer_escape: PASS
# test-api-buffer -> test_str_eq_slice: PASS
# test-api-buffer -> test_span_contains: PASS
# test-api-buffer -> test_buffer_fputs_nonempty: PASS
# test-api-buffer -> test_buffer_fputs_empty: PASS
ok 3 pkgconf:api-bytecode
# test-api-bytecode -> test_eval_plain_text: PASS
# test-api-bytecode -> test_eval_empty_input: PASS
# test-api-bytecode -> test_eval_variable_substitution: PASS
# test-api-bytecode -> test_eval_nested_variables: PASS
# test-api-bytecode -> test_eval_multiple_variables: PASS
# test-api-bytecode -> test_eval_undefined_variable: PASS
# test-api-bytecode -> test_eval_sysroot_detection: PASS
# test-api-bytecode -> test_eval_null_args: PASS
# test-api-bytecode -> test_emit_guards: PASS
# test-api-bytecode -> test_emit_text_and_eval: PASS
# test-api-bytecode -> test_emit_var_and_eval: PASS
# test-api-bytecode -> test_emit_sysroot_and_eval: PASS
# test-api-bytecode -> test_dollar_escape: PASS
# test-api-bytecode -> test_malformed_unclosed: PASS
# test-api-bytecode -> test_empty_braces: PASS
# test-api-bytecode -> test_circular_reference: PASS
# test-api-bytecode -> test_references_var: PASS
# test-api-bytecode -> test_references_var_text_only: PASS
# test-api-bytecode -> test_compile_time_sysroot: PASS
# test-api-bytecode -> test_sysroot_dot_disables: PASS
# test-api-bytecode -> test_sysroot_root_disables: PASS
# test-api-bytecode -> test_sysroot_trailing_slash_trimmed: PASS
# test-api-bytecode -> test_sysroot_normalizes_to_root_disables: PASS
# test-api-bytecode -> test_rewrite_selfrefs: PASS
# test-api-bytecode -> test_rewrite_selfrefs_no_match: PASS
# test-api-bytecode -> test_compile_eval_roundtrip: PASS
# test-api-bytecode -> test_compile_produces_nonempty_buffer: PASS
# test-api-bytecode -> test_compile_null_args: PASS
ok 4 pkgconf:api-client
# test-api-client -> test_client_new_and_free: PASS
# test-api-client -> test_client_init_and_deinit_stack: PASS
# test-api-client -> test_client_init_system_paths_from_environ: PASS
# test-api-client -> test_client_preload_from_environ: PASS
# test-api-client -> test_client_sysroot_dir: PASS
# test-api-client -> test_client_buildroot_dir: PASS
# test-api-client -> test_client_flags: PASS
# test-api-client -> test_client_prefix_varname: PASS
# test-api-client -> test_client_error_handler_fires: PASS
# test-api-client -> test_client_warn_handler_fires: PASS
# test-api-client -> test_client_trace_handler_fires: PASS
# test-api-client -> test_client_unveil_handler_installation: PASS
# test-api-client -> test_client_getenv_via_handler: PASS
# test-api-client -> test_client_dir_list_build_smoke: PASS
# test-api-client -> test_client_trace_null_client: PASS
ok 5 pkgconf:api-dependency
# test-api-dependency -> test_comparator_lookup_known: PASS
# test-api-dependency -> test_comparator_lookup_unknown: PASS
# test-api-dependency -> test_comparator_roundtrip: PASS
# test-api-dependency -> test_parse_str_empty: PASS
# test-api-dependency -> test_parse_str_single: PASS
# test-api-dependency -> test_parse_str_versioned: PASS
# test-api-dependency -> test_parse_str_multiple_space_separated: PASS
# test-api-dependency -> test_parse_str_multiple_comma_separated: PASS
# test-api-dependency -> test_parse_str_mixed_versioned_and_bare: PASS
# test-api-dependency -> test_parse_str_all_comparators: PASS
# test-api-dependency -> test_dependency_add: PASS
# test-api-dependency -> test_dependency_add_no_version: PASS
# test-api-dependency -> test_dependency_add_multiple: PASS
# test-api-dependency -> test_dependency_collision_drops_flagged_newcomer: PASS
# test-api-dependency -> test_dependency_collision_drops_flagged_existing: PASS
# test-api-dependency -> test_version_equal: PASS
# test-api-dependency -> test_version_simple_numeric: PASS
# test-api-dependency -> test_version_numeric_segments_not_lexical: PASS
# test-api-dependency -> test_version_different_lengths: PASS
# test-api-dependency -> test_version_alpha_suffix: PASS
# test-api-dependency -> test_version_tilde_prerelease: PASS
# test-api-dependency -> test_version_numeric_beats_alpha: PASS
# test-api-dependency -> test_version_alpha_ordering: PASS
# test-api-dependency -> test_version_dotted_vs_hyphenated: PASS
# test-api-dependency -> test_version_leading_zeros: PASS
# test-api-dependency -> test_version_trailing_zero_segments: PASS
# test-api-dependency -> test_version_null_handling: PASS
# test-api-dependency -> test_version_tilde_both_sides: PASS
# test-api-dependency -> test_version_separator_equivalence: PASS
# test-api-dependency -> test_version_case_insensitive: PASS
# test-api-dependency -> test_version_alpha_prefix: PASS
ok 6 pkgconf:api-fileio
# test-api-fileio -> test_fgetline_no_trailing_newline: PASS
# test-api-fileio -> test_fgetline_empty_stream: PASS
# test-api-fileio -> test_fgetline_lf: PASS
# test-api-fileio -> test_fgetline_crlf: PASS
# test-api-fileio -> test_fgetline_lone_cr: PASS
# test-api-fileio -> test_fgetline_backslash_continuation_lf: PASS
# test-api-fileio -> test_fgetline_backslash_continuation_crlf: PASS
# test-api-fileio -> test_fgetline_backslash_continuation_lone_cr: PASS
# test-api-fileio -> test_fgetline_backslash_not_continuation: PASS
# test-api-fileio -> test_fgetline_crlf_split_across_fgets_buffer: PASS
ok 7 pkgconf:api-fragment
# test-api-fragment -> test_fragment_parse_empty: PASS
# test-api-fragment -> test_fragment_parse_cflags: PASS
# test-api-fragment -> test_fragment_parse_libs: PASS
# test-api-fragment -> test_fragment_add_single: PASS
# test-api-fragment -> test_fragment_render_empty: PASS
# test-api-fragment -> test_fragment_render_cflags: PASS
# test-api-fragment -> test_fragment_render_libs: PASS
# test-api-fragment -> test_fragment_filter_only_includes: PASS
# test-api-fragment -> test_fragment_filter_only_libnames: PASS
# test-api-fragment -> test_fragment_filter_keeps_nothing: PASS
# test-api-fragment -> test_fragment_has_system_dir_matches: PASS
# test-api-fragment -> test_fragment_has_system_dir_libs: PASS
ok 8 pkgconf:api-license
# test-api-license -> test_license_insert_and_free: PASS
# test-api-license -> test_license_free_empty: PASS
# test-api-license -> test_license_evaluate_single: PASS
# test-api-license -> test_license_evaluate_or: PASS
# test-api-license -> test_license_evaluate_and: PASS
# test-api-license -> test_license_evaluate_multiple_keys_implicit_and: PASS
# test-api-license -> test_license_evaluate_brackets: PASS
# test-api-license -> test_license_evaluate_empty: PASS
# test-api-license -> test_license_evaluate_sanitizes: PASS
# test-api-license -> test_license_evaluate_long_sanitized_token: PASS
# test-api-license -> test_license_evaluate_unterminated_quote: PASS
# test-api-license -> test_license_render_empty: PASS
# test-api-license -> test_license_render_single: PASS
# test-api-license -> test_license_copy_list: PASS
ok 9 pkgconf:api-path-utils
# test-api-path-utils -> test_path_find_basename: PASS
# test-api-path-utils -> test_path_trim_basename: PASS
# test-api-path-utils -> test_determine_prefix_logic: PASS
# test-api-path-utils -> test_path_prepend: PASS
# test-api-path-utils -> test_path_prepend_filter: PASS
# test-api-path-utils -> test_path_prepend_list: PASS
# test-api-path-utils -> test_path_is_plausible: PASS
ok 10 pkgconf:api-personality
# test-api-personality -> test_personality_deinit_null: PASS
# test-api-personality -> test_personality_default_refcount: PASS
# test-api-personality -> test_personality_find_invalid_triplet: PASS
# test-api-personality -> test_personality_find_direct_path: PASS
# test-api-personality -> test_personality_find_via_xdg: PASS
# test-api-personality -> test_personality_find_missing_returns_default: PASS
ok 11 pkgconf:api-queue
# test-api-queue -> test_queue_validate_success: PASS
# test-api-queue -> test_queue_validate_version_satisfied: PASS
# test-api-queue -> test_queue_validate_missing_package: PASS
# test-api-queue -> test_queue_validate_unsatisfiable_version: PASS
# test-api-queue -> test_queue_validate_empty: PASS
# test-api-queue -> test_queue_apply_success: PASS
# test-api-queue -> test_queue_apply_callback_failure: PASS
# test-api-queue -> test_queue_apply_missing_package: PASS
ok 12 pkgconf:api-tuple
# test-api-tuple -> test_tuple_add_and_find: PASS
# test-api-tuple -> test_tuple_find_absent: PASS
# test-api-tuple -> test_tuple_add_multiple: PASS
# test-api-tuple -> test_tuple_free_empty: PASS
# test-api-tuple -> test_tuple_global_add_and_find: PASS
# test-api-tuple -> test_tuple_global_find_absent: PASS
# test-api-tuple -> test_tuple_define_global_kv_form: PASS
# test-api-tuple -> test_tuple_define_global_with_equals_in_value: PASS
# test-api-tuple -> test_tuple_global_multiple: PASS
# test-api-tuple -> test_tuple_global_free_resets: PASS
# test-api-tuple -> test_tuple_define_variable_end_to_end: PASS
# test-api-tuple -> test_tuple_define_variable_overrides_local: PASS
# test-api-tuple -> test_tuple_escaped_quote: PASS
ok 13 pkgconf:api-variable
# test-api-variable -> test_variable_new_and_free: PASS
# test-api-variable -> test_variable_get_or_create_creates: PASS
# test-api-variable -> test_variable_get_or_create_returns_existing: PASS
# test-api-variable -> test_variable_find_present: PASS
# test-api-variable -> test_variable_find_absent: PASS
# test-api-variable -> test_variable_find_among_many: PASS
# test-api-variable -> test_variable_delete: PASS
# test-api-variable -> test_variable_eval_str_plain: PASS
# test-api-variable -> test_variable_eval_str_with_reference: PASS
# test-api-variable -> test_variable_eval_str_chained: PASS
# test-api-variable -> test_variable_list_free_handles_empty: PASS
# test-api-variable -> test_variable_list_free_handles_many: PASS
ok 14 pkgconf:api-version
# test-api-version -> test_version_equal: PASS
# test-api-version -> test_version_null: PASS
# test-api-version -> test_version_numeric: PASS
# test-api-version -> test_version_leading_zeros: PASS
# test-api-version -> test_version_component_count: PASS
# test-api-version -> test_version_separators: PASS
# test-api-version -> test_version_tilde: PASS
# test-api-version -> test_version_alpha_numeric: PASS
# test-api-version -> test_version_real_world: PASS
ok 15 pkgconf:api-serialize
# test-api-serialize -> test_serialize_value_string: PASS
# test-api-serialize -> test_serialize_value_int: PASS
# test-api-serialize -> test_serialize_value_bool: PASS
# test-api-serialize -> test_serialize_value_null: PASS
# test-api-serialize -> test_serialize_escape_sequences: PASS
# test-api-serialize -> test_serialize_object_mixed_types: PASS
# test-api-serialize -> test_serialize_array_mixed_types: PASS
# test-api-serialize -> test_serialize_null_guards: PASS
not ok 16 pkgconf:basic
# failed to open test directory t/basic
not ok 17 pkgconf:ordering
# failed to open test directory t/ordering
not ok 18 pkgconf:personality
# failed to open test directory t/personality
not ok 19 pkgconf:solver
# failed to open test directory t/solver
not ok 20 pkgconf:sbom
# failed to open test directory t/sbom
not ok 21 pkgconf:sysroot
# failed to open test directory t/sysroot
not ok 22 pkgconf:tuple
# failed to open test directory t/tuple
not ok 23 pkgconf:spdxtool
# failed to open test directory t/spdxtool
not ok 24 pkgconf:symlink
# failed to open test directory t/symlink
not ok 25 pkgconf:parser
# failed to open test directory t/parser

Or with kyua(1):

$ (cd usr.bin/pkgconf && make tests && cd tests && make install)
[...]
$ (cd /usr/tests/usr.bin/pkgconf && kyua test)
pkgconf_tests:main  ->  failed: 10 of 25 tests failed  [0.175s]

Results file id is usr_tests_usr.bin_pkgconf.20260708-213038-359764
Results saved to /home/khorben/.kyua/store/results.usr_tests_usr.bin_pkgconf.20260708-213038-359764.db

0/1 passed (0 broken, 1 failed, 0 skipped)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Fixed inconsistent indentation in etc/mtree/BSD.tests.dist.

khorben edited the test plan for this revision. (Show Details)

Imported more tests from the 2.9.93 release.
Some still remain to be integrated, like for spdxtool specifically.

I have run the tests manually, I'm still not quite sure how to run them through FreeBSD's build system.

Something like,

# make -C usr.bin/pkgconf/tests install
$ cd /usr/tests/usr.bin/pkgconf
$ kyua test
usr.bin/pkgconf/tests/Makefile
40

Why NO_SHARED?

usr.bin/pkgconf/tests/pkgconf_tests.sh
2

Missing a license header.

32

Rather than assuming the test programs are in the PATH, you can qualify the path with something like

local base=$(dirname $0)
...
_test $i "pkgconf:api-$test" ${base}/test-api-$test
khorben edited the summary of this revision. (Show Details)
khorben edited the test plan for this revision. (Show Details)

Added the SPDX license header.
Added discovery mechanism for the location of the test executables.

khorben edited the summary of this revision. (Show Details)
khorben edited the test plan for this revision. (Show Details)

Also hooked the serialisation test for spdxtool.