File: check_all.sh

package info (click to toggle)
dmtx-utils 0.7.6-1.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 484 kB
  • sloc: ansic: 2,737; sh: 154; makefile: 124; perl: 28
file content (71 lines) | stat: -rwxr-xr-x 1,797 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh

function RunTest()
{
   SCRIPT="$1"
   SCRIPT_TYPE=$(echo "$SCRIPT" | awk -F'.' '{print $NF}')

   echo "   $SCRIPT"

   ERRORS=0
   for dir in $(find "$DMTXUTILS" -type d); do

      if [[ "$dir" != "$DMTXUTILS" &&
            "$dir" != "$DMTXUTILS/dmtxread" &&
            "$dir" != "$DMTXUTILS/dmtxwrite" &&
            "$dir" != "$DMTXUTILS/dmtxquery" ]]; then
         continue
      fi

      for file in $(find $dir -maxdepth 1); do

         EXT=$(echo $file | awk -F'.' '{print $NF}')
         if [[ "$EXT" != "c" && "$EXT" != "h" && "$EXT" != "sh" && \
               "$EXT" != "py" && "$EXT" != "pl" ]]; then
            continue
         fi

         if [[ "$(basename $file)" = "config.h" ||
               "$(basename $file)" = "ltmain.sh" ]]; then
            continue
         fi

         if [[ $(cat $file | wc -l) -le 10 ]]; then
            #echo "      skipping \"$file\" (trivial file)"
            continue
         fi

         if [[ "$SCRIPT_TYPE" = "sh" ]]; then
            $DMTXUTILS/script/$SCRIPT $file
            ERRORS=$(( ERRORS + $? ))
         elif [[ "$SCRIPT_TYPE" = "pl" ]]; then
            PERL=$(which perl)
            if [[ $? -ne 0 ]]; then
               echo "No perl interpreter found.  Skipping $SCRIPT test."
            else
               $PERL $DMTXUTILS/script/$SCRIPT $file
               ERRORS=$(( ERRORS + $? ))
            fi
         fi
      done
   done

   return $ERRORS
}

DMTXUTILS="$1"
if [[ -z "$DMTXUTILS" || ! -d "$DMTXUTILS/script" ]]; then
   echo "Must provide valid DMTXUTILS directory"
   exit 1
fi

RunTest check_comments.sh
RunTest check_copyright.sh
RunTest check_keyword.sh
RunTest check_license.sh
RunTest check_spacing.sh
RunTest check_whitespace.sh
RunTest check_headers.pl
RunTest check_todo.sh

exit 0