diff options
Diffstat (limited to 'tests/stat')
-rw-r--r-- | tests/stat/test_chmod.c | 27 | ||||
-rw-r--r-- | tests/stat/test_mknod.c | 8 | ||||
-rw-r--r-- | tests/stat/test_stat.c | 6 |
3 files changed, 6 insertions, 35 deletions
diff --git a/tests/stat/test_chmod.c b/tests/stat/test_chmod.c index 94e6c12b..3574760b 100644 --- a/tests/stat/test_chmod.c +++ b/tests/stat/test_chmod.c @@ -2,6 +2,7 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -55,11 +56,7 @@ void test() { memset(&s, 0, sizeof s); stat("file", &s); -#if USE_OLD_FS - assert(s.st_mode == (0222 | S_IFREG)); -#else assert(s.st_mode == (0200 | S_IFREG)); -#endif assert(s.st_ctime != lastctime); // @@ -73,11 +70,7 @@ void test() { memset(&s, 0, sizeof s); stat("file", &s); -#if USE_OLD_FS - assert(s.st_mode == (0000 | S_IFREG)); -#else assert(s.st_mode == (0100 | S_IFREG)); -#endif assert(s.st_ctime != lastctime); // @@ -94,11 +87,7 @@ void test() { assert(!err); memset(&s, 0, sizeof s); stat("folder", &s); -#if USE_OLD_FS - assert(s.st_mode == (0222 | S_IFDIR)); -#else assert(s.st_mode == (0300 | S_IFDIR)); -#endif assert(s.st_ctime != lastctime); // @@ -109,11 +98,7 @@ void test() { // make sure the file it references changed stat("file-link", &s); -#if USE_OLD_FS - assert(s.st_mode == (0555 | S_IFREG)); -#else assert(s.st_mode == (0400 | S_IFREG)); -#endif // but the link didn't lstat("file-link", &s); @@ -127,19 +112,11 @@ void test() { // make sure the file it references didn't change stat("file-link", &s); -#if USE_OLD_FS - assert(s.st_mode == (0555 | S_IFREG)); -#else assert(s.st_mode == (0400 | S_IFREG)); -#endif // but the link did lstat("file-link", &s); -#if USE_OLD_FS - assert(s.st_mode == (0555 | S_IFLNK)); -#else assert(s.st_mode == (0500 | S_IFLNK)); -#endif puts("success"); } @@ -150,4 +127,4 @@ int main() { setup(); test(); return EXIT_SUCCESS; -}
\ No newline at end of file +} diff --git a/tests/stat/test_mknod.c b/tests/stat/test_mknod.c index 4cff57d9..361b2315 100644 --- a/tests/stat/test_mknod.c +++ b/tests/stat/test_mknod.c @@ -2,6 +2,7 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -52,15 +53,10 @@ void test() { // mknod a character device err = mknod("mknod-device", S_IFCHR | 0777, 123); -#if USE_OLD_FS - assert(err); - assert(errno == EPERM); -#else assert(!err); memset(&s, 0, sizeof s); stat("mknod-device", &s); assert(S_ISCHR(s.st_mode)); -#endif #endif @@ -93,4 +89,4 @@ int main() { setup(); test(); return EXIT_SUCCESS; -}
\ No newline at end of file +} diff --git a/tests/stat/test_stat.c b/tests/stat/test_stat.c index 14e88370..f59fb3c3 100644 --- a/tests/stat/test_stat.c +++ b/tests/stat/test_stat.c @@ -2,6 +2,7 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -103,13 +104,10 @@ void test() { assert(s.st_ino); assert(S_ISCHR(s.st_mode)); assert(s.st_nlink); -#if !USE_OLD_FS - // old FS doesn't store proper device ids #ifndef __APPLE__ // mac uses makedev(3, 2) for /dev/null assert(s.st_rdev == makedev(1, 3)); #endif -#endif assert(!s.st_size); assert(s.st_atime); assert(s.st_mtime); @@ -164,4 +162,4 @@ int main() { setup(); test(); return EXIT_SUCCESS; -}
\ No newline at end of file +} |