pkg-config/check/check-dependencies
Matthew Hanna 908cdd062a Improve performance of package list expansion
Adds a hash table to the package list expansion to avoid iterating over
the children of package nodes that have already been visited. Without
this, the expansion is exponential. For library sets with a high degree
of dependency, iteration over the tree with revisiting results, in
practice, in significant slow down at best and pkg-config failure due to
memory exhaustion at worst. The resulting algorithm is equivalent to a
topological sort.
2016-08-22 14:34:30 -07:00

44 lines
1.2 KiB
Bash
Executable file

#! /bin/sh
# These tests check the evaluation of the 'recursive_fill_list' function to
# verify that for any package s that depends on t, that the library defined by
# package s occurs before that of package t
set -e
. ${srcdir}/common
export PKG_CONFIG_PATH
PKG_CONFIG_PATH="${srcdir}/dependencies"
# Shared dependency test.
RESULT="-la_dep_c -lb_dep_c -lc_dep"
run_test --libs a_dep_c b_dep_c
run_test --libs c_dep a_dep_c b_dep_c
run_test --libs a_dep_c c_dep b_dep_c
run_test --libs a_dep_c b_dep_c c_dep
# Redundancy test.
#
# Redundancy on the input line should not pass through.
RESULT="-la_dep_c -lb_dep_c -lc_dep"
run_test --libs a_dep_c a_dep_c b_dep_c
run_test --libs b_dep_c a_dep_c b_dep_c
# Diamond pattern test.
#
# One dependency of d depends on the other.
# Both dependencies of d depend on g
RESULT="-ld_dep_e_f -le_dep_g_f -lf_dep_g -lg_dep"
run_test --libs d_dep_e_f
RESULT="-ld_dep_f_e -le_dep_g_f -lf_dep_g -lg_dep"
run_test --libs d_dep_f_e
# Nested inclusion.
#
# Each package depends on all downsteam packages.
RESULT="-lh_dep_k_i_j -li_dep_k_j -lj_dep_k -lk_dep"
run_test --libs h_dep_k_i_j
run_test --libs h_dep_k_i_j i_dep_k_j
run_test --libs i_dep_k_j h_dep_k_i_j
run_test --libs k_dep j_dep_k i_dep_k_j h_dep_k_i_j