run-test.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. cd "$(dirname $0)"
  3. # Similar to reload1 test, but with boot service stopped while we reload.
  4. # Start with boot depending on a,b
  5. rm -rf sd
  6. cp -R sd1 sd
  7. "$DINIT_EXEC" -d sd -u -p socket -q &
  8. DINITPID=$!
  9. # Give some time for startup
  10. sleep 0.2
  11. "$DINITCTL_EXEC" --quiet -p socket start hold
  12. STATUS=PASS
  13. DINITCTLOUT="$("$DINITCTL_EXEC" -p socket list)"
  14. if [ "$DINITCTLOUT" != "$(cat initial.expected)" ]; then
  15. echo "$DINITCTLOUT" > initial.actual
  16. STATUS=FAIL
  17. fi
  18. "$DINITCTL_EXEC" --quiet -p socket stop boot
  19. # Put alternate descriptions in place: boot depends on b, c
  20. if [ "$STATUS" = PASS ]; then
  21. rm -rf sd
  22. cp -R sd2 sd
  23. # This should succeed since boot is stopped
  24. DINITCTLOUT="$("$DINITCTL_EXEC" -p socket reload boot 2>&1)"
  25. if [ "$DINITCTLOUT" != "$(cat output2.expected)" ]; then
  26. echo "$DINITCTLOUT" > output2.actual
  27. STATUS=FAIL
  28. fi
  29. fi
  30. if [ "$STATUS" = PASS ]; then
  31. "$DINITCTL_EXEC" --quiet -p socket start boot
  32. DINITCTLOUT="$("$DINITCTL_EXEC" -p socket list)"
  33. if [ "$DINITCTLOUT" != "$(cat output3.expected)" ]; then
  34. echo "$DINITCTLOUT" > output3.actual
  35. STATUS=FAIL
  36. fi
  37. fi
  38. "$DINITCTL_EXEC" --quiet -p socket shutdown
  39. wait $DINITPID
  40. if [ $STATUS = PASS ]; then exit 0; fi
  41. exit 1