mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 03:03:34 +08:00
Slight fix to test, but still fails validating written data after non-aligned writes
This commit is contained in:
@@ -103,18 +103,35 @@ test_file(int argc, char *argv[])
|
|||||||
perf_print_counter(wperf);
|
perf_print_counter(wperf);
|
||||||
perf_free(wperf);
|
perf_free(wperf);
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
fd = open("/fs/microsd/testfile", O_RDONLY);
|
||||||
|
|
||||||
/* read back data for validation */
|
/* read back data for validation */
|
||||||
for (unsigned i = 0; i < iterations; i++) {
|
for (unsigned i = 0; i < iterations; i++) {
|
||||||
int rret = read(fd, read_buf, 512);
|
int rret = read(fd, read_buf, 512);
|
||||||
|
|
||||||
|
if (rret != 512) {
|
||||||
|
warn("READ ERROR!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* compare value */
|
/* compare value */
|
||||||
|
bool compare_ok = true;
|
||||||
|
|
||||||
for (int j = 0; j < 512; j++) {
|
for (int j = 0; j < 512; j++) {
|
||||||
if (read_buf[j] != write_buf[j + (i % 64)]) {
|
if (read_buf[j] != write_buf[j + 1/*+ (i % 64)*/]) {
|
||||||
warnx("COMPARISON ERROR: byte %d, align shift: %d", j, (i % 64));
|
warnx("COMPARISON ERROR: byte %d, align shift: %d", j, (i % 64));
|
||||||
|
compare_ok = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!compare_ok) {
|
||||||
|
warnx("ABORTING FURTHER COMPARISON DUE TO ERROR");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read back data for alignment checks */
|
/* read back data for alignment checks */
|
||||||
|
|||||||
Reference in New Issue
Block a user