merge-test-results.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. # Merge test results of individual tests or subdirectories.
  3. # Copyright (C) 2014-2019 Free Software Foundation, Inc.
  4. # This file is part of the GNU C Library.
  5. # The GNU C Library is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU Lesser General Public
  7. # License as published by the Free Software Foundation; either
  8. # version 2.1 of the License, or (at your option) any later version.
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # Lesser General Public License for more details.
  13. # You should have received a copy of the GNU Lesser General Public
  14. # License along with the GNU C Library; if not, see
  15. # <http://www.gnu.org/licenses/>.
  16. # usage: merge-test-results.sh -s objpfx subdir test-name...
  17. # (subdirectory tests; empty subdir at top level), or
  18. # merge-test-results.sh -t objpfx subdir-file-name subdir...
  19. # (top-level merge)
  20. set -e
  21. type=$1
  22. objpfx=$2
  23. shift 2
  24. case $type in
  25. -s)
  26. subdir=$1
  27. shift
  28. subdir=${subdir:+$subdir/}
  29. for t in "$@"; do
  30. if [ -s "$objpfx$t.test-result" ]; then
  31. head -n1 "$objpfx$t.test-result"
  32. else
  33. echo "UNRESOLVED: $subdir$t"
  34. fi
  35. done
  36. ;;
  37. -t)
  38. subdir_file_name=$1
  39. shift
  40. for d in "$@"; do
  41. if [ -f "$objpfx$d/$subdir_file_name" ]; then
  42. cat "$objpfx$d/$subdir_file_name"
  43. else
  44. echo "ERROR: test results for $d directory missing"
  45. fi
  46. done
  47. ;;
  48. *)
  49. echo "unknown type $type" >&2
  50. exit 1
  51. ;;
  52. esac