diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-10-10 00:03:57 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-10-10 00:03:57 +0200 |
commit | 1ca718b57fe0af737b0d2fb4e903162e5bb56852 (patch) | |
tree | 6d01d24d6d07f1a92204c64cbfe5b62c299617eb /src/systemcmds/tests | |
parent | ed00567400bd6ce24e25dc1038ce40f959205a68 (diff) | |
download | px4-firmware-1ca718b57fe0af737b0d2fb4e903162e5bb56852.tar.gz px4-firmware-1ca718b57fe0af737b0d2fb4e903162e5bb56852.tar.bz2 px4-firmware-1ca718b57fe0af737b0d2fb4e903162e5bb56852.zip |
Slight fix to test, but still fails validating written data after non-aligned writes
Diffstat (limited to 'src/systemcmds/tests')
-rw-r--r-- | src/systemcmds/tests/tests_file.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/systemcmds/tests/tests_file.c b/src/systemcmds/tests/tests_file.c index 372bc5c90..e9db4716d 100644 --- a/src/systemcmds/tests/tests_file.c +++ b/src/systemcmds/tests/tests_file.c @@ -103,18 +103,35 @@ test_file(int argc, char *argv[]) perf_print_counter(wperf); perf_free(wperf); + close(fd); + + fd = open("/fs/microsd/testfile", O_RDONLY); + /* read back data for validation */ for (unsigned i = 0; i < iterations; i++) { int rret = read(fd, read_buf, 512); + + if (rret != 512) { + warn("READ ERROR!"); + break; + } /* compare value */ + bool compare_ok = true; 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)); + compare_ok = false; + break; } } + if (!compare_ok) { + warnx("ABORTING FURTHER COMPARISON DUE TO ERROR"); + break; + } + } /* read back data for alignment checks */ |