summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-06-15 08:55:28 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-06-15 08:55:28 +0000
commit518d3fcc77bc21c0ff89f1dcb93c02eb51305ecc (patch)
tree1ab2206b4ba98807d9c3ddb8aab0c0a5e5606bc6 /apps
parent9a7a542de2cac4293a7834ecaebaa4dd14206683 (diff)
downloadrockbox-518d3fcc77bc21c0ff89f1dcb93c02eb51305ecc.tar.gz
rockbox-518d3fcc77bc21c0ff89f1dcb93c02eb51305ecc.zip
test_disk: print return values in case of error
Also print the requested read/write size git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26855 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/test_disk.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c
index c83fb7e1d2..443e9eb18b 100644
--- a/apps/plugins/test_disk.c
+++ b/apps/plugins/test_disk.c
@@ -110,7 +110,7 @@ static bool test_fs(void)
{
unsigned char text_buf[32];
int total, current, align;
- int fd;
+ int fd, ret;
log_init();
log_text("test_disk WRITE&VERIFY", true);
@@ -126,7 +126,7 @@ static bool test_fs(void)
fd = rb->creat(TEST_FILE, 0666);
if (fd < 0)
{
- rb->splash(HZ, "creat() failed.");
+ rb->splashf(HZ, "creat() failed: %d", fd);
goto error;
}
@@ -142,9 +142,10 @@ static bool test_fs(void)
log_text(text_buf, false);
mem_fill_frnd(audiobuf + align, current);
- if (current != rb->write(fd, audiobuf + align, current))
+ ret = rb->write(fd, audiobuf + align, current);
+ if (current != ret)
{
- rb->splash(0, "write() failed.");
+ rb->splashf(0, "write() failed: %d/%d", ret, current);
rb->close(fd);
goto error;
}
@@ -155,7 +156,7 @@ static bool test_fs(void)
fd = rb->open(TEST_FILE, O_RDONLY);
if (fd < 0)
{
- rb->splash(0, "open() failed.");
+ rb->splashf(0, "open() failed: %d", ret);
goto error;
}
@@ -170,9 +171,10 @@ static bool test_fs(void)
current >> 10, total >> 10);
log_text(text_buf, false);
- if (current != rb->read(fd, audiobuf + align, current))
+ ret = rb->read(fd, audiobuf + align, current);
+ if (current != ret)
{
- rb->splash(0, "read() failed.");
+ rb->splashf(0, "read() failed: %d/%d", ret, current);
rb->close(fd);
goto error;
}
@@ -201,7 +203,7 @@ error:
static bool file_speed(int chunksize, bool align)
{
unsigned char text_buf[64];
- int fd;
+ int fd, ret;
long filesize = 0;
long size, time;
@@ -214,15 +216,16 @@ static bool file_speed(int chunksize, bool align)
fd = rb->creat(TEST_FILE, 0666);
if (fd < 0)
{
- rb->splash(HZ, "creat() failed.");
+ rb->splashf(HZ, "creat() failed: %d", fd);
goto error;
}
time = *rb->current_tick;
while (TIME_BEFORE(*rb->current_tick, time + TEST_TIME*HZ))
{
- if (chunksize != rb->write(fd, audiobuf + (align ? 0 : 1), chunksize))
+ ret = rb->write(fd, audiobuf + (align ? 0 : 1), chunksize);
+ if (chunksize != ret)
{
- rb->splash(HZ, "write() failed.");
+ rb->splashf(HZ, "write() failed: %d/%d", ret, chunksize);
rb->close(fd);
goto error;
}
@@ -238,15 +241,16 @@ static bool file_speed(int chunksize, bool align)
fd = rb->open(TEST_FILE, O_WRONLY);
if (fd < 0)
{
- rb->splash(0, "open() failed.");
+ rb->splashf(0, "open() failed: %d", fd);
goto error;
}
time = *rb->current_tick;
for (size = filesize; size > 0; size -= chunksize)
{
- if (chunksize != rb->write(fd, audiobuf + (align ? 0 : 1), chunksize))
+ ret = rb->write(fd, audiobuf + (align ? 0 : 1), chunksize);
+ if (chunksize != ret)
{
- rb->splash(0, "write() failed.");
+ rb->splashf(0, "write() failed: %d/%d", ret, chunksize);
rb->close(fd);
goto error;
}
@@ -261,15 +265,16 @@ static bool file_speed(int chunksize, bool align)
fd = rb->open(TEST_FILE, O_RDONLY);
if (fd < 0)
{
- rb->splash(0, "open() failed.");
+ rb->splashf(0, "open() failed: %d", fd);
goto error;
}
time = *rb->current_tick;
for (size = filesize; size > 0; size -= chunksize)
{
- if (chunksize != rb->read(fd, audiobuf + (align ? 0 : 1), chunksize))
+ ret = rb->read(fd, audiobuf + (align ? 0 : 1), chunksize);
+ if (chunksize != ret)
{
- rb->splash(0, "read() failed.");
+ rb->splashf(0, "read() failed: %d/%d", ret, chunksize);
rb->close(fd);
goto error;
}
@@ -315,7 +320,7 @@ static bool test_speed(void)
if (fd < 0)
{
last_file = i;
- rb->splash(HZ, "creat() failed.");
+ rb->splashf(HZ, "creat() failed: %d", fd);
goto error;
}
rb->close(fd);
@@ -335,7 +340,7 @@ static bool test_speed(void)
fd = rb->open(text_buf, O_RDONLY);
if (fd < 0)
{
- rb->splash(HZ, "open() failed.");
+ rb->splashf(HZ, "open() failed: %d", fd);
goto error;
}
rb->close(fd);