Lines Matching +full:sector +full:- +full:count

4  * SPDX-License-Identifier: Apache-2.0
46 /* Assume the largest sector we will encounter is 512 bytes */
49 /* Sector counts to read */
61 /* + 4 to make sure the second buffer is dword-aligned for NVME */
115 zassert_equal(rc, 0, "Disk ioctl get sector count failed"); in test_setup()
121 zassert_equal(rc, 0, "Disk ioctl get sector size failed"); in test_setup()
122 TC_PRINT("Disk reports sector size %u\n", cmd_buf); in test_setup()
125 /* We could allocate memory once we know the sector size, but instead in test_setup()
149 int rc, sector; in test_sector_read() local
152 /* Read from disk sector 0*/ in test_sector_read()
154 zassert_equal(rc, 0, "Failed to read from sector zero"); in test_sector_read()
155 /* Read from a sector in the "middle" of the disk */ in test_sector_read()
157 sector = disk_sector_count / 2 - num_sectors; in test_sector_read()
159 sector = 0; in test_sector_read()
162 rc = read_sector(buf, sector, num_sectors); in test_sector_read()
163 zassert_equal(rc, 0, "Failed to read from mid disk sector"); in test_sector_read()
164 /* Read from the last sector */ in test_sector_read()
165 rc = read_sector(buf, disk_sector_count - 1, num_sectors); in test_sector_read()
167 zassert_equal(rc, 0, "Failed to read from last sector"); in test_sector_read()
169 zassert_not_equal(rc, 0, "Disk should fail to read out of sector bounds"); in test_sector_read()
173 /* Write sector of disk, and check the data to ensure it is valid
174 * WARNING: this test is destructive- it will overwrite data on the disk!
185 /* Now write data to the sector */ in write_sector_checked()
203 * WARNING: this test is destructive- it will overwrite data on the disk!
207 int rc, sector; in test_sector_write() local
210 /* Write to disk sector zero */ in test_sector_write()
212 zassert_equal(rc, 0, "Failed to write to sector zero"); in test_sector_write()
213 /* Write to a sector in the "middle" of the disk */ in test_sector_write()
215 sector = disk_sector_count / 2 - num_sectors; in test_sector_write()
217 sector = 0; in test_sector_write()
220 rc = write_sector_checked(wbuf, rbuf, sector, num_sectors); in test_sector_write()
221 zassert_equal(rc, 0, "Failed to write to mid disk sector"); in test_sector_write()
222 /* Write to the last sector */ in test_sector_write()
223 rc = write_sector_checked(wbuf, rbuf, disk_sector_count - 1, num_sectors); in test_sector_write()
225 zassert_equal(rc, 0, "Failed to write to last sector"); in test_sector_write()
227 zassert_not_equal(rc, 0, "Disk should fail to write out of sector bounds"); in test_sector_write()
247 /* Read from sector, and compare it to the first read */ in ZTEST()
250 zassert_equal(rc, 0, "Failed to read from disk at same sector location"); in ZTEST()
258 * WARNING: this test is destructive- it will overwrite data on the disk!
264 /* Verify all 4 sector write sizes work */ in ZTEST()
272 /* Write to sector- helper function verifies written data is correct */ in ZTEST()
274 zassert_equal(rc, 0, "Failed to write to disk at same sector location"); in ZTEST()