From: Dmitry V. Levin Date: Mon, 4 Jan 2016 23:47:59 +0000 (+0000) Subject: tests/umount.c: use libtests X-Git-Tag: v4.12~760 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=55deec66a9a235d88a73ab9532af18dd9be0a3bf;p=strace tests/umount.c: use libtests * tests/umount.c: Use SKIP_MAIN_UNDEFINED. (main): Use perror_msg_and_fail. --- diff --git a/tests/umount.c b/tests/umount.c index 612767fd..9ad88284 100644 --- a/tests/umount.c +++ b/tests/umount.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Dmitry V. Levin + * Copyright (c) 2015-2016 Dmitry V. Levin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,6 +25,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "tests.h" #include #include #include @@ -41,31 +42,36 @@ # endif #endif +#ifdef __NR_oldumount + int main(void) { -#ifdef __NR_oldumount static const char sample[] = "umount.sample"; - if (mkdir(sample, 0700)) { - perror(sample); - return 77; - } + const char *errno_text; + if (mkdir(sample, 0700)) + perror_msg_and_fail("mkdir: %s", sample); (void) syscall(__NR_oldumount, sample); - printf("%s(\"%s\") = -1 ", TEST_SYSCALL_STR, sample); switch (errno) { case ENOSYS: - printf("ENOSYS (%m)\n"); + errno_text = "ENOSYS"; break; case EPERM: - printf("EPERM (%m)\n"); + errno_text = "EPERM"; break; default: - printf("EINVAL (%m)\n"); + errno_text = "EINVAL"; } - (void) rmdir(sample); + printf("%s(\"%s\") = -1 %s (%m)\n", + TEST_SYSCALL_STR, sample, errno_text); + if (rmdir(sample)) + perror_msg_and_fail("rmdir: %s", sample); puts("+++ exited with 0 +++"); return 0; +} + #else - return 77; + +SKIP_MAIN_UNDEFINED("__NR_oldumount") + #endif -}