All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sandipan Das <sandipan@linux.ibm.com>
To: mpe@ellerman.id.au
Cc: fweimer@redhat.com, aneesh.kumar@linux.ibm.com,
	linuxram@us.ibm.com, linuxppc-dev@lists.ozlabs.org,
	bauerman@linux.ibm.com
Subject: [PATCH 4/5] selftests/powerpc: Add helper to exit on failure
Date: Thu, 16 Jul 2020 16:33:46 +0530	[thread overview]
Message-ID: <dac282d5c2e96e7816dc522e4e20d56d7c79c898.1594897099.git.sandipan@linux.ibm.com> (raw)
In-Reply-To: <cover.1594897099.git.sandipan@linux.ibm.com>

This adds a helper similar to FAIL_IF() which lets a
program exit with code 1 (to indicate failure) when
the given condition is true.

Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
---
 tools/testing/selftests/powerpc/include/utils.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/testing/selftests/powerpc/include/utils.h b/tools/testing/selftests/powerpc/include/utils.h
index 7f259f36e23bc..69d16875802da 100644
--- a/tools/testing/selftests/powerpc/include/utils.h
+++ b/tools/testing/selftests/powerpc/include/utils.h
@@ -72,6 +72,15 @@ do {								\
 	}							\
 } while (0)
 
+#define FAIL_IF_EXIT(x)						\
+do {								\
+	if ((x)) {						\
+		fprintf(stderr,					\
+		"[FAIL] Test FAILED on line %d\n", __LINE__);	\
+		_exit(1);					\
+	}							\
+} while (0)
+
 /* The test harness uses this, yes it's gross */
 #define MAGIC_SKIP_RETURN_VALUE	99
 
-- 
2.25.1


  parent reply	other threads:[~2020-07-16 11:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 11:03 [PATCH 0/5] Improvements to pkey tests Sandipan Das
2020-07-16 11:03 ` [PATCH 1/5] selftests/powerpc: Move pkey helpers to headers Sandipan Das
2020-07-16 11:03 ` [PATCH 2/5] selftests/powerpc: Add pkey helpers for rights Sandipan Das
2020-07-16 11:03 ` [PATCH 3/5] selftests/powerpc: Harden test for execute-disabled pkeys Sandipan Das
2020-07-16 11:03 ` Sandipan Das [this message]
2020-07-16 11:03 ` [PATCH 5/5] selftests/powerpc: Add test for pkey siginfo verification Sandipan Das
2020-07-26 14:05   ` Michael Ellerman
2020-07-26 14:40     ` Christophe Leroy
2020-07-26 23:52       ` Michael Ellerman
2020-07-27  3:27         ` Sandipan Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dac282d5c2e96e7816dc522e4e20d56d7c79c898.1594897099.git.sandipan@linux.ibm.com \
    --to=sandipan@linux.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=bauerman@linux.ibm.com \
    --cc=fweimer@redhat.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=linuxram@us.ibm.com \
    --cc=mpe@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.