tst-mcount-overflow-check.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. # Test expected messages generated when mcount overflows
  3. # Copyright (C) 2017-2026 Free Software Foundation, Inc.
  4. # Copyright The GNU Toolchain Authors.
  5. # This file is part of the GNU C Library.
  6. # The GNU C Library is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU Lesser General Public
  8. # License as published by the Free Software Foundation; either
  9. # version 2.1 of the License, or (at your option) any later version.
  10. # The GNU C Library is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # Lesser General Public License for more details.
  14. # You should have received a copy of the GNU Lesser General Public
  15. # License along with the GNU C Library; if not, see
  16. # <https://www.gnu.org/licenses/>.
  17. LC_ALL=C
  18. export LC_ALL
  19. set -e
  20. exec 2>&1
  21. program="$1"
  22. check_msg() {
  23. if ! grep -q "$1" "$program.out"; then
  24. echo "FAIL: expected message not in output: $1"
  25. exit 1
  26. fi
  27. }
  28. check_msg 'monstartup: maxarcs < minarcs, setting maxarcs = minarcs'
  29. check_msg 'mcount: call graph buffer size limit exceeded, gmon.out will not be generated'
  30. for data_file in $1.data.*; do
  31. if [ -f "$data_file" ]; then
  32. echo "FAIL: expected no data files, but found $data_file"
  33. exit 1
  34. fi
  35. done
  36. echo PASS