fast-testing.sh 1.4 KB

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