runtests.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #-------------------------------------------------------------------------------------------------------
  2. # Copyright (C) Microsoft. All rights reserved.
  3. # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. #-------------------------------------------------------------------------------------------------------
  5. #
  6. # CI ONLY
  7. # This script is mainly for CI only. In case you have ChakraCore is compiled for multiple
  8. # targets, this script may fail to test all of them. Use runtests.py instead.
  9. pushd `dirname $0` > /dev/null
  10. test_path=`pwd -P`
  11. popd > /dev/null
  12. build_type=
  13. binary_path=
  14. release_build=0
  15. test_variant=$1
  16. if [[ -f "$test_path/../out/Debug/ch" ]]; then
  17. echo "Warning: Debug build was found"
  18. binary_path="Debug";
  19. build_type="-d"
  20. elif [[ -f "$test_path/../out/Test/ch" ]]; then
  21. echo "Warning: Test build was found"
  22. binary_path="Test";
  23. build_type="-t"
  24. elif [[ -f "$test_path/../out/Release/ch" ]]; then
  25. binary_path="Release";
  26. echo "Warning: Release build was found"
  27. release_build=1
  28. else
  29. echo 'Error: ch not found- exiting'
  30. exit 1
  31. fi
  32. if [[ $release_build != 1 ]]; then
  33. "$test_path/runtests.py" $build_type --not-tag exclude_jenkins $test_variant
  34. if [[ $? != 0 ]]; then
  35. exit 1
  36. fi
  37. else
  38. # TEST flags are not enabled for release build
  39. # however we would like to test if the compiled binary
  40. # works or not
  41. RES=$($test_path/../out/${binary_path}/ch $test_path/Basics/hello.js)
  42. EXIT_CODE=$?
  43. if [[ $RES =~ "Error :" || $EXIT_CODE != 0 ]]; then
  44. echo "FAILED"
  45. exit $EXIT_CODE
  46. else
  47. echo "Release Build Passes hello.js run"
  48. fi
  49. fi
  50. CH_ABSOLUTE_PATH="${test_path}/../out/${binary_path}/ch"
  51. RES=$(cd $test_path/native-tests; ./test_native.sh ${CH_ABSOLUTE_PATH} ${binary_path} 2>&1)
  52. if [[ $? != 0 ]]; then
  53. echo "Error: Native tests failed"
  54. echo -e "$RES"
  55. exit 1
  56. fi