aboutsummaryrefslogtreecommitdiff
path: root/tests/testutils.c
diff options
context:
space:
mode:
authorNishanth Aravamudan <nacc@us.ibm.com>2008-07-29 16:11:27 -0700
committerNishanth Aravamudan <nacc@us.ibm.com>2008-07-30 09:19:00 -0700
commitccc037ddde10556be7cc3344c3bdce41d4411e44 (patch)
treeccd434c037d6a1400e333bb4a3863e8580283c5d /tests/testutils.c
parent053bf4591b854395faa0ea18a9f493ac2796e4d3 (diff)
downloadlibhugetlbfs-ccc037ddde10556be7cc3344c3bdce41d4411e44.tar.gz
tests: fix error outputs
I find it annoying that many tests when they FAIL don't output the errno related to the failure point. Fix that up across the tests. A few other small cleanups in there, as well. Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Acked-by: David Gibson <dwg@au1.ibm.com>
Diffstat (limited to 'tests/testutils.c')
-rw-r--r--tests/testutils.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/testutils.c b/tests/testutils.c
index 969f42c..927e790 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -74,10 +74,12 @@ void check_hugetlb_shm_group(void)
fd = open("/proc/sys/vm/hugetlb_shm_group", O_RDONLY);
if (fd < 0)
- ERROR("Unable to open /proc/sys/vm/hugetlb_shm_group");
+ ERROR("Unable to open /proc/sys/vm/hugetlb_shm_group: %s",
+ strerror(errno));
ret = read(fd, &gid_buffer, sizeof(gid_buffer));
if (ret < 0)
- ERROR("Unable to read /proc/sys/vm/hugetlb_shm_group");
+ ERROR("Unable to read /proc/sys/vm/hugetlb_shm_group: %s",
+ strerror(errno));
hugetlb_shm_group = atoi(gid_buffer);
close(fd);
if (hugetlb_shm_group != gid)
@@ -114,7 +116,7 @@ void test_init(int argc, char *argv[])
err = sigaction(SIGINT, &sa_int, NULL);
if (err)
- FAIL("Can't install SIGINT handler");
+ FAIL("Can't install SIGINT handler: %s", strerror(errno));
if (getenv("QUIET_TEST"))
verbose_test = 0;
@@ -133,7 +135,7 @@ static int read_maps(unsigned long addr, char *buf)
f = fopen("/proc/self/maps", "r");
if (!f) {
- ERROR("Failed to open /proc/self/maps\n");
+ ERROR("Failed to open /proc/self/maps: %s\n", strerror(errno));
return -1;
}
@@ -214,7 +216,7 @@ long read_meminfo(const char *tag)
fd = open("/proc/meminfo", O_RDONLY);
if (fd < 0) {
- ERROR("Couldn't open /proc/meminfo (%s)\n", strerror(errno));
+ ERROR("Couldn't open /proc/meminfo: %s\n", strerror(errno));
return -1;
}
@@ -222,7 +224,7 @@ long read_meminfo(const char *tag)
readerr = errno;
close(fd);
if (len < 0) {
- ERROR("Error reading /proc/meminfo (%s)\n", strerror(readerr));
+ ERROR("Error reading /proc/meminfo: %s\n", strerror(readerr));
return -1;
}
if (len == sizeof(buf)) {