aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am12
-rwxr-xr-xtests/test_bindfs.rb28
-rw-r--r--tests/utimens_nofollow.c13
3 files changed, 32 insertions, 21 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 53a9081..eca8563 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,13 +1,9 @@
UNAME_S := $(shell uname -s)
-if BUILD_OS_IS_DARWIN
- noinst_PROGRAMS = readdir_inode
- readdir_inode_SOURCES = readdir_inode.c
-else
- noinst_PROGRAMS = readdir_inode utimens_nofollow
- readdir_inode_SOURCES = readdir_inode.c
- utimens_nofollow_SOURCES = utimens_nofollow.c
-endif
+
+noinst_PROGRAMS = readdir_inode utimens_nofollow
+readdir_inode_SOURCES = readdir_inode.c
+utimens_nofollow_SOURCES = utimens_nofollow.c
TESTS = test_bindfs.rb
SUBDIRS = internals
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb
index eb82c4f..a1f1526 100755
--- a/tests/test_bindfs.rb
+++ b/tests/test_bindfs.rb
@@ -231,7 +231,6 @@ testenv("--chmod-allow-x --chmod-ignore") do
chmod(00077, 'mnt/file') # should change x bits; should not unset sticky bit
assert { File.stat('src/file').mode & 07777 == 01611 }
-
mkdir('src/dir')
chmod(0700, 'src/dir')
chmod(0077, 'mnt/dir') # bits on dir should not change
@@ -371,19 +370,22 @@ root_testenv("", :title => "setgid directories") do
assert { File.stat('mnt/dir/file').gid == $nogroup_gid }
end
-root_testenv("", :title => "utimens on symlinks") do
- touch('mnt/file')
- Dir.chdir "mnt" do
- system('ln -sf file link')
+# utimensat() unavailable on OS X
+unless RUBY_PLATFORM =~ /darwin/
+ root_testenv("", :title => "utimens on symlinks") do
+ touch('mnt/file')
+ Dir.chdir "mnt" do
+ system('ln -sf file link')
+ end
+
+ system("#{$tests_dir}/utimens_nofollow mnt/link 12 34 56 78")
+ raise "Failed to run utimens_nofollow: #{$?.inspect}" unless $?.success?
+
+ assert { File.lstat('mnt/link').atime.to_i < 100 }
+ assert { File.lstat('mnt/link').mtime.to_i < 100 }
+ assert { File.lstat('mnt/file').atime.to_i > 100 }
+ assert { File.lstat('mnt/file').mtime.to_i > 100 }
end
-
- system("#{$tests_dir}/utimens_nofollow mnt/link 12 34 56 78")
- raise "Failed to run utimens_nofollow: #{$?.inspect}" unless $?.success?
-
- assert { File.lstat('mnt/link').atime.to_i < 100 }
- assert { File.lstat('mnt/link').mtime.to_i < 100 }
- assert { File.lstat('mnt/file').atime.to_i > 100 }
- assert { File.lstat('mnt/file').mtime.to_i > 100 }
end
# FIXME: this stuff around testenv is a hax, and testenv may also exit(), which defeats the 'ensure' below.
diff --git a/tests/utimens_nofollow.c b/tests/utimens_nofollow.c
index b98275f..8316b26 100644
--- a/tests/utimens_nofollow.c
+++ b/tests/utimens_nofollow.c
@@ -1,4 +1,6 @@
+#ifndef __APPLE__
+
#define _BSD_SOURCE /* For atoll */
#include <stdlib.h>
@@ -30,3 +32,14 @@ int main(int argc, char* argv[])
return 0;
}
+
+#else /* #ifndef __APPLE__ */
+
+#include <stdio.h>
+int main()
+{
+ fprintf("utimensat() unavailable on this platform\n");
+ return 1;
+}
+
+#endif /* #ifndef __APPLE__ */