commit:     59211623564fe3e7636eeab5255cd732d9f1aee8
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 20 20:08:07 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Dec 20 22:21:07 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59211623

net-misc/openssh: clean up test code a bit

Use arrays instead of a flat scalar, and clean up the warning/error output.

 net-misc/openssh/openssh-7.3_p1-r8.ebuild | 37 +++++++++++++------------------
 1 file changed, 16 insertions(+), 21 deletions(-)

diff --git a/net-misc/openssh/openssh-7.3_p1-r8.ebuild 
b/net-misc/openssh/openssh-7.3_p1-r8.ebuild
index a03905c..f886839 100644
--- a/net-misc/openssh/openssh-7.3_p1-r8.ebuild
+++ b/net-misc/openssh/openssh-7.3_p1-r8.ebuild
@@ -272,37 +272,32 @@ src_install() {
 }
 
 src_test() {
-       local t tests skipped failed passed shell
-       tests="interop-tests compat-tests"
-       skipped=""
-       shell=$(egetshell ${UID})
+       local t skipped=() failed=() passed=()
+       local tests=( interop-tests compat-tests )
+
+       local shell=$(egetshell "${UID}")
        if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then
-               elog "Running the full OpenSSH testsuite"
-               elog "requires a usable shell for the 'portage'"
+               elog "Running the full OpenSSH testsuite requires a usable 
shell for the 'portage'"
                elog "user, so we will run a subset only."
-               skipped="${skipped} tests"
+               skipped+=( tests )
        else
-               tests="${tests} tests"
+               tests+=( tests )
        fi
-       # It will also attempt to write to the homedir .ssh
+
+       # It will also attempt to write to the homedir .ssh.
        local sshhome=${T}/homedir
        mkdir -p "${sshhome}"/.ssh
-       for t in ${tests} ; do
+       for t in "${tests[@]}" ; do
                # Some tests read from stdin ...
                HOMEDIR="${sshhome}" HOME="${sshhome}" \
                emake -k -j1 ${t} </dev/null \
-                       && passed="${passed}${t} " \
-                       || failed="${failed}${t} "
+                       && passed+=( "${t}" ) \
+                       || failed+=( "${t}" )
        done
-       einfo "Passed tests: ${passed}"
-       ewarn "Skipped tests: ${skipped}"
-       if [[ -n ${failed} ]] ; then
-               ewarn "Failed tests: ${failed}"
-               die "Some tests failed: ${failed}"
-       else
-               einfo "Failed tests: ${failed}"
-               return 0
-       fi
+
+       einfo "Passed tests: ${passed[*]}"
+       [[ ${#skipped[@]} -gt 0 ]] && ewarn "Skipped tests: ${skipped[*]}"
+       [[ ${#failed[@]}  -gt 0 ]] && die "Some tests failed: ${failed[*]}"
 }
 
 pkg_preinst() {

Reply via email to