Skip to content

Commit

Permalink
Merge pull request #2392 from ipfs/std-err-msg-prereq
Browse files Browse the repository at this point in the history
sharness: replace POSIX prereq with STD_ERR_MSG
  • Loading branch information
whyrusleeping committed Feb 29, 2016
2 parents 54ae9da + 00e0340 commit 922ad3c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion test/sharness/lib/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ test "$TEST_EXPENSIVE" = 1 && test_set_prereq EXPENSIVE
test "$TEST_NO_DOCKER" != 1 && type docker && test_set_prereq DOCKER

TEST_OS=$(uname -s | tr [a-z] [A-Z])
test expr "$TEST_OS" : "CYGWIN_NT" >/dev/null && test_set_prereq POSIX

# Set a prereq as error messages are often different on Windows/Cygwin
expr "$TEST_OS" : "CYGWIN_NT" >/dev/null || test_set_prereq STD_ERR_MSG

if test "$TEST_VERBOSE" = 1; then
echo '# TEST_VERBOSE='"$TEST_VERBOSE"
Expand Down
12 changes: 10 additions & 2 deletions test/sharness/t0020-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ test_expect_success "ipfs init fails" '
test_must_fail ipfs init 2> init_fail_out
'

test_expect_success POSIX "ipfs init output looks good" '
echo "Error: failed to take lock at $IPFS_PATH: permission denied" > init_fail_exp &&
# Under Windows/Cygwin the error message is different,
# so we use the STD_ERR_MSG prereq.
if test_have_prereq STD_ERR_MSG; then
init_err_msg="Error: failed to take lock at $IPFS_PATH: permission denied"
else
init_err_msg="Error: mkdir $IPFS_PATH: The system cannot find the path specified."
fi

test_expect_success "ipfs init output looks good" '
echo "$init_err_msg" >init_fail_exp &&
test_cmp init_fail_exp init_fail_out
'

Expand Down

0 comments on commit 922ad3c

Please sign in to comment.