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 <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2015-09-28 11:31:49 -07:00
parent d2e10e88ec
commit d4ee014f21

View File

@ -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);