vm_smoke_test 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #!/bin/sh
  2. #
  3. # This software is a part of ISAR.
  4. # Copyright (C) 2015-2018 ilbers GmbH
  5. VERBOSE="--show=test"
  6. TIMEOUT=300
  7. # Error codes:
  8. ES_OK=0
  9. ES_FAIL=1
  10. ES_BUG=3
  11. RET=$ES_FAIL
  12. # Get Avocado QEMU tests path
  13. VM_TEST_DIR="$(dirname "$0")/../testsuite/vm_boot_test"
  14. # Go to Isar root
  15. cd "$(dirname "$0")/.."
  16. BUILD_DIR=./build
  17. show_help() {
  18. echo "This script tests the Isar images for default targets in QEMU."
  19. echo
  20. echo "Usage:"
  21. echo " $0 [params]"
  22. echo
  23. echo "Parameters:"
  24. echo " -f,--fast test reduced set of supported targets."
  25. echo " -q, --quiet do not display boot logs for all the targets."
  26. echo " If test failed for the specific configuration,"
  27. echo " the respective boot log will be printed anyway."
  28. echo " -t,--timeout SEC specify time in seconds to wait before stop QEMU."
  29. echo " The default is: 300"
  30. echo " -h, --help display this message and exit."
  31. echo
  32. echo "Exit status:"
  33. echo " 0 if OK,"
  34. echo " 1 if test failed,"
  35. echo " 3 if invalid parameters are passed."
  36. }
  37. # Parse command line to get user configuration
  38. while [ $# -gt 0 ]
  39. do
  40. key="$1"
  41. case $key in
  42. -h|--help)
  43. show_help
  44. exit 0
  45. ;;
  46. -o|--output)
  47. # Deprecated option
  48. shift
  49. ;;
  50. -p|--pid-file)
  51. # Deprecated option
  52. shift
  53. ;;
  54. -f|--fast)
  55. FAST_BUILD="1"
  56. ;;
  57. -q|--quiet)
  58. VERBOSE=""
  59. ;;
  60. -t|--timeout)
  61. TIMEOUT=$2
  62. shift
  63. ;;
  64. *)
  65. echo "error: invalid parameter '$key', please try '--help' to get list of supported parameters"
  66. exit $ES_BUG
  67. ;;
  68. esac
  69. shift
  70. done
  71. TAGS="full"
  72. if [ -n "$FAST_BUILD" ]; then
  73. TAGS="fast"
  74. fi
  75. # Provide working path
  76. mkdir -p .config/avocado
  77. cat <<EOF > .config/avocado/avocado.conf
  78. [datadir.paths]
  79. base_dir = $BUILD_DIR/
  80. test_dir = $BUILD_DIR/tests
  81. data_dir = $BUILD_DIR/data
  82. logs_dir = $BUILD_DIR/job-results
  83. EOF
  84. export VIRTUAL_ENV="./"
  85. if avocado $VERBOSE run "$VM_TEST_DIR/vm_boot_test.py" -t $TAGS \
  86. --test-runner=runner --disable-sysinfo \
  87. -p build_dir="$BUILD_DIR" -p time_to_wait=$TIMEOUT; then
  88. RET=$ES_OK
  89. fi
  90. exit $RET