From e725788eeb505f4d7547a9c940468b063f81f920 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sat, 19 Sep 2015 16:12:01 -0700 Subject: [PATCH] TESTS: WriteAtomic fixes to handle devices that do not return BlockLimits VPD Signed-off-by: Ronnie Sahlberg --- test-tool/test_writeatomic16_0blocks.c | 6 ++++++ test-tool/test_writeatomic16_beyond_eol.c | 5 +++++ test-tool/test_writeatomic16_dpofua.c | 5 +++++ test-tool/test_writeatomic16_simple.c | 6 +++++- test-tool/test_writeatomic16_wrprotect.c | 8 +++++--- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/test-tool/test_writeatomic16_0blocks.c b/test-tool/test_writeatomic16_0blocks.c index 1c948f8..5cd7b45 100644 --- a/test-tool/test_writeatomic16_0blocks.c +++ b/test-tool/test_writeatomic16_0blocks.c @@ -31,7 +31,13 @@ test_writeatomic16_0blocks(void) CHECK_FOR_DATALOSS; CHECK_FOR_SBC; + if (!inq_bl) { + CU_PASS("BlockLimits VPD is not available. Skipping test.\n"); + return; + } + logging(LOG_VERBOSE, LOG_BLANK_LINE); + align = inq_bl->atomic_align ? inq_bl->atomic_align : 1; logging(LOG_VERBOSE, "Test WRITEATOMIC16 0-blocks at LBA==0"); ret = writeatomic16(sd, 0, 0, block_size, diff --git a/test-tool/test_writeatomic16_beyond_eol.c b/test-tool/test_writeatomic16_beyond_eol.c index c4a2d12..5308d72 100644 --- a/test-tool/test_writeatomic16_beyond_eol.c +++ b/test-tool/test_writeatomic16_beyond_eol.c @@ -35,6 +35,11 @@ test_writeatomic16_beyond_eol(void) CHECK_FOR_DATALOSS; CHECK_FOR_SBC; + if (!inq_bl) { + CU_PASS("BlockLimits VPD is not available. Skipping test.\n"); + return; + } + logging(LOG_VERBOSE, LOG_BLANK_LINE); align = inq_bl->atomic_align ? inq_bl->atomic_align : 1; diff --git a/test-tool/test_writeatomic16_dpofua.c b/test-tool/test_writeatomic16_dpofua.c index c2b9ae6..87b0ff7 100644 --- a/test-tool/test_writeatomic16_dpofua.c +++ b/test-tool/test_writeatomic16_dpofua.c @@ -41,6 +41,11 @@ test_writeatomic16_dpofua(void) CHECK_FOR_SBC; CHECK_FOR_DATALOSS; + if (!inq_bl) { + CU_PASS("BlockLimits VPD is not available. Skipping test.\n"); + return; + } + gran = inq_bl->atomic_gran ? inq_bl->atomic_gran : 1; buf = alloca(gran * block_size); diff --git a/test-tool/test_writeatomic16_simple.c b/test-tool/test_writeatomic16_simple.c index 9995cab..45a30d3 100644 --- a/test-tool/test_writeatomic16_simple.c +++ b/test-tool/test_writeatomic16_simple.c @@ -36,8 +36,12 @@ test_writeatomic16_simple(void) CHECK_FOR_DATALOSS; CHECK_FOR_SBC; - logging(LOG_VERBOSE, LOG_BLANK_LINE); + if (!inq_bl) { + CU_PASS("BlockLimits VPD is not available. Skipping test.\n"); + return; + } + logging(LOG_VERBOSE, LOG_BLANK_LINE); gran = inq_bl->atomic_gran ? inq_bl->atomic_gran : 1; ret = writeatomic16(sd, 0, diff --git a/test-tool/test_writeatomic16_wrprotect.c b/test-tool/test_writeatomic16_wrprotect.c index 1d5267b..900e295 100644 --- a/test-tool/test_writeatomic16_wrprotect.c +++ b/test-tool/test_writeatomic16_wrprotect.c @@ -35,9 +35,11 @@ test_writeatomic16_wrprotect(void) CHECK_FOR_DATALOSS; CHECK_FOR_SBC; - /* - * Try out different non-zero values for WRPROTECT. - */ + if (!inq_bl) { + CU_PASS("BlockLimits VPD is not available. Skipping test.\n"); + return; + } + logging(LOG_VERBOSE, LOG_BLANK_LINE); gran = inq_bl->atomic_gran ? inq_bl->atomic_gran : 1;