run-test.sh 750 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. cd "$(dirname $0)"
  3. rm -f ./basic-ran
  4. "$DINIT_EXEC" -d sd -u -p socket -q \
  5. boot &
  6. DINITPID=$!
  7. # give time for socket to open
  8. while [ ! -e socket ]; do
  9. sleep 0.1
  10. done
  11. # try to start "bad-command" which will fail
  12. DINITCTLOUT="$("$DINITCTL_EXEC" -p socket start bad-command 2>&1)"
  13. if [ "$DINITCTLOUT" != "$(cat expected-1)" ]; then
  14. echo "$DINITCTLOUT" > actual-1
  15. kill $DINITPID; wait $DINITPID
  16. exit 1
  17. fi
  18. # try to start command which will timeout
  19. DINITCTLOUT="$("$DINITCTL_EXEC" -p socket start timeout-command 2>&1)"
  20. if [ "$DINITCTLOUT" != "$(cat expected-2)" ]; then
  21. echo "$DINITCTLOUT" > actual-2
  22. kill $DINITPID; wait $DINITPID
  23. exit 1
  24. fi
  25. "$DINITCTL_EXEC" --quiet -p socket shutdown
  26. wait $DINITPID
  27. exit 0