LinuxPPC-Dev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] selftests/powerpc: Fix eeh-basic.sh exit codes
@ 2020-10-14  2:47 Oliver O'Halloran
  2020-10-16 11:02 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver O'Halloran @ 2020-10-14  2:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Oliver O'Halloran

The kselftests test running infrastructure expects tests to finish with an
exit code of 4 if the test decided it should be skipped. Currently
eeh-basic.sh exits with the number of devices that failed to recover, so if
four devices didn't recover we'll report a skip instead of a fail.

Fix this by checking if the return code is non-zero and report success
and failure by returning 0 or 1 respectively. For the cases where should
actually skip return 4.

Fixes: 85d86c8aa52e ("selftests/powerpc: Add basic EEH selftest")
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 tools/testing/selftests/powerpc/eeh/eeh-basic.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/powerpc/eeh/eeh-basic.sh b/tools/testing/selftests/powerpc/eeh/eeh-basic.sh
index 8a8d0f456946..0d783e1065c8 100755
--- a/tools/testing/selftests/powerpc/eeh/eeh-basic.sh
+++ b/tools/testing/selftests/powerpc/eeh/eeh-basic.sh
@@ -1,17 +1,19 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-only
 
+KSELFTESTS_SKIP=4
+
 . ./eeh-functions.sh
 
 if ! eeh_supported ; then
 	echo "EEH not supported on this system, skipping"
-	exit 0;
+	exit $KSELFTESTS_SKIP;
 fi
 
 if [ ! -e "/sys/kernel/debug/powerpc/eeh_dev_check" ] && \
    [ ! -e "/sys/kernel/debug/powerpc/eeh_dev_break" ] ; then
 	echo "debugfs EEH testing files are missing. Is debugfs mounted?"
-	exit 1;
+	exit $KSELFTESTS_SKIP;
 fi
 
 pre_lspci=`mktemp`
@@ -84,4 +86,5 @@ echo "$failed devices failed to recover ($dev_count tested)"
 lspci | diff -u $pre_lspci -
 rm -f $pre_lspci
 
-exit $failed
+test "$failed" == 0
+exit $?
-- 
2.26.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests/powerpc: Fix eeh-basic.sh exit codes
  2020-10-14  2:47 [PATCH] selftests/powerpc: Fix eeh-basic.sh exit codes Oliver O'Halloran
@ 2020-10-16 11:02 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2020-10-16 11:02 UTC (permalink / raw)
  To: Oliver O'Halloran, linuxppc-dev

On Wed, 14 Oct 2020 13:47:11 +1100, Oliver O'Halloran wrote:
> The kselftests test running infrastructure expects tests to finish with an
> exit code of 4 if the test decided it should be skipped. Currently
> eeh-basic.sh exits with the number of devices that failed to recover, so if
> four devices didn't recover we'll report a skip instead of a fail.
> 
> Fix this by checking if the return code is non-zero and report success
> and failure by returning 0 or 1 respectively. For the cases where should
> actually skip return 4.

Applied to powerpc/next.

[1/1] selftests/powerpc: Fix eeh-basic.sh exit codes
      https://git.kernel.org/powerpc/c/996f9e0f93f16211945c8d5f18f296a88cb32f91

cheers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14  2:47 [PATCH] selftests/powerpc: Fix eeh-basic.sh exit codes Oliver O'Halloran
2020-10-16 11:02 ` Michael Ellerman

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org
	public-inbox-index linuxppc-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git