test_startup.sh 895 B

123456789101112131415161718192021222324252627282930313233343536
  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. error=0
  28. check website/main.py || error=1
  29. for path in examples/*
  30. do
  31. check $path/main.py || error=1
  32. done
  33. test $error -eq 0