xbps/tests/xbps/xbps-uhelper/arch_test.sh
Juan RP 428a747fad Fix #69 (No way to set globally a custom architecture)
The "architecture" configuration keyword is now available to override
the native machine architecture returned by (uname(2)).

The XBPS_ARCH environment variable still has preference.
2014-11-19 11:36:09 +01:00

40 lines
758 B
Bash

#! /usr/bin/env atf-sh
# Test that xbps-uhelper arch works as expected.
atf_test_case native
native_head() {
atf_set "descr" "xbps-uhelper arch: native test"
}
native_body() {
atf_check_equal $(xbps-uhelper arch) $(uname -m)
}
atf_test_case env
env_head() {
atf_set "descr" "xbps-uhelper arch: envvar override test"
}
env_body() {
export XBPS_ARCH=foo
atf_check_equal $(xbps-uhelper arch) foo
}
atf_test_case conf
conf_head() {
atf_set "descr" "xbps-uhelper arch: configuration override test"
}
conf_body() {
mkdir -p xbps.d
echo "architecture=x86_64-musl" > xbps.d/arch.conf
atf_check_equal $(xbps-uhelper -C $PWD/xbps.d arch) x86_64-musl
}
atf_init_test_cases() {
atf_add_test_case native
atf_add_test_case env
atf_add_test_case conf
}