aboutsummaryrefslogtreecommitdiff
path: root/tests/ubi-tests/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ubi-tests/common.c')
-rw-r--r--tests/ubi-tests/common.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/tests/ubi-tests/common.c b/tests/ubi-tests/common.c
index 2381e67..b605dd9 100644
--- a/tests/ubi-tests/common.c
+++ b/tests/ubi-tests/common.c
@@ -52,8 +52,8 @@ int __initial_check(const char *test, int argc, char * const argv[])
* check this.
*/
if (argc < 2) {
- __err_msg(test, __FUNCTION__, __LINE__,
- "UBI character device node is not specified");
+ __errmsg(test, __FUNCTION__, __LINE__,
+ "UBI character device node is not specified");
return -1;
}
@@ -69,16 +69,16 @@ int __initial_check(const char *test, int argc, char * const argv[])
}
if (dev_info.avail_lebs < MIN_AVAIL_EBS) {
- __err_msg(test, __FUNCTION__, __LINE__,
- "insufficient available eraseblocks %d on UBI "
- "device, required %d",
- dev_info.avail_lebs, MIN_AVAIL_EBS);
+ __errmsg(test, __FUNCTION__, __LINE__,
+ "insufficient available eraseblocks %d on UBI "
+ "device, required %d",
+ dev_info.avail_lebs, MIN_AVAIL_EBS);
goto close;
}
if (dev_info.vol_count != 0) {
- __err_msg(test, __FUNCTION__, __LINE__,
- "device %s is not empty", argv[1]);
+ __errmsg(test, __FUNCTION__, __LINE__,
+ "device %s is not empty", argv[1]);
goto close;
}
@@ -91,15 +91,15 @@ close:
}
/**
- * __err_msg - print a message to stderr.
+ * __errmsg - print a message to stderr.
*
* @test test name
* @func function name
* @line line number
* @fmt format string
*/
-void __err_msg(const char *test, const char *func, int line,
- const char *fmt, ...)
+void __errmsg(const char *test, const char *func, int line,
+ const char *fmt, ...)
{
va_list args;
@@ -156,33 +156,33 @@ int __check_volume(libubi_t libubi, struct ubi_dev_info *dev_info,
}
if (req->alignment != vol_info.alignment) {
- __err_msg(test, func, line,
- "bad alignment: requested %d, got %d",
- req->alignment, vol_info.alignment);
+ __errmsg(test, func, line,
+ "bad alignment: requested %d, got %d",
+ req->alignment, vol_info.alignment);
return -1;
}
if (req->vol_type != vol_info.type) {
- __err_msg(test, func, line, "bad type: requested %d, got %d",
- req->vol_type, vol_info.type);
+ __errmsg(test, func, line, "bad type: requested %d, got %d",
+ req->vol_type, vol_info.type);
return -1;
}
if (strlen(req->name) != strlen(vol_info.name) ||
strcmp(req->name, vol_info.name) != 0) {
- __err_msg(test, func, line,
- "bad name: requested \"%s\", got \"%s\"",
- req->name, vol_info.name);
+ __errmsg(test, func, line,
+ "bad name: requested \"%s\", got \"%s\"",
+ req->name, vol_info.name);
return -1;
}
if (vol_info.corrupted) {
- __err_msg(test, func, line, "corrupted new volume");
+ __errmsg(test, func, line, "corrupted new volume");
return -1;
}
leb_size = dev_info->leb_size - (dev_info->leb_size % req->alignment);
if (leb_size != vol_info.leb_size) {
- __err_msg(test, func, line,
- "bad usable LEB size %d, should be %d",
- vol_info.leb_size, leb_size);
+ __errmsg(test, func, line,
+ "bad usable LEB size %d, should be %d",
+ vol_info.leb_size, leb_size);
return -1;
}
@@ -191,9 +191,9 @@ int __check_volume(libubi_t libubi, struct ubi_dev_info *dev_info,
rsvd_bytes += leb_size - (rsvd_bytes % leb_size);
if (rsvd_bytes != vol_info.rsvd_bytes) {
- __err_msg(test, func, line,
- "bad reserved bytes %lld, should be %lld",
- vol_info.rsvd_bytes, rsvd_bytes);
+ __errmsg(test, func, line,
+ "bad reserved bytes %lld, should be %lld",
+ vol_info.rsvd_bytes, rsvd_bytes);
return -1;
}
@@ -224,7 +224,7 @@ int __check_vol_patt(libubi_t libubi, const char *test, const char *func,
fd = open(node, O_RDONLY);
if (fd == -1) {
__failed(test, func, line, "open");
- __err_msg(test, func, line, "cannot open \"%s\"\n", node);
+ __errmsg(test, func, line, "cannot open \"%s\"\n", node);
return -1;
}
@@ -241,23 +241,23 @@ int __check_vol_patt(libubi_t libubi, const char *test, const char *func,
ret = read(fd, buf, 512);
if (ret == -1) {
__failed(test, func, line, "read");
- __err_msg(test, func, line, "bytes = %lld, ret = %d",
- bytes, ret);
+ __errmsg(test, func, line, "bytes = %lld, ret = %d",
+ bytes, ret);
goto close;
}
if (ret == 0 && bytes + ret < vol_info.data_bytes) {
- __err_msg(test, func, line,
- "EOF, but read only %lld bytes of %lld",
- bytes + ret, vol_info.data_bytes);
+ __errmsg(test, func, line,
+ "EOF, but read only %lld bytes of %lld",
+ bytes + ret, vol_info.data_bytes);
goto close;
}
for (i = 0; i < ret; i++)
if (buf[i] != byte) {
- __err_msg(test, func, line,
- "byte at %lld is not %#x but %#x",
- bytes + i, byte, (int)buf[i]);
+ __errmsg(test, func, line,
+ "byte at %lld is not %#x but %#x",
+ bytes + i, byte, (int)buf[i]);
goto close;
}
@@ -295,13 +295,13 @@ int __update_vol_patt(libubi_t libubi, const char *test, const char *func,
fd = open(node, O_RDWR);
if (fd == -1) {
__failed(test, func, line, "open");
- __err_msg(test, func, line, "cannot open \"%s\"\n", node);
+ __errmsg(test, func, line, "cannot open \"%s\"\n", node);
return -1;
}
if (ubi_update_start(libubi, fd, bytes)) {
__failed(test, func, line, "ubi_update_start");
- __err_msg(test, func, line, "bytes = %lld", bytes);
+ __errmsg(test, func, line, "bytes = %lld", bytes);
goto close;
}
@@ -311,16 +311,16 @@ int __update_vol_patt(libubi_t libubi, const char *test, const char *func,
ret = write(fd, buf, 512);
if (ret == -1) {
__failed(test, func, line, "write");
- __err_msg(test, func, line, "written = %lld, ret = %d",
- written, ret);
+ __errmsg(test, func, line, "written = %lld, ret = %d",
+ written, ret);
goto close;
}
written += ret;
if (written > bytes) {
- __err_msg(test, func, line, "update length %lld bytes, "
- "but %lld bytes are already written",
- bytes, written);
+ __errmsg(test, func, line, "update length %lld bytes, "
+ "but %lld bytes are already written",
+ bytes, written);
goto close;
}
}