starpu_check_public.sh 2.4 KB

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