Mirror of strace – the linux syscall tracer
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.

run-build-and-tests.sh 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/sh -ex
  2. #
  3. # Copyright (c) 2018-2019 The strace developers.
  4. # All rights reserved.
  5. #
  6. # SPDX-License-Identifier: GPL-2.0-or-later
  7. DISTCHECK_CONFIGURE_FLAGS='--disable-dependency-tracking'
  8. export DISTCHECK_CONFIGURE_FLAGS
  9. case "$CC" in
  10. gcc*)
  11. DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --enable-gcc-Werror"
  12. ;;
  13. clang-*)
  14. # clang -mx32 fails with the following error:
  15. # clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
  16. export st_cv_mx32_runtime=no
  17. ;;
  18. esac
  19. case "${TARGET-}" in
  20. x32)
  21. CC="$CC -mx32"
  22. ;;
  23. x86)
  24. CC="$CC -m32"
  25. DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --build=i686-pc-linux-gnu --target=i686-pc-linux-gnu"
  26. ;;
  27. esac
  28. case "${STACKTRACE-}" in
  29. libdw|libunwind)
  30. DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-$STACKTRACE"
  31. ;;
  32. no)
  33. DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --disable-stacktrace"
  34. ;;
  35. esac
  36. CPPFLAGS=
  37. case "$KHEADERS" in
  38. */*)
  39. CPPFLAGS='-isystem /opt/kernel/include'
  40. export CPPFLAGS
  41. ;;
  42. esac
  43. case "${CHECK-}" in
  44. coverage)
  45. DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --enable-code-coverage"
  46. CFLAGS='-g -O0'
  47. CFLAGS_FOR_BUILD="$CFLAGS"
  48. export CFLAGS CFLAGS_FOR_BUILD
  49. ;;
  50. valgrind)
  51. DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --enable-valgrind"
  52. ;;
  53. esac
  54. echo 'BEGIN OF BUILD ENVIRONMENT INFORMATION'
  55. uname -a |head -1
  56. libc="$(ldd /bin/sh |sed -n 's|^[^/]*\(/[^ ]*/libc\.so[^ ]*\).*|\1|p' |head -1)"
  57. $libc |head -1
  58. file -L /bin/sh
  59. $CC --version |head -1
  60. $CC -print-multi-lib ||:
  61. make --version |head -1
  62. autoconf --version |head -1
  63. automake --version |head -1
  64. kver="$(printf '%s\n%s\n' '#include <linux/version.h>' 'LINUX_VERSION_CODE' | $CC $CPPFLAGS -E -P -)"
  65. printf 'kernel-headers %s.%s.%s\n' $(($kver/65536)) $(($kver/256%256)) $(($kver%256))
  66. echo 'END OF BUILD ENVIRONMENT INFORMATION'
  67. export CC_FOR_BUILD="$CC"
  68. ./git-set-file-times
  69. ./bootstrap
  70. ./configure --enable-maintainer-mode \
  71. ${DISTCHECK_CONFIGURE_FLAGS-} \
  72. || {
  73. rc=$?
  74. cat config.log
  75. echo "$CC -dumpspecs follows"
  76. $CC -dumpspecs
  77. exit $rc
  78. }
  79. j=-j`nproc` || j=
  80. case "${CHECK-}" in
  81. coverage)
  82. make -k $j all VERBOSE=${VERBOSE-}
  83. make -k $j check VERBOSE=${VERBOSE-}
  84. codecov --gcov-args=-abcp ||:
  85. echo 'BEGIN OF TEST SUITE INFORMATION'
  86. tail -n 99999 -- tests*/test-suite.log tests*/ksysent.gen.log
  87. echo 'END OF TEST SUITE INFORMATION'
  88. ;;
  89. valgrind)
  90. make -k $j all VERBOSE=${VERBOSE-}
  91. rc=$?
  92. for n in ${VALGRIND_TOOLS:-memcheck helgrind drd}; do
  93. make -k $j -C "${VALGRIND_TESTDIR:-.}" \
  94. check-valgrind-$n VERBOSE=${VERBOSE-} ||
  95. rc=$?
  96. done
  97. echo 'BEGIN OF TEST SUITE INFORMATION'
  98. tail -n 99999 -- tests*/test-suite*.log tests*/ksysent.gen.log ||
  99. rc=$?
  100. echo 'END OF TEST SUITE INFORMATION'
  101. [ "$rc" -eq 0 ]
  102. ;;
  103. *)
  104. make -k $j distcheck VERBOSE=${VERBOSE-}
  105. ;;
  106. esac