You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.3 KiB

  1. #!/usr/bin/env sh
  2. set -evx
  3. . ci/get-nprocessors.sh
  4. # if possible, ask for the precise number of processors,
  5. # otherwise take 2 processors as reasonable default; see
  6. # https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
  7. if [ -x /usr/bin/getconf ]; then
  8. NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
  9. else
  10. NPROCESSORS=2
  11. fi
  12. # as of 2017-09-04 Travis CI reports 32 processors, but GCC build
  13. # crashes if parallelized too much (maybe memory consumption problem),
  14. # so limit to 4 processors for the time being.
  15. if [ $NPROCESSORS -gt 4 ] ; then
  16. echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4."
  17. NPROCESSORS=4
  18. fi
  19. # Tell make to use the processors. No preceding '-' required.
  20. MAKEFLAGS="j${NPROCESSORS}"
  21. export MAKEFLAGS
  22. env | sort
  23. # Set default values to OFF for these variables if not specified.
  24. : "${NO_EXCEPTION:=OFF}"
  25. : "${NO_RTTI:=OFF}"
  26. : "${COMPILER_IS_GNUCXX:=OFF}"
  27. mkdir build || true
  28. cd build
  29. cmake -Dgtest_build_samples=ON \
  30. -Dgtest_build_tests=ON \
  31. -Dgmock_build_tests=ON \
  32. -Dcxx_no_exception=$NO_EXCEPTION \
  33. -Dcxx_no_rtti=$NO_RTTI \
  34. -DCMAKE_COMPILER_IS_GNUCXX=$COMPILER_IS_GNUCXX \
  35. -DCMAKE_CXX_FLAGS=$CXX_FLAGS \
  36. -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
  37. ..
  38. make
  39. CTEST_OUTPUT_ON_FAILURE=1 make test