Commit f0728fda authored by Marcin Spiewak's avatar Marcin Spiewak Committed by Tomasz Zawadzki
Browse files

nvme_fuzz: add call to spdk_app_stop(-1) on errors



When a fuzzer is started, to properly detect errors when
connecting to a controller, 'return -1' is not enough.
We also need to call spdk_app_stop(-1) when an error
is detected to signal the fuzzer we have failed.

I have encountered such a situation when due to memory
leak, setting up of the controller queues failed
(no memory for structures). Return -1 didin't caused
the fuzzer to stop the test, it was keep trying to call
TestOneInput function for the whole scheduled test
time (16 hrs).
Adding spdk_app_stop(-1) allows the fuzzer to detect the
error so the Jenkins job can fail early, just after the error
is detected.

Change-Id: I08ca4de7d21b13df3bcf93a1ccffbbec32ad9f4a
Signed-off-by: default avatarMarcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21894


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarSebastian Brzezinka <sebastian.brzezinka@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent a4a851cd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -789,6 +789,7 @@ TestOneInput(const uint8_t *data, size_t size)
	if (g_ctrlr == NULL) {
		fprintf(stderr, "spdk_nvme_connect() failed for transport address '%s'\n",
			g_trid.traddr);
		spdk_app_stop(-1);
		return -1;
	}

@@ -809,6 +810,9 @@ detach_ctrlr:
	if (detach_ctx) {
		spdk_nvme_detach_poll(detach_ctx);
	}
	if (ret < 0) {
		spdk_app_stop(ret);
	}

	return ret;
}