fast-testing.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # usage: t/fast-testing.sh [--watch]
  3. test -f Makefile || perl Makefile.PL
  4. V=$(perl -ane'print $F[2] if /^VERSION =/' Makefile)
  5. R=$(git log -1 --pretty=format:"%h")
  6. D=$(git describe --long --tags --dirty --always)
  7. lock=fast-testing.lock
  8. w=
  9. echo $$ > $lock
  10. trap "rm $lock; exit 255" SIGINT SIGTERM
  11. # need to kill rogue processes since we cannot use run_cmd. it disturbs stdout/err order #
  12. # bash-4 only
  13. if [ x$1 = x--watch ]; then
  14. if ((BASH_VERSINFO[0] < 4)); then
  15. echo "only bash-3: no coproc watchdog processkiller"
  16. else
  17. #TODO check our tty
  18. eval "coproc (while true; do
  19. sleep 1;
  20. code=`ps axw|egrep ' \./(ccode|cccode|a |aa |a.out|perldoc)'|grep -v grep`
  21. pid=`echo $code|perl -ane'print $F[0]'`
  22. test -n \"$pid\" && (echo $code; sleep 1s; kill $pid 2>/dev/null);
  23. sleep 5; done)"
  24. w=${COPROC_PID}
  25. fi
  26. fi
  27. # test locally, ~5:45hr (17*20min). with 1.46: 2:20hr-3hr
  28. PERLCC_TIMEOUT=15 NO_AUTHOR=1 perlall -mq make '-S prove -b -j4'
  29. if [ x$1 = x--watch ]; then
  30. kill -9 $w
  31. fi
  32. # creates log.modules files with date added
  33. # perlall -m make '-Iblib/arch -Iblib/lib t/modules.t -no-subset -no-date t/top100'
  34. logs=`find . -maxdepth 1 -newer $lock -name log.make-\*`
  35. if [ -n "$logs" ]; then
  36. rdir=t/reports/$V/$D
  37. mkdir -p $rdir
  38. cp -p $logs $rdir/
  39. rename 's/log\.make-/log\.test-/' $rdir/log.make-*
  40. ./status_upd -ad $rdir >> status.$D
  41. git diff >> status.$D
  42. cp -p status.$D $rdir/
  43. fi
  44. rm $lock