logo

utils

Old programs, got split in utils-std and utils-extra git clone https://hacktivis.me/git/utils.git

test_all.sh (1885B)


  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. # This is used to run tests on all known and available targets
  5. # ./test_all.sh 2>&1 | tee test_all.log ; grep '^TEST-ALL:' test_all.log
  6. set -e
  7. err=0
  8. export CFLAGS="-O2 -g2 -Wall -Wextra -Werror=all"
  9. for make in gmake bmake pmake
  10. do
  11. if grep -q '#define\W__GLIBC__' /usr/include/features.h
  12. then
  13. compilers="tcc gcc clang"
  14. for cc in cproc pcc
  15. do
  16. echo "TEST-ALL: CC=${cc} ${make} clean: SKIPPED (glibc)"
  17. echo "TEST-ALL: CC=${cc} ${make} all: SKIPPED (glibc)"
  18. echo "TEST-ALL: CC=${cc} ${make} test: SKIPPED (glibc)"
  19. done
  20. else
  21. compilers="tcc gcc clang cproc pcc"
  22. fi
  23. for cc in $compilers
  24. do
  25. if command -v "$cc" && command -v "$make"
  26. then
  27. echo "CC=${cc} time ${make} clean"
  28. if CC=${cc} time ${make} clean; then
  29. echo "TEST-ALL: CC=${cc} ${make} clean: OK"
  30. else
  31. echo "TEST-ALL: CC=${cc} ${make} clean: FAILED"
  32. echo "TEST-ALL: CC=${cc} ${make} all: SKIPPED (clean fail)"
  33. echo "TEST-ALL: CC=${cc} ${make} test: SKIPPED (clean fail)"
  34. exit 1
  35. fi
  36. echo "CC=${cc} time ${make} all"
  37. if CC=${cc} time ${make} -j1 all
  38. then
  39. echo "TEST-ALL: CC=${cc} ${make} all: OK"
  40. else
  41. echo "TEST-ALL: CC=${cc} ${make} all: FAILED"
  42. echo "TEST-ALL: CC=${cc} ${make} test: SKIPPED (build fail)"
  43. err=1
  44. continue
  45. fi
  46. echo "CC=${cc} time ${make} test"
  47. if CC=${cc} time ${make} -j1 test
  48. then
  49. echo "TEST-ALL: CC=${cc} ${make} test: OK"
  50. else
  51. echo "TEST-ALL: CC=${cc} ${make} test: FAILED"
  52. err=1
  53. fi
  54. else
  55. echo "TEST-ALL: CC=${cc} ${make} clean: SKIPPED (${cc} or ${make} missing)"
  56. echo "TEST-ALL: CC=${cc} ${make} all: SKIPPED (${cc} or ${make} missing)"
  57. echo "TEST-ALL: CC=${cc} ${make} test: SKIPPED (${cc} or ${make} missing)"
  58. fi
  59. done
  60. done
  61. exit $err