From d4ee014f214479b3ed981cae86a8cb2aa9561b87 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 28 Sep 2015 11:31:49 -0700 Subject: [PATCH] nvme: use CU_ASSERT_FATAL to abort tests on errors Instead of repeating the check for conditions that must be fulfilled to continue the tests, just use CU_ASSERT_FATAL, which will abort the test and return. Change-Id: If617b286a587d9efb1ce57b90061634ed5bc7ae8 Signed-off-by: Daniel Verkamp --- test/lib/nvme/unit/nvme_ns_cmd_c/nvme_ns_cmd_ut.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/test/lib/nvme/unit/nvme_ns_cmd_c/nvme_ns_cmd_ut.c b/test/lib/nvme/unit/nvme_ns_cmd_c/nvme_ns_cmd_ut.c index 1245ee357..fb1c4a23d 100644 --- a/test/lib/nvme/unit/nvme_ns_cmd_c/nvme_ns_cmd_ut.c +++ b/test/lib/nvme/unit/nvme_ns_cmd_c/nvme_ns_cmd_ut.c @@ -120,10 +120,7 @@ split_test(void) rc = nvme_ns_cmd_read(&ns, payload, lba, lba_count, NULL, NULL); CU_ASSERT(rc == 0); - CU_ASSERT(g_request != NULL); - if (g_request == NULL) { - return; /* can't run the rest of the tests without crashing if this failed */ - } + CU_ASSERT_FATAL(g_request != NULL); CU_ASSERT(g_request->num_children == 0); free(payload); @@ -149,10 +146,7 @@ split_test2(void) rc = nvme_ns_cmd_read(&ns, payload, lba, lba_count, NULL, NULL); CU_ASSERT(rc == 0); - CU_ASSERT(g_request != NULL); - if (g_request == NULL) { - return; /* can't run the rest of the tests without crashing if this failed */ - } + CU_ASSERT_FATAL(g_request != NULL); CU_ASSERT(g_request->num_children == 2);