run-test.sh 853 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. cd "$(dirname $0)"
  3. rm -f ./basic-ran
  4. "$DINIT_EXEC" -d sd -u -p socket -q \
  5. parent &
  6. DINITPID=$!
  7. # give time for socket to open
  8. while [ ! -e socket ]; do
  9. sleep 0.1
  10. done
  11. # wait until parent (and therefore 'basic') has fully started
  12. "$DINITCTL_EXEC" --quiet -p socket start parent
  13. sleep 0.1 # time for file to be written
  14. STATUS=FAIL
  15. if [ -e basic-ran ]; then
  16. if [ "$(cat basic-ran)" = "ran" ]; then
  17. STATUS=PASS
  18. fi
  19. fi
  20. if [ $STATUS != PASS ]; then
  21. "$DINITCTL_EXEC" --quiet -p socket shutdown
  22. exit 1;
  23. fi
  24. rm basic-ran
  25. STATUS=FAIL
  26. "$DINITCTL_EXEC" --quiet -p socket restart basic
  27. sleep .1 # time for file write
  28. if [ -e basic-ran ]; then
  29. if [ "$(cat basic-ran)" = "ran" ]; then
  30. STATUS=PASS
  31. fi
  32. fi
  33. "$DINITCTL_EXEC" --quiet -p socket shutdown
  34. wait $DINITPID
  35. if [ $STATUS = PASS ]; then exit 0; fi
  36. exit 1