after 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #! /bin/sh
  2. # Do common operations after a particular test.
  3. # This file is part of GNU tar testsuite.
  4. # Copyright (C) 2004 Free Software Foundation, Inc.
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  19. # 02111-1307, USA.
  20. cd ..
  21. exec 1> /dev/null
  22. exec 2> /dev/null
  23. compare() {
  24. eval tempfile=tmp-$$/std${1}
  25. eval echo \""\${$1}"\" | sed '$d' > ${tempfile}0
  26. sedscript=tmp-$$/${1}.sed
  27. if eval test \".\${${1}_ignore}\" = .; then
  28. :
  29. else
  30. eval echo \"\${${1}_ignore}\" | sed 's,^.*$,/&/d,;' > $sedscript
  31. sed -f $sedscript ${tempfile} > ${tempfile}.1
  32. mv ${tempfile}.1 ${tempfile}
  33. fi
  34. if eval test -z \"\${${1}_regex}\" ; then
  35. cmp -s ${tempfile}0 ${tempfile} || exit 1
  36. else
  37. awk '{print NR " " $0}' ${tempfile}0 > ${tempfile}.1
  38. awk '{print NR " " $0}' ${tempfile} | join ${tempfile}.1 - |
  39. while read NUM RE LINE
  40. do
  41. echo "$LINE" | grep -- "$RE" >/dev/null || exit 1
  42. done
  43. fi
  44. }
  45. compare out
  46. compare err
  47. rm -rf tmp-$$