all_sourcecode.tests 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/sh
  2. # Tests for the sourcecode base itself.
  3. # Copyright 2006 by Mike Frysinger <vapier@gentoo.org>
  4. # Licensed under GPL v2, see file LICENSE for details.
  5. [ -n "$srcdir" ] || srcdir=$(pwd)
  6. . testing.sh
  7. #
  8. # if we don't have the sourcecode available, let's just bail
  9. #
  10. [ -s "$srcdir/../Makefile" ] || exit 0
  11. [ -s "$srcdir/../include/applets.h" ] || exit 0
  12. #
  13. # verify the applet order is correct in applets.h, otherwise
  14. # applets won't be called properly.
  15. #
  16. sed -n -e '/^USE_[A-Z]*(APPLET(/{s:.*(::;s:,.*::;s:"::g;p}' \
  17. $srcdir/../include/applets.h > applet.order.current
  18. LC_ALL=C sort applet.order.current > applet.order.correct
  19. testing "Applet order" "diff -u applet.order.current applet.order.correct" "" "" ""
  20. rm -f applet.order.current applet.order.correct
  21. #
  22. # check for misc common typos
  23. #
  24. find $srcdir/../ \
  25. '(' -type d -a '(' -name .svn -o -name testsuite ')' -prune ')' \
  26. -o '(' -type f -a -print0 ')' | xargs -0 \
  27. grep -I \
  28. -e '\<compatability\>' \
  29. -e '\<compatable\>' \
  30. -e '\<fordeground\>' \
  31. -e '\<depency\>' -e '\<dependancy\>' -e '\<dependancies\>' \
  32. -e '\<defalt\>' \
  33. -e '\<remaing\>' \
  34. -e '\<queueing\>' \
  35. -e '\<detatch\>' \
  36. -e '\<sempahore\>' \
  37. -e '\<reprenstative\>' \
  38. -e '\<overriden\>' \
  39. -e '\<readed\>' \
  40. -e '\<formated\>' \
  41. -e '\<algorithic\>' \
  42. -e '\<deamon\>' \
  43. -e '\<derefernce\>' \
  44. -e '\<acomadate\>' \
  45. | sed -e "s:^$srcdir/\.\./::g" > src.typos
  46. testing "Common typos" "cat src.typos" "" "" ""
  47. rm -f src.typos
  48. #
  49. # don't allow obsolete functions
  50. #
  51. find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \
  52. grep -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utimes)\>[[:space:]]*\(' \
  53. | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.funcs
  54. testing "Obsolete function usage" "cat src.obsolete.funcs" "" "" ""
  55. rm -f src.obsolete.funcs
  56. #
  57. # don't allow obsolete headers
  58. #
  59. find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \
  60. grep -E -e '\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' \
  61. | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.headers
  62. testing "Obsolete headers" "cat src.obsolete.headers" "" "" ""
  63. rm -f src.obsolete.headers
  64. exit $FAILCOUNT