@cryptotaxi247 / kubo / commits / 00e03404d

sharness: replace POSIX prereq with STD_ERR_MSG

License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Christian Couder committed Feb 22, 2016 at 20:32 UTC 00e03404d8002aafad4af5a5c177a157926023b4
2 files changed +13 -3
test/sharness/lib/test-lib.sh
+3 -1
@@ -45,7 +45,9 @@ test "$TEST_EXPENSIVE" = 1 && test_set_prereq EXPENSIVE
45 test "$TEST_NO_DOCKER" != 1 && type docker && test_set_prereq DOCKER
46
47 TEST_OS=$(uname -s | tr [a-z] [A-Z])
48 -test expr "$TEST_OS" : "CYGWIN_NT" >/dev/null && test_set_prereq POSIX
48 +
49 +# Set a prereq as error messages are often different on Windows/Cygwin
50 +expr "$TEST_OS" : "CYGWIN_NT" >/dev/null || test_set_prereq STD_ERR_MSG
51
52 if test "$TEST_VERBOSE" = 1; then
53 echo '# TEST_VERBOSE='"$TEST_VERBOSE"
test/sharness/t0020-init.sh
+10 -2
@@ -19,8 +19,16 @@ test_expect_success "ipfs init fails" '
19 test_must_fail ipfs init 2> init_fail_out
20 '
21
22 -test_expect_success POSIX "ipfs init output looks good" '
23 - echo "Error: failed to take lock at $IPFS_PATH: permission denied" > init_fail_exp &&
22 +# Under Windows/Cygwin the error message is different,
23 +# so we use the STD_ERR_MSG prereq.
24 +if test_have_prereq STD_ERR_MSG; then
25 + init_err_msg="Error: failed to take lock at $IPFS_PATH: permission denied"
26 +else
27 + init_err_msg="Error: mkdir $IPFS_PATH: The system cannot find the path specified."
28 +fi
29 +
30 +test_expect_success "ipfs init output looks good" '
31 + echo "$init_err_msg" >init_fail_exp &&
32 test_cmp init_fail_exp init_fail_out
33 '
34