diff --git a/test-tool/iscsi-support.h b/test-tool/iscsi-support.h index 5ff22c7..72df260 100644 --- a/test-tool/iscsi-support.h +++ b/test-tool/iscsi-support.h @@ -251,6 +251,20 @@ do { \ CU_ASSERT_EQUAL(_r, 0); \ } while (0); +#define PREVENTALLOW(...) \ + do { \ + int _r; \ + _r = preventallow(__VA_ARGS__); \ + if (_r == -2) { \ + logging(LOG_NORMAL, "[SKIPPED] PREVENTALLOW " \ + "is not implemented."); \ + CU_PASS("[SKIPPED] Target does not support " \ + "PREVENTALLOW. Skipping test"); \ + return; \ + } \ + CU_ASSERT_EQUAL(_r, 0); \ + } while (0); + #define READ6(...) \ do { \ int _r; \ @@ -392,6 +406,20 @@ do { \ CU_ASSERT_EQUAL(_r, 0); \ } while (0); +#define STARTSTOPUNIT(...) \ + do { \ + int _r; \ + _r = startstopunit(__VA_ARGS__); \ + if (_r == -2) { \ + logging(LOG_NORMAL, "[SKIPPED] STARTSTOPUNIT " \ + "is not implemented."); \ + CU_PASS("[SKIPPED] Target does not support " \ + "STARTSTOPUNIT. Skipping test"); \ + return; \ + } \ + CU_ASSERT_EQUAL(_r, 0); \ + } while (0); + #define VERIFY10(...) \ do { \ int _r; \ diff --git a/test-tool/test_preventallow_2_itnexuses.c b/test-tool/test_preventallow_2_itnexuses.c index 9dc1cd8..c87d0f6 100644 --- a/test-tool/test_preventallow_2_itnexuses.c +++ b/test-tool/test_preventallow_2_itnexuses.c @@ -47,13 +47,11 @@ test_preventallow_2_itnexuses(void) } logging(LOG_VERBOSE, "Set the PREVENT flag"); - ret = preventallow(sd, 1); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 1); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_REMOVAL_PREVENTED); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); logging(LOG_VERBOSE, "Verify we can still access the media."); ret = testunitready(sd, @@ -67,21 +65,17 @@ test_preventallow_2_itnexuses(void) return; logging(LOG_VERBOSE, "Try to eject the medium on the second connection"); - ret = startstopunit(sd2, 0, 0, 0, 0, 1, 0, - EXPECT_REMOVAL_PREVENTED); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd2, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); logging(LOG_VERBOSE, "Logout the second connection from target"); mpath_sd2_put(sd2); logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed"); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); - ret = preventallow(sd, 0); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_preventallow_cold_reset.c b/test-tool/test_preventallow_cold_reset.c index e4c2ce9..fd703de 100644 --- a/test-tool/test_preventallow_cold_reset.c +++ b/test-tool/test_preventallow_cold_reset.c @@ -45,13 +45,11 @@ test_preventallow_cold_reset(void) } logging(LOG_VERBOSE, "Set the PREVENT flag"); - ret = preventallow(sd, 1); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 1); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_REMOVAL_PREVENTED); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); logging(LOG_VERBOSE, "Verify we can still access the media."); ret = testunitready(sd, @@ -68,9 +66,8 @@ test_preventallow_cold_reset(void) logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify we can not access the media."); ret = testunitready(sd, @@ -78,19 +75,14 @@ test_preventallow_cold_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed"); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); - ret = preventallow(sd, 0); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_preventallow_eject.c b/test-tool/test_preventallow_eject.c index 1729b29..1a4e061 100644 --- a/test-tool/test_preventallow_eject.c +++ b/test-tool/test_preventallow_eject.c @@ -28,8 +28,8 @@ void test_preventallow_eject(void) { - int ret; - + int ret; + CHECK_FOR_SBC; CHECK_FOR_REMOVABLE; @@ -37,18 +37,11 @@ test_preventallow_eject(void) logging(LOG_VERBOSE, "Test that we can not eject medium when PREVENT is active"); logging(LOG_VERBOSE, "Set the PREVENT flag"); - ret = preventallow(sd, 1); - if (ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] PREVENTALLOW is not implemented"); - CU_PASS("PREVENTALLOW is not implemented"); - return; - } - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 1); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_REMOVAL_PREVENTED); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); logging(LOG_VERBOSE, "Verify we can still access the media."); ret = testunitready(sd, @@ -56,12 +49,11 @@ test_preventallow_eject(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); - ret = preventallow(sd, 0); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); @@ -70,21 +62,16 @@ test_preventallow_eject(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Set the PREVENT flag"); - ret = preventallow(sd, 1); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 1); logging(LOG_VERBOSE, "Try to load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 1, - EXPECT_REMOVAL_PREVENTED); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 1, + EXPECT_REMOVAL_PREVENTED); logging(LOG_VERBOSE, "Clear PREVENT flag"); - ret = preventallow(sd, 0); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 0); logging(LOG_VERBOSE, "Load the medium again"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_preventallow_itnexus_loss.c b/test-tool/test_preventallow_itnexus_loss.c index 67053e7..d604f19 100644 --- a/test-tool/test_preventallow_itnexus_loss.c +++ b/test-tool/test_preventallow_itnexus_loss.c @@ -45,11 +45,11 @@ test_preventallow_itnexus_loss(void) } logging(LOG_VERBOSE, "Set the PREVENT flag"); + PREVENTALLOW(sd, 1); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_REMOVAL_PREVENTED); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); logging(LOG_VERBOSE, "Verify we can still access the media."); ret = testunitready(sd, @@ -68,9 +68,8 @@ test_preventallow_itnexus_loss(void) } logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify we can not access the media."); ret = testunitready(sd, @@ -78,19 +77,14 @@ test_preventallow_itnexus_loss(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed"); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); - ret = preventallow(sd, 0); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_preventallow_logout.c b/test-tool/test_preventallow_logout.c index 86802a2..2133a62 100644 --- a/test-tool/test_preventallow_logout.c +++ b/test-tool/test_preventallow_logout.c @@ -45,20 +45,17 @@ test_preventallow_logout(void) } logging(LOG_VERBOSE, "Set the PREVENT flag"); - ret = preventallow(sd, 1); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 1); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_REMOVAL_PREVENTED); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); logging(LOG_VERBOSE, "Verify we can still access the media."); ret = testunitready(sd, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); - logging(LOG_VERBOSE, "Logout from target"); iscsi_logout_sync(sd->iscsi_ctx); iscsi_destroy_context(sd->iscsi_ctx); @@ -71,9 +68,8 @@ test_preventallow_logout(void) } logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify we can not access the media."); ret = testunitready(sd, @@ -81,19 +77,14 @@ test_preventallow_logout(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed"); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); - ret = preventallow(sd, 0); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_preventallow_lun_reset.c b/test-tool/test_preventallow_lun_reset.c index 68227e3..0d96a45 100644 --- a/test-tool/test_preventallow_lun_reset.c +++ b/test-tool/test_preventallow_lun_reset.c @@ -45,13 +45,11 @@ test_preventallow_lun_reset(void) } logging(LOG_VERBOSE, "Set the PREVENT flag"); - ret = preventallow(sd, 1); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 1); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_REMOVAL_PREVENTED); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); logging(LOG_VERBOSE, "Verify we can still access the media."); ret = testunitready(sd, @@ -68,9 +66,8 @@ test_preventallow_lun_reset(void) logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify we can not access the media."); ret = testunitready(sd, @@ -78,18 +75,14 @@ test_preventallow_lun_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed"); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); - ret = preventallow(sd, 0); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_preventallow_simple.c b/test-tool/test_preventallow_simple.c index b6c237a..a66fd61 100644 --- a/test-tool/test_preventallow_simple.c +++ b/test-tool/test_preventallow_simple.c @@ -28,8 +28,6 @@ void test_preventallow_simple(void) { - int ret; - CHECK_FOR_SBC; CHECK_FOR_REMOVABLE; @@ -37,15 +35,8 @@ test_preventallow_simple(void) logging(LOG_VERBOSE, "Test PREVENTALLOW basics"); logging(LOG_VERBOSE, "Test we can set PREVENT flag"); - ret = preventallow(sd, 1); - if (ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] PREVENTALLOW is not implemented"); - CU_PASS("PREVENTALLOW is not implemented"); - return; - } - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 1); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); - ret = preventallow(sd, 0); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 0); } diff --git a/test-tool/test_preventallow_warm_reset.c b/test-tool/test_preventallow_warm_reset.c index 6d7155c..8be600e 100644 --- a/test-tool/test_preventallow_warm_reset.c +++ b/test-tool/test_preventallow_warm_reset.c @@ -45,13 +45,11 @@ test_preventallow_warm_reset(void) } logging(LOG_VERBOSE, "Set the PREVENT flag"); - ret = preventallow(sd, 1); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 1); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_REMOVAL_PREVENTED); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); logging(LOG_VERBOSE, "Verify we can still access the media."); ret = testunitready(sd, @@ -68,9 +66,8 @@ test_preventallow_warm_reset(void) logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify we can not access the media."); ret = testunitready(sd, @@ -78,19 +75,14 @@ test_preventallow_warm_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed"); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); - ret = preventallow(sd, 0); - CU_ASSERT_EQUAL(ret, 0); + PREVENTALLOW(sd, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(sd, 0, 0, 0, 0, 1, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_sanitize_reset.c b/test-tool/test_sanitize_reset.c index c3fd238..c9f2caa 100644 --- a/test-tool/test_sanitize_reset.c +++ b/test-tool/test_sanitize_reset.c @@ -101,9 +101,8 @@ test_sanitize_reset(void) logging(LOG_VERBOSE, "Verify that STARTSTOPUNIT fails with " "SANITIZE_IN_PROGRESS"); - ret = startstopunit(sd, 1, 0, 1, 0, 1, 0, - EXPECT_SANITIZE); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 1, 0, 1, 0, 1, 0, + EXPECT_SANITIZE); logging(LOG_VERBOSE, "Verify that READ16 fails with " "SANITIZE_IN_PROGRESS"); diff --git a/test-tool/test_startstopunit_noloej.c b/test-tool/test_startstopunit_noloej.c index 8926918..77ba875 100644 --- a/test-tool/test_startstopunit_noloej.c +++ b/test-tool/test_startstopunit_noloej.c @@ -40,10 +40,8 @@ test_startstopunit_noloej(void) } logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==0 START==0"); - ret = startstopunit(sd, - 0, 0, 0, 0, 0, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 0, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); ret = testunitready(sd, @@ -51,10 +49,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==0 START==1"); - ret = startstopunit(sd, - 0, 0, 0, 0, 0, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 0, 1, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); ret = testunitready(sd, @@ -62,10 +58,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==0 START==0"); - ret = startstopunit(sd, - 1, 0, 0, 0, 0, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 1, 0, 0, 0, 0, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); ret = testunitready(sd, @@ -73,10 +67,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==0 START==1"); - ret = startstopunit(sd, - 1, 0, 0, 0, 0, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 1, 0, 0, 0, 0, 1, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); ret = testunitready(sd, @@ -84,10 +76,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==1 START==0"); - ret = startstopunit(sd, - 0, 0, 0, 1, 0, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 1, 0, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); ret = testunitready(sd, @@ -95,10 +85,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==1 START==1"); - ret = startstopunit(sd, - 0, 0, 0, 1, 0, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 1, 0, 1, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); ret = testunitready(sd, @@ -106,10 +94,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==1 START==0"); - ret = startstopunit(sd, - 1, 0, 0, 1, 0, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 1, 0, 0, 1, 0, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); ret = testunitready(sd, @@ -117,10 +103,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==1 START==1"); - ret = startstopunit(sd, - 1, 0, 0, 1, 0, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 1, 0, 0, 1, 0, 1, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); ret = testunitready(sd, @@ -129,6 +113,6 @@ test_startstopunit_noloej(void) logging(LOG_VERBOSE, "In case the target did eject the medium, load it again."); - startstopunit(sd, 1, 0, 0, 0, 1, 1, + STARTSTOPUNIT(sd, 1, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_startstopunit_pwrcnd.c b/test-tool/test_startstopunit_pwrcnd.c index 83279a6..6d9157d 100644 --- a/test-tool/test_startstopunit_pwrcnd.c +++ b/test-tool/test_startstopunit_pwrcnd.c @@ -41,10 +41,8 @@ test_startstopunit_pwrcnd(void) logging(LOG_VERBOSE, "Test that media is not ejected when PC!=0"); for (i = 1; i < 16; i++) { - ret = startstopunit(sd, - 1, 0, i, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 1, 0, i, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); ret = testunitready(sd, @@ -53,6 +51,6 @@ test_startstopunit_pwrcnd(void) } logging(LOG_VERBOSE, "In case the target did eject the medium, load it again."); - startstopunit(sd, 1, 0, 0, 0, 1, 1, + STARTSTOPUNIT(sd, 1, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_startstopunit_simple.c b/test-tool/test_startstopunit_simple.c index 689dde4..82cffee 100644 --- a/test-tool/test_startstopunit_simple.c +++ b/test-tool/test_startstopunit_simple.c @@ -42,8 +42,7 @@ test_startstopunit_simple(void) logging(LOG_VERBOSE, "Media is not removable. STARTSTOPUNIT should fail"); } - ret = startstopunit(sd, - 1, 0, 0, 0, 1, 0, + ret = startstopunit(sd, 1, 0, 0, 0, 1, 0, EXPECT_STATUS_GOOD); if (!inq->rmb) { CU_ASSERT_NOT_EQUAL(ret, 0); @@ -59,10 +58,8 @@ test_startstopunit_simple(void) logging(LOG_VERBOSE, "Test we can load the removable the media with IMMED==1"); - ret = startstopunit(sd, - 1, 0, 0, 0, 1, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 1, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify we can read from the media."); ret = testunitready(sd, @@ -70,13 +67,9 @@ test_startstopunit_simple(void) CU_ASSERT_EQUAL(ret, 0); - logging(LOG_VERBOSE, "Test we can eject removable the media with IMMED==1"); - ret = startstopunit(sd, - 0, 0, 0, 0, 1, 0, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is ejected."); ret = testunitready(sd, @@ -85,10 +78,8 @@ test_startstopunit_simple(void) logging(LOG_VERBOSE, "Test we can load the removable the media with IMMED==1"); - ret = startstopunit(sd, - 0, 0, 0, 0, 1, 1, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + STARTSTOPUNIT(sd, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify we can access the media again."); ret = testunitready(sd,