starpu_check_public.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/bash
  2. # Note: expects Coccinelle's spatch command n the PATH
  3. # See: http://coccinelle.lip6.fr/
  4. # StarPU --- Runtime system for heterogeneous multicore architectures.
  5. #
  6. # Copyright (C) 2011, 2012, 2015, 2017 CNRS
  7. # Copyright (C) 2011 INRIA
  8. #
  9. # StarPU is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU Lesser General Public License as published by
  11. # the Free Software Foundation; either version 2.1 of the License, or (at
  12. # your option) any later version.
  13. #
  14. # StarPU is distributed in the hope that it will be useful, but
  15. # WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. #
  18. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  19. stcolor=$(tput sgr0)
  20. redcolor=$(tput setaf 1)
  21. greencolor=$(tput setaf 2)
  22. test_()
  23. {
  24. INCLUDE=$1
  25. INCLUDE_FILES=$(find $INCLUDE -name '*.h')
  26. shift
  27. echo "Check include files in directory <$INCLUDE> against $*"
  28. ok=1
  29. functions=$(spatch -very_quiet -sp_file doc/doxygen/dev/starpu_funcs.cocci $INCLUDE_FILES)
  30. for func in $functions ; do
  31. fname=$(echo $func|awk -F ',' '{print $1}')
  32. location=$(echo $func|awk -F ',' '{print $2}')
  33. x=$(grep -rs "$fname" $*)
  34. if test "$x" == "" ; then
  35. ok=0
  36. echo "function ${redcolor}${fname}${stcolor} at location ${redcolor}$location${stcolor} is not used in any examples or tests"
  37. fi
  38. done
  39. echo
  40. structs=$(grep "struct starpu" $INCLUDE_FILES | grep -v "[;|,|(|)]" | awk '{print $2}')
  41. for struct in $structs ; do
  42. x=$(grep -rs "struct $struct" $*)
  43. if test "$x" == "" ; then
  44. ok=0
  45. echo "struct ${redcolor}${struct}${stcolor} is not used in any examples or tests"
  46. fi
  47. done
  48. echo
  49. enums=$(grep "enum starpu" $INCLUDE_FILES | grep -v "[;|,|(|)]" | awk '{print $2}')
  50. for enum in $enums ; do
  51. x=$(grep -rs "enum $enum" $*)
  52. if test "$x" == "" ; then
  53. ok=0
  54. echo "enum ${redcolor}${enum}${stcolor} is not used in any examples or tests"
  55. fi
  56. done
  57. echo
  58. macros=$(grep "define\b" $INCLUDE_FILES|grep -v deprecated|grep "#" | grep -v "__" | sed 's/#[ ]*/#/g' | awk '{print $2}' | awk -F'(' '{print $1}' | sort|uniq)
  59. for macro in $macros ; do
  60. x=$(grep -rs "$macro" $*)
  61. if test "$x" == "" ; then
  62. ok=0
  63. echo "macro ${redcolor}${macro}${stcolor} is not used in any examples or tests"
  64. fi
  65. done
  66. if test "$ok" == "1" ; then
  67. echo "All OK"
  68. fi
  69. }
  70. test_ include examples tests mpi/src starpufft gcc-plugin tools src/sched_policies
  71. test_ mpi/include mpi/src mpi/examples