]> granicus.if.org Git - strace/commitdiff
tests: add iopl.test
authorFei Jie <feij.fnst@cn.fujitsu.com>
Tue, 19 Apr 2016 07:38:33 +0000 (15:38 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 20 Apr 2016 01:08:13 +0000 (01:08 +0000)
* tests/iopl.c: New file.
* tests/iopl.test: New test.
* tests/.gitignore: Add iopl.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add iopl.test.

tests/.gitignore
tests/Makefile.am
tests/iopl.c [new file with mode: 0644]
tests/iopl.test [new file with mode: 0755]

index c2bc5addfe546076120aab2f7c9247114ba7109b..1b2a422b0b0954d5e2a143f82cdd21c2f6a45445 100644 (file)
@@ -67,6 +67,7 @@ getxxid
 inet-cmsg
 ioctl
 ioperm
+iopl
 ip_mreq
 ipc_msg
 ipc_msgbuf
index 047ac608fd6a1a45ba13750cf1dc94688c89a678..8be33758dc34e3a14b1e86c712001e1cc8fcdaad 100644 (file)
@@ -119,6 +119,7 @@ check_PROGRAMS = \
        inet-cmsg \
        ioctl \
        ioperm \
+       iopl \
        ip_mreq \
        ipc_msg \
        ipc_msgbuf \
@@ -353,6 +354,7 @@ DECODER_TESTS = \
        inet-cmsg.test \
        ioctl.test \
        ioperm.test \
+       iopl.test \
        ip_mreq.test \
        ipc_msg.test \
        ipc_msgbuf.test \
diff --git a/tests/iopl.c b/tests/iopl.c
new file mode 100644 (file)
index 0000000..3d379d4
--- /dev/null
@@ -0,0 +1,35 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_iopl
+
+# include <errno.h>
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+       long rc = syscall(__NR_iopl, 4);
+       const char *error_text;
+       switch (errno) {
+               case ENOSYS:
+                       error_text = "ENOSYS";
+                       break;
+               case EPERM:
+                       error_text = "EPERM";
+                       break;
+               default:
+                       error_text = "EINVAL";
+       }
+       printf("iopl(4) = %ld %s (%m)\n", rc, error_text);
+
+       puts("+++ exited with 0 +++");
+       return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_iopl")
+
+#endif
diff --git a/tests/iopl.test b/tests/iopl.test
new file mode 100755 (executable)
index 0000000..d0b5b11
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check iopl syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a8