functions.sh: dont die if gcc is missing

abuild-sign does not use gcc.

fixes #9974
This commit is contained in:
Natanael Copa 2019-11-07 15:59:01 +00:00
parent 21dcfb1f21
commit 95cd15c025
2 changed files with 12 additions and 1 deletions

View File

@ -117,7 +117,7 @@ readconfig() {
USE_COLORS=${_USE_COLORS-$USE_COLORS}
USE_CCACHE=${_USE_CCACHE-$USE_CCACHE}
[ -z "$CBUILD" ] && CBUILD="$(gcc -dumpmachine)"
[ -z "$CBUILD" ] && CBUILD="$(${CC:-gcc} -dumpmachine 2>/dev/null || true)"
[ -z "$CHOST" ] && CHOST="$CBUILD"
[ -z "$CTARGET" ] && CTARGET="$CHOST"
[ "$(arch_to_hostspec $CBUILD)" != "unknown" ] && CBUILD="$(arch_to_hostspec $CBUILD)"

11
tests/functions.bats Normal file
View File

@ -0,0 +1,11 @@
setup() {
export FUNCS=../functions.sh
}
@test "check if CBUILD is set" {
. $FUNCS && test -n "$CBUILD"
}
@test "check that missing gcc does not kill us" {
sh -e -c "CC=false; . $FUNCS && test -z \"$CBUILD\""
}