From 49c8aab1104c8292a953e67ed19eb821daf98f83 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 21 Jun 2015 20:29:57 -0700 Subject: [PATCH] t0040: Test named-pipe errors Make sure we neither hang nor silently tread named pipes as regular files. License: MIT Signed-off-by: W. Trevor King --- test/sharness/t0040-add-and-cat.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/sharness/t0040-add-and-cat.sh b/test/sharness/t0040-add-and-cat.sh index 03cdb75d4df..d6d03ca1835 100755 --- a/test/sharness/t0040-add-and-cat.sh +++ b/test/sharness/t0040-add-and-cat.sh @@ -264,6 +264,21 @@ test_expect_success "ipfs add -w output looks good" ' test_cmp expected actual ' +test_expect_success "useful error message when adding a named pipe" ' + mkfifo named-pipe + test_expect_code 1 ipfs add named-pipe 2>named-pipe-error + echo "Error: \`named-pipe\` is an unknown type" >named-pipe-error-expected + test_cmp named-pipe-error-expected named-pipe-error +' + +test_expect_success "useful error message when recursively adding a named pipe" ' + mkdir named-pipe-dir + mkfifo named-pipe-dir/named-pipe + test_expect_code 1 ipfs add -r named-pipe-dir 2>named-pipe-dir-error + echo "Error: \`named-pipe-dir/named-pipe\` is an unknown type" >named-pipe-dir-error-expected + test_cmp named-pipe-dir-error-expected named-pipe-dir-error +' + test_kill_ipfs_daemon test_done