starpu_check_public.sh 2.5 KB

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