summaryrefslogtreecommitdiff
path: root/tests/ubi-tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ubi-tests')
-rw-r--r--tests/ubi-tests/common.c84
-rw-r--r--tests/ubi-tests/common.h18
-rw-r--r--tests/ubi-tests/io_paral.c40
-rw-r--r--tests/ubi-tests/io_read.c38
-rw-r--r--tests/ubi-tests/io_update.c22
-rw-r--r--tests/ubi-tests/mkvol_bad.c2
-rw-r--r--tests/ubi-tests/mkvol_basic.c10
-rw-r--r--tests/ubi-tests/rsvol.c16
-rw-r--r--tests/ubi-tests/volrefcnt.c8
9 files changed, 119 insertions, 119 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;
}
}
diff --git a/tests/ubi-tests/common.h b/tests/ubi-tests/common.h
index faa2865..3821098 100644
--- a/tests/ubi-tests/common.h
+++ b/tests/ubi-tests/common.h
@@ -35,8 +35,8 @@ extern "C" {
#define min(a, b) ((a) < (b) ? (a) : (b))
-#define err_msg(fmt, ...) \
- __err_msg(TESTNAME, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
+#define errmsg(fmt, ...) \
+ __errmsg(TESTNAME, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
#define failed(name) \
__failed(TESTNAME, __FUNCTION__, __LINE__, name)
@@ -59,14 +59,14 @@ extern "C" {
int __ret; \
\
if (!ret) { \
- err_msg("%s() returned success but should have failed", func); \
- err_msg(fmt, ##__VA_ARGS__); \
+ errmsg("%s() returned success but should have failed", func); \
+ errmsg(fmt, ##__VA_ARGS__); \
__ret = -1; \
} \
if (errno != (error)) { \
- err_msg("%s failed with error %d (%s), expected %d (%s)", \
- func, errno, strerror(errno), error, strerror(error)); \
- err_msg(fmt, ##__VA_ARGS__); \
+ errmsg("%s failed with error %d (%s), expected %d (%s)", \
+ func, errno, strerror(errno), error, strerror(error)); \
+ errmsg(fmt, ##__VA_ARGS__); \
__ret = -1; \
} \
__ret = 0; \
@@ -80,8 +80,8 @@ extern "C" {
(s)/5-3, (s)/5-2, (s)/5-1, (s)/5+1, (s)/5+2, (s)/5+3, (s)-17, (s)-9, \
(s)-8, (s)-6, (s)-4, (s)-1, (s)};
-extern void __err_msg(const char *test, const char *func, int line,
- const char *fmt, ...);
+extern void __errmsg(const char *test, const char *func, int line,
+ const char *fmt, ...);
void __failed(const char *test, const char *func, int line,
const char *failed);
int __initial_check(const char *test, int argc, char * const argv[]);
diff --git a/tests/ubi-tests/io_paral.c b/tests/ubi-tests/io_paral.c
index 935f46a..55fd0bf 100644
--- a/tests/ubi-tests/io_paral.c
+++ b/tests/ubi-tests/io_paral.c
@@ -59,7 +59,7 @@ static int update_volume(int vol_id, int bytes)
fd = open(vol_node, O_RDWR);
if (fd == -1) {
failed("open");
- err_msg("cannot open \"%s\"\n", vol_node);
+ errmsg("cannot open \"%s\"\n", vol_node);
return -1;
}
@@ -70,7 +70,7 @@ static int update_volume(int vol_id, int bytes)
ret = ubi_update_start(libubi, fd, bytes);
if (ret) {
failed("ubi_update_start");
- err_msg("volume id is %d", vol_id);
+ errmsg("volume id is %d", vol_id);
goto err_close;
}
@@ -83,10 +83,10 @@ static int update_volume(int vol_id, int bytes)
ret = write(fd, wbuf + written, to_write);
if (ret != to_write) {
failed("write");
- err_msg("failed to write %d bytes at offset %d "
- "of volume %d", to_write, written,
- vol_id);
- err_msg("update: %d bytes", bytes);
+ errmsg("failed to write %d bytes at offset %d "
+ "of volume %d", to_write, written,
+ vol_id);
+ errmsg("update: %d bytes", bytes);
goto err_close;
}
@@ -98,7 +98,7 @@ static int update_volume(int vol_id, int bytes)
fd = open(vol_node, O_RDONLY);
if (fd == -1) {
failed("open");
- err_msg("cannot open \"%s\"\n", node);
+ errmsg("cannot open \"%s\"\n", node);
return -1;
}
@@ -112,8 +112,8 @@ static int update_volume(int vol_id, int bytes)
ret = read(fd, rbuf + rd, to_read);
if (ret != to_read) {
failed("read");
- err_msg("failed to read %d bytes at offset %d "
- "of volume %d", to_read, rd, vol_id);
+ errmsg("failed to read %d bytes at offset %d "
+ "of volume %d", to_read, rd, vol_id);
goto err_close;
}
@@ -121,7 +121,7 @@ static int update_volume(int vol_id, int bytes)
}
if (memcmp(wbuf, rbuf, bytes)) {
- err_msg("written and read data are different");
+ errmsg("written and read data are different");
goto err_close;
}
@@ -146,13 +146,13 @@ static void *update_thread(void *ptr)
ret = ubi_rmvol(libubi, node, vol_id);
if (ret) {
failed("ubi_rmvol");
- err_msg("cannot remove volume %d", vol_id);
+ errmsg("cannot remove volume %d", vol_id);
return NULL;
}
ret = ubi_mkvol(libubi, node, &reqests[vol_id]);
if (ret) {
failed("ubi_mkvol");
- err_msg("cannot create volume %d", vol_id);
+ errmsg("cannot create volume %d", vol_id);
return NULL;
}
}
@@ -175,14 +175,14 @@ static void *write_thread(void *ptr)
fd = open(vol_node, O_RDWR);
if (fd == -1) {
failed("open");
- err_msg("cannot open \"%s\"\n", vol_node);
+ errmsg("cannot open \"%s\"\n", vol_node);
return NULL;
}
ret = ubi_set_property(fd, UBI_PROP_DIRECT_WRITE, 1);
if (ret) {
failed("ubi_set_property");
- err_msg("cannot set property for \"%s\"\n", vol_node);
+ errmsg("cannot set property for \"%s\"\n", vol_node);
}
for (i = 0; i < ITERATIONS * VOL_LEBS; i++) {
@@ -192,7 +192,7 @@ static void *write_thread(void *ptr)
ret = ubi_leb_unmap(fd, leb);
if (ret) {
failed("ubi_leb_unmap");
- err_msg("cannot unmap LEB %d", leb);
+ errmsg("cannot unmap LEB %d", leb);
break;
}
@@ -203,7 +203,7 @@ static void *write_thread(void *ptr)
ret = pwrite(fd, wbuf, dev_info.leb_size, offs);
if (ret != dev_info.leb_size) {
failed("pwrite");
- err_msg("cannot write %d bytes to offs %lld, wrote %d",
+ errmsg("cannot write %d bytes to offs %lld, wrote %d",
dev_info.leb_size, offs, ret);
break;
}
@@ -212,14 +212,14 @@ static void *write_thread(void *ptr)
ret = pread(fd, rbuf, dev_info.leb_size, offs);
if (ret != dev_info.leb_size) {
failed("read");
- err_msg("failed to read %d bytes at offset %d "
- "of volume %d", dev_info.leb_size, offs,
- vol_id);
+ errmsg("failed to read %d bytes at offset %d "
+ "of volume %d", dev_info.leb_size, offs,
+ vol_id);
break;
}
if (memcmp(wbuf, rbuf, dev_info.leb_size)) {
- err_msg("written and read data are different");
+ errmsg("written and read data are different");
break;
}
}
diff --git a/tests/ubi-tests/io_read.c b/tests/ubi-tests/io_read.c
index 57a8da7..fb8018a 100644
--- a/tests/ubi-tests/io_read.c
+++ b/tests/ubi-tests/io_read.c
@@ -84,7 +84,7 @@ static int test_static(void)
fd = open(vol_node, O_RDWR);
if (fd == -1) {
failed("open");
- err_msg("cannot open \"%s\"\n", node);
+ errmsg("cannot open \"%s\"\n", node);
goto remove;
}
@@ -95,7 +95,7 @@ static int test_static(void)
/* Make sure new static volume contains no data */
if (vol_info.data_bytes != 0) {
- err_msg("data_bytes = %lld, not zero", vol_info.data_bytes);
+ errmsg("data_bytes = %lld, not zero", vol_info.data_bytes);
goto close;
}
@@ -106,7 +106,7 @@ static int test_static(void)
goto close;
}
if (ret != 0) {
- err_msg("read data from free static volume");
+ errmsg("read data from free static volume");
goto close;
}
@@ -121,7 +121,7 @@ static int test_static(void)
goto close;
}
if (ret != 10) {
- err_msg("written %d bytes", ret);
+ errmsg("written %d bytes", ret);
goto close;
}
@@ -135,7 +135,7 @@ static int test_static(void)
goto close;
}
if (ret != 10) {
- err_msg("read %d bytes", ret);
+ errmsg("read %d bytes", ret);
goto close;
}
@@ -170,12 +170,12 @@ static int test_read3(const struct ubi_vol_info *vol_info, int len, off_t off)
if (lseek(fd, off, SEEK_SET) != off) {
failed("seek");
- err_msg("len = %d", len);
+ errmsg("len = %d", len);
return -1;
}
if (read(fd, buf, len) != len1) {
failed("read");
- err_msg("len = %d", len);
+ errmsg("len = %d", len);
return -1;
}
@@ -184,8 +184,8 @@ static int test_read3(const struct ubi_vol_info *vol_info, int len, off_t off)
if (new_off == -1)
failed("lseek");
else
- err_msg("read %d bytes from %lld, but resulting "
- "offset is %lld", len1, (long long) off, (long long) new_off);
+ errmsg("read %d bytes from %lld, but resulting "
+ "offset is %lld", len1, (long long) off, (long long) new_off);
return -1;
}
@@ -193,9 +193,9 @@ static int test_read3(const struct ubi_vol_info *vol_info, int len, off_t off)
ck_buf[i] = (unsigned char)(off + i);
if (memcmp(buf, ck_buf, len1)) {
- err_msg("incorrect data read from offset %lld",
- (long long)off);
- err_msg("len = %d", len);
+ errmsg("incorrect data read from offset %lld",
+ (long long)off);
+ errmsg("len = %d", len);
return -1;
}
@@ -213,7 +213,7 @@ static int test_read2(const struct ubi_vol_info *vol_info, int len)
for (i = 0; i < sizeof(offsets)/sizeof(off_t); i++) {
if (test_read3(vol_info, len, offsets[i])) {
- err_msg("offset = %d", offsets[i]);
+ errmsg("offset = %d", offsets[i]);
return -1;
}
}
@@ -236,14 +236,14 @@ static int test_read1(struct ubi_vol_info *vol_info)
fd = open(vol_node, O_RDWR);
if (fd == -1) {
failed("open");
- err_msg("cannot open \"%s\"\n", node);
+ errmsg("cannot open \"%s\"\n", node);
return -1;
}
/* Write some pattern to the volume */
if (ubi_update_start(libubi, fd, vol_info->rsvd_bytes)) {
failed("ubi_update_start");
- err_msg("bytes = %lld", vol_info->rsvd_bytes);
+ errmsg("bytes = %lld", vol_info->rsvd_bytes);
goto close;
}
@@ -257,7 +257,7 @@ static int test_read1(struct ubi_vol_info *vol_info)
ret = write(fd, buf, 512);
if (ret == -1) {
failed("write");
- err_msg("written = %d, ret = %d", written, ret);
+ errmsg("written = %d, ret = %d", written, ret);
goto close;
}
written += ret;
@@ -273,13 +273,13 @@ static int test_read1(struct ubi_vol_info *vol_info)
fd = open(vol_node, O_RDONLY);
if (fd == -1) {
failed("open");
- err_msg("cannot open \"%s\"\n", node);
+ errmsg("cannot open \"%s\"\n", node);
return -1;
}
for (i = 0; i < sizeof(lengthes)/sizeof(int); i++) {
if (test_read2(vol_info, lengthes[i])) {
- err_msg("length = %d", lengthes[i]);
+ errmsg("length = %d", lengthes[i]);
goto close;
}
}
@@ -337,7 +337,7 @@ static int test_read(int type)
}
if (test_read1(&vol_info)) {
- err_msg("alignment = %d", req.alignment);
+ errmsg("alignment = %d", req.alignment);
goto remove;
}
diff --git a/tests/ubi-tests/io_update.c b/tests/ubi-tests/io_update.c
index dce4ee2..3b8169d 100644
--- a/tests/ubi-tests/io_update.c
+++ b/tests/ubi-tests/io_update.c
@@ -84,7 +84,7 @@ static int test_update1(struct ubi_vol_info *vol_info, int leb_change)
fd = open(vol_node, O_RDWR);
if (fd == -1) {
failed("open");
- err_msg("cannot open \"%s\"\n", node);
+ errmsg("cannot open \"%s\"\n", node);
return -1;
}
@@ -144,14 +144,14 @@ static int test_update1(struct ubi_vol_info *vol_info, int leb_change)
ret = write(fd, buf + off, len);
if (ret < 0) {
failed("write");
- err_msg("failed to write %d bytes at offset "
- "%lld", len, (long long)off);
+ errmsg("failed to write %d bytes at offset "
+ "%lld", len, (long long)off);
goto close;
}
len = l;
if (ret != len) {
- err_msg("failed to write %d bytes at offset "
- "%lld, wrote %d", len, (long long)off, ret);
+ errmsg("failed to write %d bytes at offset "
+ "%lld, wrote %d", len, (long long)off, ret);
goto close;
}
off += len;
@@ -160,7 +160,7 @@ static int test_update1(struct ubi_vol_info *vol_info, int leb_change)
/* Check data */
if ((ret = lseek(fd, SEEK_SET, 0)) != 0) {
failed("lseek");
- err_msg("cannot seek to 0");
+ errmsg("cannot seek to 0");
goto close;
}
@@ -176,15 +176,15 @@ static int test_update1(struct ubi_vol_info *vol_info, int leb_change)
ret = read(fd, buf1, test_len);
if (ret < 0) {
failed("read");
- err_msg("failed to read %d bytes", test_len);
+ errmsg("failed to read %d bytes", test_len);
goto close;
}
if (ret != test_len) {
- err_msg("failed to read %d bytes, read %d", test_len, ret);
+ errmsg("failed to read %d bytes, read %d", test_len, ret);
goto close;
}
if (memcmp(buf, buf1, test_len)) {
- err_msg("data corruption");
+ errmsg("data corruption");
goto close;
}
}
@@ -241,13 +241,13 @@ static int test_update(int type)
}
if (test_update1(&vol_info, 0)) {
- err_msg("alignment = %d", req.alignment);
+ errmsg("alignment = %d", req.alignment);
goto remove;
}
if (vol_info.type != UBI_STATIC_VOLUME) {
if (test_update1(&vol_info, 1)) {
- err_msg("alignment = %d", req.alignment);
+ errmsg("alignment = %d", req.alignment);
goto remove;
}
}
diff --git a/tests/ubi-tests/mkvol_bad.c b/tests/ubi-tests/mkvol_bad.c
index 2e3c450..e28df49 100644
--- a/tests/ubi-tests/mkvol_bad.c
+++ b/tests/ubi-tests/mkvol_bad.c
@@ -201,7 +201,7 @@ static int test_mkvol(void)
if (errno == ENFILE)
break;
failed("ubi_mkvol");
- err_msg("vol_id %d", i);
+ errmsg("vol_id %d", i);
goto remove;
}
}
diff --git a/tests/ubi-tests/mkvol_basic.c b/tests/ubi-tests/mkvol_basic.c
index 880c149..3381ac4 100644
--- a/tests/ubi-tests/mkvol_basic.c
+++ b/tests/ubi-tests/mkvol_basic.c
@@ -61,7 +61,7 @@ static int mkvol_alignment(void)
if (ubi_mkvol(libubi, node, &req)) {
failed("ubi_mkvol");
- err_msg("alignment %d", req.alignment);
+ errmsg("alignment %d", req.alignment);
return -1;
}
@@ -139,7 +139,7 @@ static int mkvol_basic(void)
/* Make sure volume does not exist */
ret = ubi_get_vol_info1(libubi, dev_info.dev_num, vol_id, &vol_info);
if (ret == 0) {
- err_msg("removed volume %d exists", vol_id);
+ errmsg("removed volume %d exists", vol_id);
goto remove;
}
@@ -179,12 +179,12 @@ static int mkvol_multiple(void)
break;
}
failed("ubi_mkvol");
- err_msg("vol_id %d", i);
+ errmsg("vol_id %d", i);
goto remove;
}
if (check_volume(req.vol_id, &req)) {
- err_msg("vol_id %d", i);
+ errmsg("vol_id %d", i);
goto remove;
}
}
@@ -200,7 +200,7 @@ static int mkvol_multiple(void)
/* Make sure volume does not exist */
ret = ubi_get_vol_info1(libubi, dev_info.dev_num, i, &vol_info);
if (ret == 0) {
- err_msg("removed volume %d exists", i);
+ errmsg("removed volume %d exists", i);
goto remove;
}
}
diff --git a/tests/ubi-tests/rsvol.c b/tests/ubi-tests/rsvol.c
index 8ec93bc..917d6ba 100644
--- a/tests/ubi-tests/rsvol.c
+++ b/tests/ubi-tests/rsvol.c
@@ -123,14 +123,14 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
}
if (vol_info1.rsvd_bytes != bytes) {
- err_msg("rsvd_bytes %lld, must be %lld",
- vol_info1.rsvd_bytes, bytes);
+ errmsg("rsvd_bytes %lld, must be %lld",
+ vol_info1.rsvd_bytes, bytes);
return -1;
}
if (vol_info1.rsvd_lebs != vol_info->rsvd_lebs - 1) {
- err_msg("rsvd_lebs %d, must be %d",
- vol_info1.rsvd_lebs, vol_info->rsvd_lebs - 1);
+ errmsg("rsvd_lebs %d, must be %d",
+ vol_info1.rsvd_lebs, vol_info->rsvd_lebs - 1);
return -1;
}
@@ -141,7 +141,7 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
fd = open(vol_node, O_RDWR);
if (fd == -1) {
failed("open");
- err_msg("cannot open \"%s\"\n", vol_node);
+ errmsg("cannot open \"%s\"\n", vol_node);
return -1;
}
@@ -176,7 +176,7 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
fd = open(vol_node, O_RDWR);
if (fd == -1) {
failed("open");
- err_msg("cannot open \"%s\"\n", vol_node);
+ errmsg("cannot open \"%s\"\n", vol_node);
return -1;
}
@@ -194,7 +194,7 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
for (i = 0; i < bytes; i++) {
if (buf[i] != (unsigned char)i) {
- err_msg("bad data");
+ errmsg("bad data");
goto close;
}
}
@@ -252,7 +252,7 @@ static int test_rsvol(int type)
}
if (test_rsvol1(&vol_info)) {
- err_msg("alignment = %d", req.alignment);
+ errmsg("alignment = %d", req.alignment);
goto remove;
}
diff --git a/tests/ubi-tests/volrefcnt.c b/tests/ubi-tests/volrefcnt.c
index a56deae..9b5a53c 100644
--- a/tests/ubi-tests/volrefcnt.c
+++ b/tests/ubi-tests/volrefcnt.c
@@ -76,7 +76,7 @@ int main(int argc, char * const argv[])
sprintf(fname, SYSFS_FILE, dev_info.dev_num, req.vol_id);
fd = open(fname, O_RDONLY);
if (fd == -1) {
- err_msg("cannot open %s", fname);
+ errmsg("cannot open %s", fname);
failed("open");
goto out_rmvol;
}
@@ -91,7 +91,7 @@ int main(int argc, char * const argv[])
/* Try to read from the file, this should fail */
ret = read(fd, tmp, 100);
if (ret != -1) {
- err_msg("read returned %d, expected -1", ret);
+ errmsg("read returned %d, expected -1", ret);
failed("read");
goto out_close;
}
@@ -100,8 +100,8 @@ int main(int argc, char * const argv[])
close(fd);
fd = open(fname, O_RDONLY);
if (fd != -1) {
- err_msg("opened %s again, open returned %d, expected -1",
- fname, fd);
+ errmsg("opened %s again, open returned %d, expected -1",
+ fname, fd);
failed("open");
goto out_libubi;
}