tests: add umount.test and umount2.test

* tests/umount.c: New file.
* tests/umount2.c: Likewise.
* tests/umount.test: New test.
* tests/umount2.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add umount and umount2.
(TESTS): Add umount.test and umount2.test.
* tests/.gitignore: Add umount and umount2.
diff --git a/tests/umount.c b/tests/umount.c
new file mode 100644
index 0000000..380417d
--- /dev/null
+++ b/tests/umount.c
@@ -0,0 +1,44 @@
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/mount.h>
+#include <sys/syscall.h>
+
+#ifdef __NR_oldumount
+# define TEST_SYSCALL_STR "oldumount"
+#else
+# if defined __NR_umount && defined __NR_umount2
+#  define __NR_oldumount __NR_umount
+#  define TEST_SYSCALL_STR "umount"
+# endif
+#endif
+
+int
+main(void)
+{
+#ifdef __NR_oldumount
+	static const char sample[] = "umount.sample";
+	if (mkdir(sample, 0700)) {
+		perror(sample);
+		return 77;
+	}
+	(void) syscall(__NR_oldumount, sample);
+	printf("%s(\"%s\") = -1 ", TEST_SYSCALL_STR, sample);
+	switch (errno) {
+		case ENOSYS:
+			printf("ENOSYS (%m)\n");
+			break;
+		case EPERM:
+			printf("EPERM (%m)\n");
+			break;
+		default:
+			printf("EINVAL (%m)\n");
+	}
+	(void) rmdir(sample);
+	puts("+++ exited with 0 +++");
+	return 0;
+#else
+	return 77;
+#endif
+}