Skip to content

Commit

Permalink
Merge pull request #10 from yaneurabeya/fix-osx
Browse files Browse the repository at this point in the history
pjdfstest: fix basic OSX support
  • Loading branch information
ngie authored Apr 2, 2017
2 parents a568011 + b9a5cb6 commit d696f47
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pjdfstest.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@
#define HAS_FSTATAT
#define HAS_LINKAT
#define HAS_MKDIRAT
#ifndef __APPLE__
#define HAS_MKFIFOAT
#define HAS_MKNODAT
#endif
#define HAS_OPENAT
#define HAS_READLINKAT
#define HAS_RENAMEAT
Expand Down
10 changes: 10 additions & 0 deletions tests/chmod/11.t
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ for type in regular fifo block char socket symlink; do
create_file ${type} ${n1} 0640 65534 65534
expect 0 symlink ${n1} ${n2}
case "${os}" in
Darwin)
expect 0 -u 65534 -g 65534 chmod ${n1} 01644
expect 01644 stat ${n1} mode
expect 0 -u 65534 -g 65534 chmod ${n2} 01640
expect 01640 stat ${n1} mode
;;
FreeBSD)
expect EFTYPE -u 65534 -g 65534 chmod ${n1} 01644
expect 0640 stat ${n1} mode
Expand Down Expand Up @@ -93,6 +99,10 @@ for type in regular fifo block char socket symlink; do
if supported lchmod; then
create_file ${type} ${n1} 0640 65534 65534
case "${os}" in
Darwin)
expect 0 -u 65534 -g 65534 lchmod ${n1} 01644
expect 01644 lstat ${n1} mode
;;
FreeBSD)
expect EFTYPE -u 65534 -g 65534 lchmod ${n1} 01644
expect 0640 lstat ${n1} mode
Expand Down
12 changes: 9 additions & 3 deletions tests/conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ unsupported_os()
get_mountpoint()
{
case "${os}" in
FreeBSD|Darwin)
df . | tail -1 | awk '{print $6}'
Darwin|FreeBSD)
df . | tail -1 | awk '{print $NF}'
;;
*)
unsupported_os
Expand All @@ -23,7 +23,13 @@ get_mountpoint()
}

case "${os}" in
FreeBSD|Darwin)
Darwin)
GREP=grep
#fs=`df -T . | tail -1 | awk '{print $2}'`
mountpoint="`get_mountpoint`"
fs=`mount | grep "on $mountpoint" | sed -e 's/.*(//' -e 's/,.*//g' | tr '[:lower:]' '[:upper:]'`
;;
FreeBSD)
GREP=grep
#fs=`df -T . | tail -1 | awk '{print $2}'`
mountpoint="`get_mountpoint`"
Expand Down

0 comments on commit d696f47

Please sign in to comment.