#include "../perf-sys.h"
 #include "cloexec.h"
 
+/*
+ * PowerPC and S390 do not support creation of instruction breakpoints using the
+ * perf_event interface.
+ *
+ * Just disable the test for these architectures until these issues are
+ * resolved.
+ */
+#if defined(__powerpc__) || defined(__s390x__)
+#define BP_ACCOUNT_IS_SUPPORTED 0
+#else
+#define BP_ACCOUNT_IS_SUPPORTED 1
+#endif
+
 static volatile long the_var;
 
 static noinline int test_function(void)
        int bp_cnt = detect_cnt(true);
        int share  = detect_share(wp_cnt, bp_cnt);
 
+       if (!BP_ACCOUNT_IS_SUPPORTED) {
+               pr_debug("Test not supported on this architecture");
+               return TEST_SKIP;
+       }
+
        pr_debug("watchpoints count %d, breakpoints count %d, has_ioctl %d, share %d\n",
                 wp_cnt, bp_cnt, has_ioctl, share);
 
        return bp_accounting(wp_cnt, share);
 }
 
-static bool test__bp_account_is_supported(void)
-{
-       /*
-        * PowerPC and S390 do not support creation of instruction
-        * breakpoints using the perf_event interface.
-        *
-        * Just disable the test for these architectures until these
-        * issues are resolved.
-        */
-#if defined(__powerpc__) || defined(__s390x__)
-       return false;
-#else
-       return true;
-#endif
-}
-
-static struct test_case bp_accounting_tests[] = {
-       TEST_CASE("Breakpoint accounting", bp_accounting),
-       { .name = NULL, }
-};
-
-struct test_suite suite__bp_accounting = {
-       .desc = "Breakpoint accounting",
-       .test_cases = bp_accounting_tests,
-       .is_supported = test__bp_account_is_supported,
-};
+DEFINE_SUITE("Breakpoint accounting", bp_accounting);
 
        struct sigaction sa;
        long long count1, count2, count3;
 
+       if (!BP_SIGNAL_IS_SUPPORTED) {
+               pr_debug("Test not supported on this architecture");
+               return TEST_SKIP;
+       }
+
        /* setup SIGIO signal handler */
        memset(&sa, 0, sizeof(struct sigaction));
        sa.sa_sigaction = (void *) sig_handler;
                TEST_OK : TEST_FAIL;
 }
 
-bool test__bp_signal_is_supported(void)
-{
-       /*
-        * PowerPC and S390 do not support creation of instruction
-        * breakpoints using the perf_event interface.
-        *
-        * ARM requires explicit rounding down of the instruction
-        * pointer in Thumb mode, and then requires the single-step
-        * to be handled explicitly in the overflow handler to avoid
-        * stepping into the SIGIO handler and getting stuck on the
-        * breakpointed instruction.
-        *
-        * Since arm64 has the same issue with arm for the single-step
-        * handling, this case also gets stuck on the breakpointed
-        * instruction.
-        *
-        * Just disable the test for these architectures until these
-        * issues are resolved.
-        */
-#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) || \
-    defined(__aarch64__)
-       return false;
-#else
-       return true;
-#endif
-}
-
-static struct test_case bp_signal_tests[] = {
-       TEST_CASE("Breakpoint overflow signal handler", bp_signal),
-       { .name = NULL, }
-};
-
-struct test_suite suite__bp_signal = {
-       .desc = "Breakpoint overflow signal handler",
-       .test_cases = bp_signal_tests,
-       .is_supported = test__bp_signal_is_supported,
-};
+DEFINE_SUITE("Breakpoint overflow signal handler", bp_signal);
 
        long long count;
        int fd, i, fails = 0;
 
+       if (!BP_SIGNAL_IS_SUPPORTED) {
+               pr_debug("Test not supported on this architecture");
+               return TEST_SKIP;
+       }
+
        /* setup SIGIO signal handler */
        memset(&sa, 0, sizeof(struct sigaction));
        sa.sa_sigaction = (void *) sig_handler;
        return fails ? TEST_FAIL : TEST_OK;
 }
 
-static struct test_case bp_signal_overflow_tests[] = {
-       TEST_CASE("Breakpoint overflow sampling", bp_signal_overflow),
-       { .name = NULL, }
-};
-
-struct test_suite suite__bp_signal_overflow = {
-       .desc = "Breakpoint overflow sampling",
-       .test_cases = bp_signal_overflow_tests,
-       .is_supported = test__bp_signal_is_supported,
-};
+DEFINE_SUITE("Breakpoint overflow sampling", bp_signal_overflow);
 
 DECLARE_SUITE(perf_time_to_tsc);
 DECLARE_SUITE(dlfilter);
 
-bool test__bp_signal_is_supported(void);
+/*
+ * PowerPC and S390 do not support creation of instruction breakpoints using the
+ * perf_event interface.
+ *
+ * ARM requires explicit rounding down of the instruction pointer in Thumb mode,
+ * and then requires the single-step to be handled explicitly in the overflow
+ * handler to avoid stepping into the SIGIO handler and getting stuck on the
+ * breakpointed instruction.
+ *
+ * Since arm64 has the same issue with arm for the single-step handling, this
+ * case also gets stuck on the breakpointed instruction.
+ *
+ * Just disable the test for these architectures until these issues are
+ * resolved.
+ */
+#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) || defined(__aarch64__)
+#define BP_SIGNAL_IS_SUPPORTED 0
+#else
+#define BP_SIGNAL_IS_SUPPORTED 1
+#endif
 
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 struct thread;