Comments (2)
Thought there's a way to attach files here...
I'll see what I can do, how I can copy-paste it here without formatting.
from libiscsi.
diff --git a/test-tool/test_unmap_simple.c b/test-tool/test_unmap_simple.c
index d080ae5..a546123 100644
--- a/test-tool/test_unmap_simple.c
+++ b/test-tool/test_unmap_simple.c
@@ -39,10 +39,12 @@ init_lun_with_data(unsigned char *buf, uint64_t lba)
void
test_unmap_simple(void)
{
- int i, ret;
+ int i, ret,max_unmap_bdc, max_unmap;
struct unmap_list list[257];
unsigned char *buf = alloca(256 * block_size);
unsigned char *zbuf = alloca(256 * block_size);
+ struct scsi_inquiry_block_limits *bl;
+ struct scsi_task *bl_task = NULL;
memset(zbuf, 0, 256 * block_size);
logging(LOG_VERBOSE, LOG_BLANK_LINE);
@@ -52,6 +54,22 @@ test_unmap_simple(void)
CHECK_FOR_THIN_PROVISIONING;
CHECK_FOR_SBC;
+ ret = inquiry(iscsic, tgt_lun,
+ 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS,
+ 64, &bl_task);
+ CU_ASSERT_EQUAL(ret, 0);
+ bl = scsi_datain_unmarshall(bl_task);
+
+ if (bl && bl->max_unmap_bdc && bl->max_unmap_bdc <= 256) {
+ max_unmap_bdc = bl->max_unmap_bdc;
+ } else {
+ max_unmap_bdc = 256;
+ }
+ if (bl && bl->max_unmap) {
+ max_unmap = bl->max_unmap;
+ } else {
+ max_unmap = 8192;
+ }
logging(LOG_VERBOSE, "Test UNMAP of 1-256 blocks at the start of the "
"LUN as a single descriptor");
@@ -86,14 +104,14 @@ test_unmap_simple(void)
}
}
- logging(LOG_VERBOSE, "Test UNMAP of 1-256 blocks at the start of the "
+ logging(LOG_VERBOSE, "Test UNMAP of 1 to maximum unmap block descriptor count blocks at the start of the "
"LUN with one descriptor per block");
logging(LOG_VERBOSE, "Write 'a' to the first 256 LBAs");
init_lun_with_data(buf, 0);
CU_ASSERT_EQUAL(ret, 0);
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < max_unmap_bdc; i++) {
list[i].lba = i;
list[i].num = 1;
ret = unmap(iscsic, tgt_lun, 0, list, i + 1);
@@ -118,4 +136,22 @@ test_unmap_simple(void)
}
}
}
+
+ logging(LOG_VERBOSE, "Test UNMAP of more than maximum unmap block descriptor count blocks");
+
+ i++;
+ list[i].lba = i;
+ list[i].num = 1;
+ ret = unmap(iscsic, tgt_lun, 0, list, i + 1);
+ /* we expect to fail unmapping with more than the maximum unmap block descriptor count blocks */
+ CU_ASSERT_NOT_EQUAL(ret, 0);
+
+ logging(LOG_VERBOSE, "Write more than the Maximum unmap LBA count");
+
+ list[0].lba = 0;
+ list[0].num = (max_unmap + 1);
+ ret = unmap(iscsic, tgt_lun, 0, list, 1);
+ /* We expect to fail unmapping with more than the maximum unmap LBA count" */
+ CU_ASSERT_NOT_EQUAL(ret, 0);
+
}
from libiscsi.
Related Issues (20)
- Session leaking resulting from random ISID use
- Ppc64le support has been added in PR#336
- Multiple definition errors in test-tool HOT 4
- Block Device Characteristics failure treated as test failure even though it is an optional command HOT 2
- test_async_write.c file has a minor error when compiling it in CentOS 7 HOT 2
- Building on OSX 10.13 High Sierra, src dir is missing HOT 2
- Missing assert.h lib in examples/iscsi-dd.c HOT 1
- iSCSI.iSCSIResiduals.WriteVerify10Residuals test HOT 1
- uncertain as of how to make connection to target HOT 4
- Can not specify iscsi-inq debug level HOT 1
- iscsi_service failed with : CQ handle Failed
- cannot modify scsi-lowlevel.c file HOT 2
- unable to resolve ipv6 address
- scsi_reportluns_datain_unmarshall incorrect behaviour HOT 2
- write performance is very lower than write performance in XGBE enviroment
- CHAP_A tests does not seem to work as expected
- Question: How to test immediate data? HOT 1
- segfault HOT 1
- sync read calls: where does the data go?
- iscsi-test-cu & logging
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libiscsi.