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:
parent
d2e10e88ec
commit
d4ee014f21
@ -120,10 +120,7 @@ split_test(void)
|
|||||||
rc = nvme_ns_cmd_read(&ns, payload, lba, lba_count, NULL, NULL);
|
rc = nvme_ns_cmd_read(&ns, payload, lba, lba_count, NULL, NULL);
|
||||||
|
|
||||||
CU_ASSERT(rc == 0);
|
CU_ASSERT(rc == 0);
|
||||||
CU_ASSERT(g_request != NULL);
|
CU_ASSERT_FATAL(g_request != NULL);
|
||||||
if (g_request == NULL) {
|
|
||||||
return; /* can't run the rest of the tests without crashing if this failed */
|
|
||||||
}
|
|
||||||
|
|
||||||
CU_ASSERT(g_request->num_children == 0);
|
CU_ASSERT(g_request->num_children == 0);
|
||||||
free(payload);
|
free(payload);
|
||||||
@ -149,10 +146,7 @@ split_test2(void)
|
|||||||
rc = nvme_ns_cmd_read(&ns, payload, lba, lba_count, NULL, NULL);
|
rc = nvme_ns_cmd_read(&ns, payload, lba, lba_count, NULL, NULL);
|
||||||
|
|
||||||
CU_ASSERT(rc == 0);
|
CU_ASSERT(rc == 0);
|
||||||
CU_ASSERT(g_request != NULL);
|
CU_ASSERT_FATAL(g_request != NULL);
|
||||||
if (g_request == NULL) {
|
|
||||||
return; /* can't run the rest of the tests without crashing if this failed */
|
|
||||||
}
|
|
||||||
|
|
||||||
CU_ASSERT(g_request->num_children == 2);
|
CU_ASSERT(g_request->num_children == 2);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user