Commit d4ee014f authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent d2e10e88
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -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);