test_package_mac.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash -eu
  2. #
  3. # BOKKEN_DEVICE_IP:
  4. # TEMPLATE_FILE:
  5. # TEST_TARGET:
  6. # TEST_PLATFORM:
  7. # SCRIPTING_BACKEND:
  8. # EXTRA_EDITOR_ARG:
  9. # PACKAGE_DIR:
  10. # TEST_PROJECT_DIR:
  11. # TEST_RESULT_DIR:
  12. # EDITOR_VERSION:
  13. #
  14. #
  15. # brew install gettext
  16. #
  17. export IDENTITY=~/.ssh/id_rsa_macmini
  18. # install envsubst command
  19. brew install gettext
  20. # render template
  21. envsubst ' \
  22. $BOKKEN_DEVICE_IP \
  23. $SCRIPTING_BACKEND \
  24. $EXTRA_EDITOR_ARG \
  25. $PLAYER_LOAD_PATH \
  26. $TEST_PROJECT_DIR \
  27. $TEST_TARGET \
  28. $TEST_PLATFORM \
  29. $TEST_ARCHITECTURE \
  30. $EDITOR_VERSION' \
  31. < ${TEMPLATE_FILE} \
  32. > ~/remote.sh
  33. chmod +x ~/remote.sh
  34. # copy shell script to remote machine
  35. scp -i ${IDENTITY} -r ~/remote.sh bokken@${BOKKEN_DEVICE_IP}:~/remote.sh
  36. if [ ${TEST_PLATFORM} = "standalone" ]
  37. then
  38. # copy build player to remote machine
  39. scp -i ${IDENTITY} -r build bokken@${BOKKEN_DEVICE_IP}:~/
  40. else
  41. # copy package to remote machine
  42. scp -i ${IDENTITY} -r ${YAMATO_SOURCE_DIR} bokken@${BOKKEN_DEVICE_IP}:~/${PACKAGE_DIR}
  43. fi
  44. set +e
  45. # run remote.sh on the remote machine
  46. ssh -i ${IDENTITY} bokken@${BOKKEN_DEVICE_IP} ~/remote.sh
  47. result=$?
  48. set -e
  49. # copy artifacts from the remote machine
  50. mkdir -p ${TEST_RESULT_DIR}
  51. scp -i ${IDENTITY} -r bokken@${BOKKEN_DEVICE_IP}:~/test-results ${TEST_RESULT_DIR}
  52. # return ssh commend results
  53. if [ $result -ne 0 ]; then
  54. exit $result
  55. fi