Changeset f2f604a in rtems-testing


Ignore:
Timestamp:
Sep 21, 2013, 6:17:37 PM (6 years ago)
Author:
Vipul Nayyar <nayyar_vipul@…>
Branches:
4.11, 8895273c193787f84c4585a10f6d6aceb3b25dc4
Children:
9f23aff
Parents:
eb1fcfb
git-author:
Vipul Nayyar <nayyar_vipul@…> (09/21/13 18:17:37)
git-committer:
Gedare Bloom <gedare@…> (09/23/13 13:12:12)
Message:

Adding support for whitespace directory names in check_submission

File:
1 edited

Legend:

Unmodified
Added
Removed
  • merge-helpers/check_submission

    reb1fcfb rf2f604a  
    1 #! /bin/bash
    21
    32# Bash Script to find discrepancies in BSP file organization.
    43# Author : Vipul Nayyar <nayyar_vipul@yahoo.com>
    5 
    64
    75filename="0"
     
    1311flag="0"
    1412
    15 calling_path=`pwd`
     13calling_path=$(pwd)
    1614path=""
    1715
     
    2624# that are defined in cpukit & libcpu
    2725function find_rtems_internal(){
    28   if [[ $internal_done == "1" ]]; then
     26
     27  if [[ "$internal_done" == "1" ]]; then
    2928    return
    3029  fi
     
    3231  internal_files=""
    3332
    34   for k in `find -name *.c`
    35   do
    36     for j in `grep -oE "[a-z|A-Z|0-9|_]+[\ |^][_]+[a-z|A-Z|0-9|_]*[\ ]*\(" $k`
    37     do
    38       if [[ $j == "_"* ]]; then
     33  for k in $(find -name *.c)
     34  do
     35    for j in $(grep -oE "[a-z|A-Z|0-9|_]+[\ |^][_]+[a-z|A-Z|0-9|_]*[\ ]*\(" $k)
     36    do
     37      if [[ "$j" == "_"* ]]; then
    3938        j=${j%%\(}
    4039        internal_files="$j $internal_files"
     
    4443  done
    4544
    46   for k in `find ../c/src/lib/libcpu/ -name *.c`
    47   do
    48     for j in `grep -oE "[a-z|A-Z|0-9|_]+[\ |^][_]+[a-z|A-Z|0-9|_]*[\ ]*\(" $k`
    49     do
    50       if [[ $j == "_"* ]]; then
     45  for k in $(find ../c/src/lib/libcpu/ -name *.c)
     46  do
     47    for j in $(grep -oE "[a-z|A-Z|0-9|_]+[\ |^][_]+[a-z|A-Z|0-9|_]*[\ ]*\(" $k)
     48    do
     49      if [[ "$j" == "_"* ]]; then
    5150        j=${j%%\(}
    5251        internal_files="$j $internal_files"
     
    5857  for k in $internal_files
    5958  do
    60     if echo $rtems_internal |grep -q $k ; then
     59    if echo $rtems_internal |grep -q "$k" ; then
    6160      echo > /dev/null
    6261    else
     
    7069# Finds all internal functions common in bsp and (cpukit + libcpu)
    7170function find_bsp_internal(){
     71
    7272  bsp_methods=""
    7373  common_internal_methods=""
    7474
    75 # Searching for internal functions starting with '_' called(i.e ending with a ';')
    76   for i in `find -name *.c`
    77   do
    78     file_contents=`tr -d '\n' < $i | grep -oE "[ |^][_]+[a-z|A-Z|0-9|_]*[ ]*[\n]*\([^;]*\)[ ]*;" | tr -d '\n' `
    79 
    80     for j in `echo "$file_contents" | grep -oE "[_]+[a-z|A-Z|0-9|_]*[ ]*\("`
    81     do
    82       if `echo "$bsp_methods" |grep -q "${j%%\(}"` ; then
     75  # Searching for internal functions starting with '_' called(i.e ending with a ';')
     76  for i in $( find -name *.c )
     77  do
     78    file_contents=$(tr -d '\n' < $i | grep -oE "[ |^][_]+[a-z|A-Z|0-9|_]*[ ]*[\n]*\([^;\{]*\)[ ]*;" | tr -d '\n')
     79    for j in $( echo "$file_contents" | grep -oE "[_]+[a-z|A-Z|0-9|_]*[ ]*\(" )
     80    do
     81      if $(echo "$bsp_methods" | grep -q "${j%%\(}") ; then
    8382        echo > /dev/null
    8483      else
    8584        bsp_methods="${j%%\(} $bsp_methods"
    8685      fi
    87     done
    88   done
    89 
    90 # Identifying common fucntions between $rtems_interval & $bsp_methods
     86
     87    done
     88  done
     89
     90  # Identifying common fucntions between $rtems_interval & $bsp_methods
    9191  for i in $rtems_internal
    9292  do
    93     if [[ $i == "__asm__" || $i == "__attribute__" || $i == "__volatile__" || $i == "__"* ]];then
     93    if [[ "$i" == "__asm__" || "$i" == "__attribute__" || "$i" == "__volatile__" || "$i" == "__"* ]];then
    9494      continue
    9595    fi
    9696    for j in $bsp_methods
    9797    do
    98       if [[ $i == $j ]]; then
     98      if [[ "$i" == "$j" ]]; then
    9999        common_internal_methods="$j $common_internal_methods"
    100100      fi
     
    102102  done
    103103
    104   if [[ $common_internal_methods != "" ]]; then
     104  if [[ "$common_internal_methods" != "" ]]; then
    105105    echo -e "$bsp : RTEMS Internal functions used : \c"
    106106    for i in $common_internal_methods
     
    111111  fi
    112112}
    113 
    114113
    115114# Passing 1 initially to any check function states that the file/method/header
    116115# being checked is of critical nature
    117116function check_file(){
     117
    118118  filename="0"
    119119  if [[ $1 == 1 ]]; then
     
    124124  fi
    125125
    126 #Grabbing the path of file being evaluated from Makefile.am
     126  #Grabbing the path of file being evaluated from Makefile.am
    127127  if grep -wqE "[ ]*[^\ ]*/($1)" Makefile.am ; then
    128     file_path=`grep -woE "[ ]*[^\ ]*/($1)" Makefile.am | head --lines=1`
    129     cd `dirname $file_path`
    130     filename=$1
    131     file_path=`pwd`
     128    file_path="$(grep -woE "[ ]*[^\ ]*/($1)" Makefile.am | head --lines=1)"
     129    cd "$(dirname $file_path)"
     130    filename="$1"
     131    file_path="$(pwd)"
    132132
    133133    cd - > /dev/null
    134134    shift
    135135
    136 # Checking if file lies in correct directory path
    137     for i in $*
    138     do
    139       if [[ -d $i ]]; then
    140         cd $i
     136  # Checking if file lies in correct directory path
     137    for i in $@
     138    do
     139      if [[ -d "$i" ]]; then
     140        cd "$i"
    141141      else
    142142        continue
     
    144144
    145145
    146       if [[ "$file_path" == `pwd` ]]; then
     146      if [[ "$file_path" == $(pwd) ]]; then
    147147        filename="$file_path/$filename"
    148148        cd - >/dev/null
     
    168168# Checking presence of functions in specific files
    169169function check_methods(){
     170
    170171  if [[ $1 == 1 ]]; then
    171172    important="1"
     
    175176  fi
    176177
    177   for i in $*
    178   do
    179 
    180 # When correct file for this function does not exist
    181     if [[ $filename == "0" ]];then
     178  for i in $@
     179  do
     180
     181  # When correct file for this function does not exist
     182    if [[ "$filename" == "0" ]];then
    182183      if grep -rqlE "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" * ;then
    183184         if [[ $warnings -eq "1" || $important -eq "1" || $verbose -eq "1" ]];then
    184           echo $bsp : ${i%(*}"()" present in file `grep -rlE "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" *`
     185          echo $bsp : ${i%(*}"()" present in file $(grep -rlE "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" *)
    185186         fi
    186187      fi
    187188    else
    188189
    189 # When correct file for this function exists
    190       if grep -Eq "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" $filename ; then
     190  # When correct file for this function exists
     191      if grep -Eq "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" "$filename" ; then
    191192        if [[ $verbose -eq "1" ]] ;then
    192           echo "$bsp : `basename $filename` : ${i%(*}() present in file"
     193          echo "$bsp : $(basename $filename) : ${i%(*}() present in file"
    193194        fi
    194195      else
    195196        if grep -rqlE "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" * ;then
    196197           if [[ $warnings -eq "1" || $important -eq "1" || $verbose -eq "1" ]];then
    197             echo $bsp : ${i%(*}"()" present in file `grep -rlE "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" *`
     198            echo $bsp : ${i%(*}"()" present in file $(grep -rlE "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" *)
    198199           fi
    199200        else
    200201          if [[ $warnings -eq "1" || $important -eq "1" || $verbose -eq "1" ]]; then
    201             echo "$bsp : `basename $filename` : ${i%(*}() function does not exist in $filename "
     202            echo "$bsp : $(basename $filename) : ${i%(*}() function does not exist in $filename "
    202203            flag="1"
    203204          fi
     
    212213# Checking presence of headers installed by bsp
    213214function check_header(){
     215
    214216  if [[ $1 == 1 ]]; then
    215217    important="1"
     
    219221  fi
    220222
    221   for i in $*
     223  for i in $@
    222224  do
    223225    if  grep -wq "$i" Makefile.am ;then
     
    226228      fi
    227229      if [[ $verbose -eq "1" ]] ;then
    228         cd `dirname $i`
    229         echo "$bsp : `basename $i` installed from directory" ${PWD##*/c/src/lib/}
     230        cd $(dirname $i)
     231        echo "$bsp : $(basename $i) installed from directory" ${PWD##*/c/src/lib/}
    230232        cd - > /dev/null
    231233      fi
     
    235237
    236238  if [[ $warnings -eq "1" || $important -eq "1" || $verbose -eq "1" ]]; then
    237     echo "${bsp%%[\ ]*} : `basename $1` not installed "
     239    echo "${bsp%%[\ ]*} : $(basename $1) not installed "
    238240    flag="1"
    239241  fi
     
    241243  faults="1"
    242244  return
    243 
    244 }
    245 
    246 test_its_there()
    247 {
    248   if [ $# -ne 2 ] ; then
     245}
     246
     247function test_its_there(){
     248
     249  if [[ $# -ne 2 ]]; then
    249250    echo Usage: $0 FILE pattern
    250251  fi
    251252  grep ${2} ${1} >/dev/null
    252   if [ $? -ne 0 ] ; then
     253  if [[ $? -ne 0 ]]; then
    253254    echo "$bsp : ${2} is NOT in ${1##./}"
    254255  fi
    255 
    256 }
    257 
    258 test_its_there_all_case()
    259 {
    260   if [ $# -ne 2 ] ; then
     256}
     257
     258function test_its_there_all_case(){
     259
     260  if [[ $# -ne 2 ]]; then
    261261    echo Usage: $0 FILE pattern
    262262  fi
    263263  grep -i ${2} ${1} >/dev/null
    264   if [ $? -ne 0 ] ; then
     264  if [[ $? -ne 0 ]]; then
    265265    echo "$bsp : ${2} is NOT in ${1##./} - case independent check"
    266266  fi
    267 
    268 }
    269 
    270 test_its_NOT_there_all_case()
    271 {
    272   if [ $# -lt 2 ] ; then
     267}
     268
     269function test_its_NOT_there_all_case(){
     270
     271  if [[ $# -lt 2 ]]; then
    273272    echo Usage: $0 FILE pattern
    274273  fi
     
    276275  shift
    277276  grep -i "${*}" ${FILE} >/dev/null
    278   if [ $? -eq 0 ] ; then
     277  if [[ $? -eq 0 ]]; then
    279278    echo "$bsp : (${*}) SHOULD NOT BE IN ${FILE##./} - case independent check"
    280279  fi
    281280}
    282281
    283 test_its_NOT_there()
    284 {
    285   if [ $# -lt 2 ] ; then
     282function test_its_NOT_there(){
     283
     284  if [[ $# -lt 2 ]]; then
    286285    echo Usage: $0 FILE pattern
    287286  fi
     
    289288  shift
    290289  grep "${*}" ${FILE} >/dev/null
    291   if [ $? -eq 0 ] ; then
     290  if [[ $? -eq 0 ]]; then
    292291    echo "$bsp : (${*}) SHOULD NOT BE IN ${FILE##./}"
    293292  fi
    294293}
    295294
    296 find_source()
    297 {
     295function find_source(){
     296
    298297  findArgs=
    299298  while getopts "cCdm" OPT
    300299  do
    301    case "$OPT" in
    302      c) findArgs="${findArgs} -o -name configure.ac" ;;
    303      C) findArgs="${findArgs} -o -name *.cfg" ;;
    304      d) findArgs="${findArgs} -o -name *.doc" ;;
    305      m) findArgs="${findArgs} -o -name Makefile.am" ;;
    306      *) echo "bad arg to find_source ($OPT)" ; exit 1 ;;
    307    esac
    308   done
    309 
    310   shiftcount=`expr $OPTIND - 1`
     300    case "$OPT" in
     301      c) findArgs="${findArgs} -o -name configure.ac" ;;
     302      C) findArgs="${findArgs} -o -name *.cfg" ;;
     303      d) findArgs="${findArgs} -o -name *.doc" ;;
     304      m) findArgs="${findArgs} -o -name Makefile.am" ;;
     305      *) echo "bad arg to find_source ($OPT)" ; exit 1 ;;
     306    esac
     307  done
     308
     309  shiftcount=$(expr $OPTIND - 1)
    311310  shift $shiftcount
    312311
     
    323322  do
    324323    grep  ".\{81,\}" ${f} >/dev/null
    325     if [ $? -eq 0 ] ; then
     324    if [[ $? -eq 0 ]]; then
    326325      echo -e "\n$bsp : ${f#./} has more than 80 character lines"
    327       for i in `grep -n '.\{80,\}' ${f} | cut -f1 -d:`
     326      for i in $(grep -n '.\{80,\}' ${f} | cut -f1 -d:)
    328327      do
    329328        echo -e "$i \c"
    330     done
    331     fi
    332   done
    333 
    334   # really need to make the copyright strings consistent in BSPs
     329      done
     330    fi
     331  done
     332
     333  # Copyright strings should be consistent in BSPs
    335334  echo -e "\n=== Checking for copyright notices"
    336335  find_source | while read f
     
    357356  find_source -m -c -C | while read f
    358357  do
    359     egrep " +$" $f >/dev/null
     358    grep -E " +$" $f >/dev/null
    360359    test $? -eq 0 && echo -e "${f##./} \c"
    361360  done
     
    396395
    397396  # We do not want stdio in a BSP
    398     echo "=== Checking for stdio"
    399     find_source -m -c -C | while read f
    400     do
    401       test_its_NOT_there ${f} printf
    402       test_its_NOT_there ${f} "puts("
    403     done
    404 
    405     # BSPs should include RTEMS_BSP_CLEANUP_OPTIONS and maybe
    406     #   RTEMS_BSP_BOOTCARD_OPTIONS
    407     if [ -r configure.ac ] ; then
    408       echo "=== Checking for RTEMS_BSP_BOOTCARD_OPTIONS in BSP configure.ac"
    409       test_its_NOT_there configure.ac RTEMS_BSP_BOOTCARD_OPTIONS
    410       echo "=== Checking for RTEMS_BSP_CLEANUP_OPTIONS in BSP configure.ac"
    411       test_its_there configure.ac RTEMS_BSP_CLEANUP_OPTIONS
    412     fi
    413 
    414     # If not using -O2, then we really want to know
    415     # BSPs should normally use -O2
    416     echo "=== Checking for not using -O2"
    417     grep -H "\-O[013456789]" make/custom/*.cfg
    418 
    419     # BSPs should not turn on extra warnings
    420     echo "=== Checking for turning on extra GCC warning checks"
    421     grep -H "\-W" make/custom/*.cfg
    422 
    423     # Hopefully have some output from the tmtests
    424     echo "=== Checking for timing information"
    425     c=`ls -1 times* 2>/dev/null | wc -l`
    426     if [ ${c} -eq 0 ] ; then
    427       echo "Please run the timing tests and include the results."
     397  echo "=== Checking for stdio"
     398  find_source -m -c -C | while read f
     399  do
     400    test_its_NOT_there ${f} printf
     401    test_its_NOT_there ${f} "puts("
     402  done
     403
     404  # BSPs should include RTEMS_BSP_CLEANUP_OPTIONS and maybe
     405  #   RTEMS_BSP_BOOTCARD_OPTIONS
     406  if [[ -r configure.ac ]]; then
     407    echo "=== Checking for RTEMS_BSP_BOOTCARD_OPTIONS in BSP configure.ac"
     408    test_its_NOT_there configure.ac RTEMS_BSP_BOOTCARD_OPTIONS
     409    echo "=== Checking for RTEMS_BSP_CLEANUP_OPTIONS in BSP configure.ac"
     410    test_its_there configure.ac RTEMS_BSP_CLEANUP_OPTIONS
     411  fi
     412
     413  # If not using -O2, then we really want to know
     414  # BSPs should normally use -O2
     415  echo "=== Checking for not using -O2"
     416  grep -H "\-O[013456789]" make/custom/*.cfg
     417
     418  # BSPs should not turn on extra warnings
     419  echo "=== Checking for turning on extra GCC warning checks"
     420  grep -H "\-W" make/custom/*.cfg
     421
     422  # Hopefully have some output from the tmtests
     423  echo "=== Checking for timing information"
     424  c=$(ls -1 times* 2>/dev/null | wc -l)
     425  if [[ ${c} -eq 0 ]]; then
     426    echo "Please run the timing tests and include the results."
    428427  fi
    429428
     
    436435    if grep -wq "start" "$filename" || grep -wq "_start" "$filename"; then
    437436      if [[ $verbose -eq "1" ]] ;then
    438         echo "$bsp : `basename $filename` start() present in $filename"
     437        echo "$bsp : $(basename $filename) start() present in $filename"
    439438      fi
    440439    else
    441       echo "$bsp : `basename $filename` start() does not exist in start.S"
     440      echo "$bsp : $(basename $filename) start() does not exist in start.S"
    442441    fi
    443442  fi
     
    449448  check_methods 1 "bsp_reset"
    450449
    451 
    452450  check_file 1 bootcard.c ../../shared/
    453451  check_header ../../shared/include/bootcard.h
     
    459457  check_methods 1 "bsp_work_area_initialize"
    460458
    461 
    462459  check_file 1 bsplibc.c ../../shared/
    463460  check_methods "bsp_libc_init"
     
    469466  check_methods "bsp_predriver_hook"
    470467
    471 
    472468  check_file gnatinstallhandler.c ../../shared/
    473469
    474470  check_file sbrk.c ../../shared/ ../../shared/ startup/
    475471  check_methods "sbrk"
    476 
    477472
    478473  check_file stackalloc.c ../../shared/src/
     
    487482
    488483  # PIC Support
    489 
    490484  check_file irq-default-handler.c ../../shared/src/
    491 
    492485  check_file 1 irq-generic.c ../../shared/src/
    493486  check_header 1 ../../shared/include/irq-generic.h
     
    504497  check_methods "bsp_rtc_initialize" "bsp_rtc_get_time" "bsp_rtc_set_time" "bsp_rtc_probe"
    505498
    506 
    507499  check_file 1 tod.c ../../shared/ tod/
    508500
     
    513505
    514506  # Standard Headers
    515 
    516507  check_header 1 include/bsp.h
    517508  check_header include/bspopts.h
     
    531522  fi
    532523
    533   #
    534 # Test specific checks
    535 #
    536   if [ ${do_test} == "1" ] ; then
     524  # Test specific checks
     525  if [[ ${do_test} == "1" ]]; then
    537526
    538527    echo -e "\n=== Starting Test specific checks"
    539528    # find all the Makefile.am's with rtems_tests_PROGRAMS in them
    540     Makefiles=`find . -name Makefile.am | xargs -e grep -l ^rtems_tests`
    541     if [ "X${Makefiles}" = "X" ] ; then
     529    Makefiles=$(find . -name Makefile.am | xargs -e grep -l ^rtems_tests)
     530    if [[ "X${Makefiles}" = "X" ]]; then
    542531      echo -e "Unable to locate any test Makefile.am files.\n"
    543532      return
    544533    fi
     534
    545535    echo "=== Checking for missing test support files"
    546536    for m in ${Makefiles}
    547537    do
    548       directory=`dirname ${m}`
    549       if [ ${directory} = "." ] ; then
    550         directory=`pwd`
    551       fi
    552       testName=`basename ${directory}`
     538      directory=$(dirname ${m})
     539      if [[ ${directory} = "." ]]; then
     540        directory=$(pwd)
     541      fi
     542      testName=$(basename ${directory})
    553543      # Does this test have a .doc file?
    554       if [ ! -r ${directory}/${testName}.doc ] ; then
     544      if [[ ! -r ${directory}/${testName}.doc ]]; then
    555545        echo ${testName}.doc is not present
    556546      fi
     547
    557548      case ${directory} in
    558         */*tmtests*) ;;
    559         *)
    560           # Does this test have a .scn file?
    561           if [ ! -r ${directory}/${testName}.scn ] ; then
    562             echo ${testName}.scn is not present
    563           fi
    564           ;;
     549      */*tmtests*) ;;
     550      *)
     551        # Does this test have a .scn file?
     552        if [[ ! -r ${directory}/${testName}.scn ]]; then
     553        echo ${testName}.scn is not present
     554        fi
     555      ;;
    565556      esac
    566557    done
    567 
    568558  fi
    569559}
     
    571561# Verifying if the directory given or pwd is a valid bsp, shared architecture, or libbsp directory
    572562function check_given_dir(){
    573   if echo $cur_dir | grep -Eq "c/src/lib/libbsp/([^/]+)/([^/]+)/([^/]+)*" ; then
     563
     564  if echo "$cur_dir" | grep -Eq "c/src/lib/libbsp/([^/]+)/([^/]+)/([^/]+)*" ; then
    574565    return 0
    575566
    576   elif echo $cur_dir | grep -Eq "c/src/lib/libbsp/([^/]+)/([^/]+)" ; then
    577 # BSP given
    578     bsp=${cur_dir##*/}
    579 
    580     if [[ $bsp == "shared" || $bsp == "autom4te.cache" || $bsp == "no_bsp" ]]; then
     567  elif echo "$cur_dir" | grep -Eq "c/src/lib/libbsp/([^/]+)/([^/]+)" ; then
     568    # BSP given
     569    bsp="${cur_dir##*/}"
     570
     571    if [[ "$bsp" == "shared" || "$bsp" == "autom4te.cache" || "$bsp" == "no_bsp" ]]; then
    581572      return 0
    582573    else
    583574      main
    584575    fi
    585   elif echo $cur_dir | grep -Eq "c/src/lib/libbsp/([^/]+)" ; then
    586 # Shared architecture given
    587     for i in *
    588     do
    589       if [[ -d $i ]]; then
    590         if [[ $i == "shared" || $i == "autom4te.cache" || $i == "no_bsp" ]]; then
    591           echo -n
     576  elif echo "$cur_dir" | grep -Eq "c/src/lib/libbsp/([^/]+)" ; then
     577    # Shared architecture given
     578    for i in */Makefile.am
     579    do
     580      i="$(dirname $i)"
     581      if [[ -d "$i" ]]; then
     582        if [[ "$i" == "shared" || "$i" == "autom4te.cache" || "$i" == "no_bsp" ]]; then
     583          echo -n > /dev/null
    592584        else
    593           bsp=$i
    594 
    595           cd $bsp
     585          bsp="$i"
     586
     587          cd "$bsp"
    596588          main
    597589          cd .. > /dev/null
     
    599591      fi
    600592    done
    601   elif echo $cur_dir | grep -Eq "c/src/lib/libbsp" ; then
    602 # libbsp given
     593  elif echo "$cur_dir" | grep -Eq "c/src/lib/libbsp" ; then
     594    # libbsp given
    603595    for i in */*/Makefile.am
    604596    do
    605       i=`dirname $i`
    606       if [[ -d $i ]]; then
    607         if [[ $i == "shared" || $i == "autom4te.cache" || $i == "no_cpu/no_bsp" ]]; then
     597      i="$(dirname $i)"
     598      if [[ -d "$i" ]]; then
     599        if [[ "$i" == "shared" || "$i" == "autom4te.cache" || "$i" == "no_cpu/no_bsp" ]]; then
    608600          echo -n
    609601        else
    610           bsp=$i
    611 
    612           cd $bsp
     602          bsp="$i"
     603
     604          cd "$bsp"
    613605          main
    614606          cd ../../ > /dev/null
     
    625617function start(){
    626618
    627   for i in $*
    628   do
    629     case $i in
    630       "--verbose") verbose="1" # The whole story
    631       ;;
    632 
    633       "--warnings") warnings="1" # All warnings
    634               verbose="0"
    635       ;;
    636 
    637       "--no_format") format="0" # Disabling format checks
    638               verbose="0"
    639       ;;
    640 
    641       "--tests") do_test="1"    # Enabling check of tests
    642              verbose="0"
    643       ;;
    644 
    645       "--help") echo "Help to be provided"
    646       ;;
    647 
    648       "--"* | "-"* ) echo "Invalid options provided"
    649       ;;
    650 
    651       *) path="$path $i"  ;; # If not above options, then assumed to be a path for bsp
     619  path="0"
     620
     621  for i in "$@"
     622  do
     623    case "$i" in
     624
     625    "--verbose") # The whole story
     626      verbose="1"
     627    ;;
     628
     629    "--warnings") # All warnings
     630      warnings="1"
     631      verbose="0"
     632    ;;
     633
     634    "--no_format") # Disabling format checks
     635      format="0"
     636      verbose="0"
     637    ;;
     638
     639    "--tests") # Enabling check of tests
     640      do_test="1"
     641      verbose="0"
     642    ;;
     643
     644    "--help")
     645      echo "Help to be provided"
     646    ;;
     647
     648    "--"* | "-"* )
     649      echo "Invalid options provided"
     650    ;;
     651
     652    *)
     653      if [[ -d "$i" ]]; then   # If not above options, then assumed to be a path for bsp
     654        echo > /dev/null
     655      else
     656        echo "$i is an invalid directory."
     657      fi
     658
     659      cd "$i"
     660      cur_dir=$(pwd)
     661      check_given_dir
     662      if [[ $? -eq 1 ]];then
     663        echo "$i does not seem a valid RTEMS directory"
     664      else
     665        path="1"
     666      fi
     667      cd "$calling_path"
     668    ;;
    652669    esac
    653670  done
    654671
    655 # No path given, search for bsp from pwd
    656   if [[ -z $path ]];then
    657     path=$PWD
    658     cur_dir=`pwd`
     672  # No path given, search for bsp from pwd
     673  if [[ "$path" == "0" ]];then
     674    cur_dir=$(pwd)
    659675    check_given_dir
    660676    if [[ $? -eq 1 ]];then
    661677      echo "Current directory does not seem a valid RTEMS directory"
    662678    fi
    663 
    664   else
    665     for i in $path
    666     do
    667       if [[ -d $i ]]; then
    668         echo > /dev/null
    669       else
    670         echo "$i is an invalid directory."
    671         continue
    672       fi
    673 
    674       cd $i
    675       cur_dir=`pwd`
    676       check_given_dir
    677       if [[ $? -eq 1 ]];then
    678         echo "$i does not seem a valid RTEMS directory"
    679       fi
    680       cd $calling_path
    681 
    682     done
    683679  fi
    684680}
    685681
    686682# Let the Game begin !!
    687 start $*
     683start "$@"
    688684
    689685# End of Checks
Note: See TracChangeset for help on using the changeset viewer.