Navigation Menu

Skip to content

Commit

Permalink
t/t0005-exec.t: Fix corner case in test for file not found
Browse files Browse the repository at this point in the history
The fake file 'nosuchprocess' does not have a relative or absolute
path specified.  So the file will be searched for in all
directories in the user's PATH.  If the user does not have access
to one of the directories in their PATH, an EACCES error can occur
instead of ENOENT, leading to a failed test.  So put "./" in front
of 'nosuchprocess' to ensure it is not searched for in PATH.
  • Loading branch information
chu11 committed Oct 12, 2016
1 parent 286b6e7 commit 3bbdc96
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions t/t0005-exec.t
Expand Up @@ -77,15 +77,15 @@ EOF
'

test_expect_success 'flux exec exits with code 127 for file not found' '
test_expect_code 127 run_timeout 2 flux exec nosuchprocess
test_expect_code 127 run_timeout 2 flux exec ./nosuchprocess
'

test_expect_success 'flux exec exits with code 126 for non executable' '
test_expect_code 126 flux exec /dev/null
'

test_expect_success 'flux exec exits with code 68 (EX_NOHOST) for rank not found' '
test_expect_code 68 run_timeout 2 flux exec -r 1000 nosuchprocess
test_expect_code 68 run_timeout 2 flux exec -r 1000 ./nosuchprocess
'
test_expect_success 'flux exec passes non-zero exit status' '
test_expect_code 2 flux exec sh -c "exit 2" &&
Expand Down

0 comments on commit 3bbdc96

Please sign in to comment.