Tests: add helpers for synchronizecache
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
@@ -434,6 +434,34 @@ do { \
|
||||
CU_ASSERT_EQUAL(_r, 0); \
|
||||
} while (0);
|
||||
|
||||
#define SYNCHRONIZECACHE10(...) \
|
||||
do { \
|
||||
int _r; \
|
||||
_r = synchronizecache10(__VA_ARGS__); \
|
||||
if (_r == -2) { \
|
||||
logging(LOG_NORMAL, "[SKIPPED] SYNCHRONIZECACHE10 " \
|
||||
"is not implemented."); \
|
||||
CU_PASS("[SKIPPED] Target does not support " \
|
||||
"SYNCHRONIZECACHE10. Skipping test"); \
|
||||
return; \
|
||||
} \
|
||||
CU_ASSERT_EQUAL(_r, 0); \
|
||||
} while (0);
|
||||
|
||||
#define SYNCHRONIZECACHE16(...) \
|
||||
do { \
|
||||
int _r; \
|
||||
_r = synchronizecache16(__VA_ARGS__); \
|
||||
if (_r == -2) { \
|
||||
logging(LOG_NORMAL, "[SKIPPED] SYNCHRONIZECACHE16 " \
|
||||
"is not implemented."); \
|
||||
CU_PASS("[SKIPPED] Target does not support " \
|
||||
"SYNCHRONIZECACHE16. Skipping test"); \
|
||||
return; \
|
||||
} \
|
||||
CU_ASSERT_EQUAL(_r, 0); \
|
||||
} while (0);
|
||||
|
||||
#define TESTUNITREADY(...) \
|
||||
do { \
|
||||
int _r; \
|
||||
|
||||
@@ -25,6 +25,22 @@
|
||||
#include "iscsi-support.h"
|
||||
#include "iscsi-test-cu.h"
|
||||
|
||||
static void
|
||||
test_synchronizecache10(void)
|
||||
{
|
||||
logging(LOG_VERBOSE, "Test SYNCHRONIZECACHE10 when medium is ejected.");
|
||||
SYNCHRONIZECACHE10(sd, 0, 1, 1, 1,
|
||||
EXPECT_NO_MEDIUM);
|
||||
}
|
||||
|
||||
static void
|
||||
test_synchronizecache16(void)
|
||||
{
|
||||
logging(LOG_VERBOSE, "Test SYNCHRONIZECACHE16 when medium is ejected.");
|
||||
SYNCHRONIZECACHE16(sd, 0, 1, 1, 1,
|
||||
EXPECT_NO_MEDIUM);
|
||||
}
|
||||
|
||||
void
|
||||
test_nomedia_sbc(void)
|
||||
{
|
||||
@@ -53,25 +69,8 @@ test_nomedia_sbc(void)
|
||||
EXPECT_NO_MEDIUM);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test SYNCHRONIZECACHE10 when medium is ejected.");
|
||||
ret = synchronizecache10(sd, 0, 1, 1, 1,
|
||||
EXPECT_NO_MEDIUM);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"SYNCHRONIZECACHE10");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test SYNCHRONIZECACHE16 when medium is ejected.");
|
||||
ret = synchronizecache16(sd, 0, 1, 1, 1,
|
||||
EXPECT_NO_MEDIUM);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"SYNCHRONIZECACHE16");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
test_synchronizecache10();
|
||||
test_synchronizecache16();
|
||||
|
||||
logging(LOG_VERBOSE, "Test READ10 when medium is ejected.");
|
||||
ret = read10(sd, NULL, 0, block_size, block_size,
|
||||
|
||||
Reference in New Issue
Block a user