test/nvme: add file touch option to aer test
Tests can specify this new -t flag to tell aer to touch the specified file after its ready to receive an AER. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I08cb584d487769d49a9345587c53529d7c02c528 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452804 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
3d9f193624
commit
f5fbac9195
@ -61,6 +61,7 @@ static int g_aer_done = 0;
|
|||||||
static int g_temperature_done = 0;
|
static int g_temperature_done = 0;
|
||||||
static int g_failed = 0;
|
static int g_failed = 0;
|
||||||
static struct spdk_nvme_transport_id g_trid;
|
static struct spdk_nvme_transport_id g_trid;
|
||||||
|
static char *g_touch_file;
|
||||||
|
|
||||||
/* Enable AER temperature test */
|
/* Enable AER temperature test */
|
||||||
static int g_enable_temp_test = 0;
|
static int g_enable_temp_test = 0;
|
||||||
@ -284,6 +285,7 @@ usage(const char *program_name)
|
|||||||
printf("options:\n");
|
printf("options:\n");
|
||||||
printf(" -T enable temperature tests\n");
|
printf(" -T enable temperature tests\n");
|
||||||
printf(" -n expected Namespace attribute notice ID\n");
|
printf(" -n expected Namespace attribute notice ID\n");
|
||||||
|
printf(" -t <file> touch specified file when ready to receive AER\n");
|
||||||
printf(" -r trid remote NVMe over Fabrics target address\n");
|
printf(" -r trid remote NVMe over Fabrics target address\n");
|
||||||
printf(" Format: 'key:value [key:value] ...'\n");
|
printf(" Format: 'key:value [key:value] ...'\n");
|
||||||
printf(" Keys:\n");
|
printf(" Keys:\n");
|
||||||
@ -309,7 +311,7 @@ parse_args(int argc, char **argv)
|
|||||||
g_trid.trtype = SPDK_NVME_TRANSPORT_PCIE;
|
g_trid.trtype = SPDK_NVME_TRANSPORT_PCIE;
|
||||||
snprintf(g_trid.subnqn, sizeof(g_trid.subnqn), "%s", SPDK_NVMF_DISCOVERY_NQN);
|
snprintf(g_trid.subnqn, sizeof(g_trid.subnqn), "%s", SPDK_NVMF_DISCOVERY_NQN);
|
||||||
|
|
||||||
while ((op = getopt(argc, argv, "n:r:HL:T")) != -1) {
|
while ((op = getopt(argc, argv, "n:r:t:HL:T")) != -1) {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case 'n':
|
case 'n':
|
||||||
val = spdk_strtol(optarg, 10);
|
val = spdk_strtol(optarg, 10);
|
||||||
@ -325,6 +327,9 @@ parse_args(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 't':
|
||||||
|
g_touch_file = optarg;
|
||||||
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
rc = spdk_log_set_flag(optarg);
|
rc = spdk_log_set_flag(optarg);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@ -551,6 +556,18 @@ int main(int argc, char **argv)
|
|||||||
spdk_nvme_ctrlr_register_aer_callback(dev->ctrlr, aer_cb, dev);
|
spdk_nvme_ctrlr_register_aer_callback(dev->ctrlr, aer_cb, dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_touch_file) {
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
fd = open(g_touch_file, O_CREAT | O_EXCL | O_RDWR, S_IFREG);
|
||||||
|
if (fd == -1) {
|
||||||
|
fprintf(stderr, "Could not touch %s (%s).\n", g_touch_file, strerror(errno));
|
||||||
|
g_failed = true;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
/* AER temperature test */
|
/* AER temperature test */
|
||||||
if (g_enable_temp_test) {
|
if (g_enable_temp_test) {
|
||||||
if (spdk_aer_temperature_test()) {
|
if (spdk_aer_temperature_test()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user