commit:     fa49a60a8a2a169eca8c9cd12c4220988a8fdadc
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 22 23:20:23 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 22 23:45:43 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=fa49a60a

tests: use sys-apps/gentoo-functions if available

Gives us nicer looking output.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 tests/run_tests | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/tests/run_tests b/tests/run_tests
index 602aa92..ef38770 100755
--- a/tests/run_tests
+++ b/tests/run_tests
@@ -3,17 +3,24 @@
 # Avoid bash localization of error messages
 export LC_ALL=C
 
-ebegin() { printf '%s*%s %s ... ' "${GOOD}" "${NORMAL}" "$*" ; }
-eend() {
-       local r=${1:-0}
-       shift
-       if [[ $r -eq 0 ]] ; then
+functions_script="${EPREFIX}/lib/gentoo/functions.sh"
+source "${functions_script}" || {
+       echo "${argv0}: Could not source ${functions_script}!" 1>&2
+
+       ebegin() { printf '%s*%s %s ... ' "${GOOD}" "${NORMAL}" "$*" ; }
+
+       eend() {
+               local r=${1:-0}
+               shift
+               if [[ $r -eq 0 ]] ; then
                printf '[ %sok%s ]\n' "${GOOD}" "${NORMAL}"
-       else
-               printf '%s [ %s!!%s ]\n' "$*" "${BAD}" "${NORMAL}"
-       fi
-       return $r
+               else
+                       printf '%s [ %s!!%s ]\n' "$*" "${BAD}" "${NORMAL}"
+               fi
+               return $r
+       }
 }
+
 die() { echo "$*" 1>&2; exit 1; }
 
 vars=( CHOST GCC_CONFIG ROOT TROOT NOCOLOR RC_NOCOLOR )

Reply via email to