diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2017-05-15 09:02:32 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2017-05-15 09:02:32 +1000 |
commit | 695facc1302a9f252b566d4710991fa9a2d8333d (patch) | |
tree | 173728e26878b3129c83e33b95a9d7ecdd19f488 /test | |
parent | 2c818ec2673ab9ca117f858310f65d7fc4ca9bf0 (diff) |
test: make the initial copy file error messages more sensible
This is most likely the first error message a developer encounters when
running the test suite and the /run/udev/rules.d directory already exists.
Make it more meaningful than the current generic integer comparison failure.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r-- | test/litest.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/litest.c b/test/litest.c index 89fd4f7..a099e1f 100644 --- a/test/litest.c +++ b/test/litest.c @@ -1132,7 +1132,10 @@ litest_copy_file(const char *dest, const char *src, const char *header) litest_assert(file->path); out = open(dest, O_CREAT|O_WRONLY, 0644); - litest_assert_int_gt(out, -1); + if (out == -1) + litest_abort_msg("Failed to write to file %s (%s)\n", + dest, + strerror(errno)); if (header) { length = strlen(header); @@ -1140,7 +1143,10 @@ litest_copy_file(const char *dest, const char *src, const char *header) } in = open(src, O_RDONLY); - litest_assert_int_gt(in, -1); + if (in == -1) + litest_abort_msg("Failed to open file %s (%s)\n", + src, + strerror(errno)); /* lazy, just check for error and empty file copy */ litest_assert_int_gt(sendfile(out, in, NULL, 40960), 0); close(out); |