build_test.bash 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/bash -eu
  2. #
  3. # Copyright 2017 Google Inc. All rights reserved.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. # This file is used in our continous build infrastructure to run a variety of
  18. # tests related to the build system.
  19. #
  20. # Currently, it's used to build and run multiproduct_kati, so it'll attempt
  21. # to build ninja files for every product in the tree. I expect this to
  22. # evolve as we find interesting things to test or track performance for.
  23. #
  24. # Products that are broken or otherwise don't work with multiproduct_kati
  25. SKIPPED_PRODUCTS=(
  26. # These products are for soong-only builds, and will fail the kati stage.
  27. linux_bionic
  28. mainline_sdk
  29. ndk
  30. # New architecture bringup, fails without ALLOW_MISSING_DEPENDENCIES=true
  31. aosp_riscv64
  32. )
  33. # To track how long we took to startup.
  34. case $(uname -s) in
  35. Darwin)
  36. export TRACE_BEGIN_SOONG=`$T/prebuilts/build-tools/path/darwin-x86/date +%s%3N`
  37. ;;
  38. *)
  39. export TRACE_BEGIN_SOONG=$(date +%s%N)
  40. ;;
  41. esac
  42. # Remove BUILD_NUMBER so that incremental builds on build servers don't
  43. # re-read makefiles every time.
  44. unset BUILD_NUMBER
  45. export TOP=$(cd $(dirname ${BASH_SOURCE[0]})/../..; PWD= /bin/pwd)
  46. cd "${TOP}"
  47. source "${TOP}/build/soong/scripts/microfactory.bash"
  48. case $(uname) in
  49. Linux)
  50. if [[ -f /lib/x86_64-linux-gnu/libSegFault.so ]]; then
  51. export LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
  52. export SEGFAULT_USE_ALTSTACK=1
  53. fi
  54. ulimit -a
  55. ;;
  56. esac
  57. echo
  58. echo "Free disk space:"
  59. # Ignore df errors because it errors out on gvfsd file systems
  60. # but still displays most of the useful info we need
  61. df -h || true
  62. echo
  63. echo "Running Bazel smoke test..."
  64. STANDALONE_BAZEL=true "${TOP}/build/bazel/bin/bazel" --batch --max_idle_secs=1 help
  65. echo
  66. echo "Running Soong test..."
  67. soong_build_go multiproduct_kati android/soong/cmd/multiproduct_kati
  68. exec "$(getoutdir)/multiproduct_kati" --skip-products "$(echo "${SKIPPED_PRODUCTS[@]-}" | tr ' ' ',')" "$@"