test_startup.sh 876 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. run() {
  3. output=`{ timeout 10 python3 $1; } 2>&1`
  4. exitcode=$?
  5. test $exitcode -eq 124 && exitcode=0 # exitcode 124 is comming from "timeout command above"
  6. echo $output | grep "NiceGUI ready to go" > /dev/null || exitcode=1
  7. echo $output | grep "Traceback" > /dev/null && exitcode=1
  8. echo $output | grep "Error" > /dev/null && exitcode=1
  9. if test $exitcode -ne 0; then
  10. echo "wrong exit code $exitcode. Output was:"
  11. echo $output
  12. return 1
  13. fi
  14. }
  15. check() {
  16. echo checking $1 ----------
  17. pushd $(dirname "$1") >/dev/null
  18. if run $(basename "$1"); then
  19. echo "ok --------"
  20. popd > /dev/null
  21. else
  22. echo "failed -------"
  23. popd > /dev/null
  24. return 1
  25. fi
  26. }
  27. success=0
  28. check main.py || success=1
  29. check examples.py || success=1
  30. echo exit $success
  31. test $success -eq 0