/tests/t2000-exec.sh

https://code.google.com/ · Shell · 41 lines · 35 code · 5 blank · 1 comment · 1 complexity · 5246f73999b4e57ab289a9ef649745f7 MD5 · raw file

  1. #!/bin/sh
  2. test_description='pdsh exec module tests'
  3. . ${srcdir:-.}/test-lib.sh
  4. if ! test_have_prereq MOD_RCMD_EXEC; then
  5. skip_all='skipping ssh tests, ssh module not available'
  6. test_done
  7. fi
  8. test_expect_success 'exec module works' '
  9. OUTPUT=$(pdsh -Rexec -w foo echo test_command)
  10. test "$OUTPUT" = "foo: test_command"
  11. '
  12. test_debug '
  13. echo Output: $OUTPUT
  14. '
  15. test_expect_success 'exec cmd substitution works ' '
  16. OUTPUT=$(pdsh -Rexec -w foo -l buser echo %u %h %n %%)
  17. test "$OUTPUT" = "foo: buser foo 0 %"
  18. '
  19. test_debug '
  20. echo Output: $OUTPUT
  21. '
  22. test_expect_success 'exec module works in interactive mode' '
  23. OUTPUT=$(echo echo test command | pdsh -R exec -w foo)
  24. echo "$OUTPUT" | grep "foo: test command"
  25. '
  26. test_debug '
  27. echo Output: $OUTPUT
  28. '
  29. test_expect_success 'exec cmd susbstitution works interactive mode' '
  30. OUTPUT=$(echo echo %u %h %n %% | pdsh -R exec -w foo -l auser)
  31. echo "$OUTPUT" | grep "foo: auser foo 0 %"
  32. '
  33. test_debug '
  34. echo Output: $OUTPUT
  35. '
  36. test_done