diff options
author | Michał Górny <mgorny@gentoo.org> | 2024-02-07 17:38:19 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2024-02-10 11:47:21 +0100 |
commit | 118145de3992a8249131bd0eb30ea89ad0bd0bdf (patch) | |
tree | 55f652e91bdb670abb388c529ba9f146aa4110a6 /eclass/tests | |
parent | llvm-utils.eclass: Introduce an eclass for common helpers (diff) | |
download | gentoo-118145de3992a8249131bd0eb30ea89ad0bd0bdf.tar.gz gentoo-118145de3992a8249131bd0eb30ea89ad0bd0bdf.tar.bz2 gentoo-118145de3992a8249131bd0eb30ea89ad0bd0bdf.zip |
llvm-utils.eclass: Split out PATH prepending logic
Split the logic prepending PATH from pkg_setup() into a dedicated
llvm_prepend_path() function.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/tests')
-rwxr-xr-x | eclass/tests/llvm-utils.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/eclass/tests/llvm-utils.sh b/eclass/tests/llvm-utils.sh index 44ad1b4adc84..5a46b25b7ad6 100755 --- a/eclass/tests/llvm-utils.sh +++ b/eclass/tests/llvm-utils.sh @@ -66,6 +66,21 @@ test_fix_tool_path() { tend ${?} } +test_prepend_path() { + local slot=${1} + local -x PATH=${2} + local expected=${3} + + tbegin "llvm_prepend_path ${slot} to PATH=${PATH}" + llvm_prepend_path "${slot}" + if [[ ${PATH} != ${expected} ]]; then + eerror "llvm_prepend_path ${var}" + eerror " gave: ${PATH}" + eerror "expected: ${expected}" + fi + tend ${?} +} + test_fix_clang_version CC clang 19.0.0git78b4e7c5 clang-19 test_fix_clang_version CC clang 17.0.6 clang-17 test_fix_clang_version CXX clang++ 17.0.6 clang++-17 @@ -79,4 +94,13 @@ test_fix_tool_path RANLIB llvm-ranlib 1 test_fix_tool_path AR ar 1 test_fix_tool_path AR ar 0 +ESYSROOT= +test_prepend_path 17 /usr/bin /usr/bin:/usr/lib/llvm/17/bin +test_prepend_path 17 /usr/lib/llvm/17/bin:/usr/bin /usr/lib/llvm/17/bin:/usr/bin +test_prepend_path 17 /usr/bin:/usr/lib/llvm/17/bin /usr/bin:/usr/lib/llvm/17/bin +test_prepend_path 18 /usr/lib/llvm/17/bin:/usr/bin \ + /usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/bin +test_prepend_path 18 /usr/bin:/usr/lib/llvm/17/bin \ + /usr/bin:/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin + texit |