build_ios_test.sh 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (c) Contributors to the Open 3D Engine Project.
  4. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. #
  6. # SPDX-License-Identifier: Apache-2.0 OR MIT
  7. #
  8. #
  9. set -o errexit # exit on the first failure encountered
  10. BASEDIR=$(dirname "$0")
  11. source $BASEDIR/../Mac/env_mac.sh
  12. mkdir -p ${OUTPUT_DIRECTORY}
  13. SOURCE_DIRECTORY=${PWD}
  14. ECHO Configuring for iOS Testing
  15. LAST_CONFIGURE_CMD_FILE=ci_last_configure_cmd.txt
  16. CONFIGURE_CMD="cmake -B ${OUTPUT_DIRECTORY} ${SOURCE_DIRECTORY} ${CMAKE_OPTIONS} ${EXTRA_CMAKE_OPTIONS}"
  17. if [[ ! -e "CMakeCache.txt" ]]; then
  18. echo [ci_build] First run, generating
  19. RUN_CONFIGURE=1
  20. elif [[ ! -e ${LAST_CONFIGURE_CMD_FILE} ]]; then
  21. echo [ci_build] Last run command not found, generating
  22. RUN_CONFIGURE=1
  23. else
  24. # Detect if the input has changed
  25. LAST_CMD=$(<${LAST_CONFIGURE_CMD_FILE})
  26. if [[ "${LAST_CMD}" != "${CONFIGURE_CMD}" ]]; then
  27. echo [ci_build] Last run command different, generating
  28. RUN_CONFIGURE=1
  29. fi
  30. fi
  31. if [[ ! -z "$RUN_CONFIGURE" ]]; then
  32. # have to use eval since $CMAKE_OPTIONS (${EXTRA_CMAKE_OPTIONS}) contains quotes that need to be processed
  33. echo [ci_build] ${CONFIGURE_CMD}
  34. eval ${CONFIGURE_CMD}
  35. # Save the run only if success
  36. echo "${CONFIGURE_CMD}" > ${LAST_CONFIGURE_CMD_FILE}
  37. fi
  38. if [ $? -ne 0 ]
  39. then
  40. echo "CMake configuration failed"
  41. exit 1
  42. fi
  43. echo Building for iOS Testing
  44. echo
  45. echo [ci+build] ${SOURCE_DIRECTORY}/python/python.sh ${SOURCE_DIRECTORY}/cmake/Tools/Platform/iOS/build_ios_test.py -b ${OUTPUT_DIRECTORY} -c ${CONFIGURATION}
  46. ${SOURCE_DIRECTORY}/python/python.sh ${SOURCE_DIRECTORY}/cmake/Tools/Platform/iOS/build_ios_test.py -b ${OUTPUT_DIRECTORY} -c ${CONFIGURATION}
  47. if [ $? -ne 0 ]
  48. then
  49. echo "iOS Test Build failed"
  50. exit 1
  51. fi
  52. ECHO Launching iOS Test
  53. echo [ci+build] ${SOURCE_DIRECTORY}/python/python.sh ${SOURCE_DIRECTORY}/cmake/Tools/Platform/iOS/launch_ios_test.py -b ${OUTPUT_DIRECTORY} --device-name ${TARGET_DEVICE_NAME} --timeout ${TEST_MODULE_TIMEOUT}
  54. ${SOURCE_DIRECTORY}/python/python.sh ${SOURCE_DIRECTORY}/cmake/Tools/Platform/iOS/launch_ios_test.py -b ${OUTPUT_DIRECTORY} --device-name ${TARGET_DEVICE_NAME} --timeout ${TEST_MODULE_TIMEOUT}
  55. if [ $? -ne 0 ]
  56. then
  57. echo "iOS Test failed"
  58. exit 1
  59. fi
  60. echo "iOS Tests passed"
  61. exit 0