IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9472


Ignore:
Timestamp:
Oct 10, 2006, 1:21:20 PM (20 years ago)
Author:
eugene
Message:

test updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.basic/test/for.sh

    r9197 r9472  
    66 test4
    77 test5
     8 memtest1
     9 memtest2
     10 memtest3
    811end
    912
     
    8184end
    8285
     86# do we break from a loop correctly
     87macro test5
     88
     89  break -auto off
     90
     91  local i N
     92
     93  $N = 0
     94  for i 0 100
     95   $N = $N + 1
     96   if ($i == 30)
     97     break
     98   end
     99  end   
     100 
     101  if (($i != 30) || ($N != 31))
     102    $PASS = 0
     103    echo "i: $i"
     104    echo "N: $N"
     105  end
     106end
     107
    83108# check memleaks
    84 macro test5
     109macro memtest1
    85110
    86111 local i N
     
    104129 end
    105130end
     131
     132# check memleaks with many loop lines
     133macro memtest2
     134
     135 local i N
     136
     137 list word -x "ps -p $PID -o rss"
     138 $startmem = $word:1
     139
     140 output /dev/null
     141 for i 0 10000
     142  echo "test line in loop"
     143  echo "test line in loop"
     144  echo "test line in loop"
     145  echo "test line in loop"
     146  echo "test line in loop"
     147 end   
     148 output stdout
     149 
     150 list word -x "ps -p $PID -o rss"
     151 $endmem = $word:1
     152
     153 if ($endmem - $startmem > 10)
     154   $PASS = 0
     155   echo "growth: {$endmem-$startmem}"
     156   echo "kB/loop: {($endmem-$startmem)/10000}"
     157 end
     158end
     159
     160# check memleaks on break
     161macro memtest3
     162
     163 local i N
     164
     165 break -auto off
     166
     167 list word -x "ps -p $PID -o rss"
     168 $startmem = $word:1
     169
     170 for i 0 10000
     171  for j 0 5
     172    break
     173    echo "test line in loop"
     174    echo "test line in loop"
     175    echo "test line in loop"
     176    echo "test line in loop"
     177    echo "test line in loop"
     178  end
     179 end   
     180 
     181 list word -x "ps -p $PID -o rss"
     182 $endmem = $word:1
     183
     184 if ($i != 9999)
     185   $PASS = 0
     186   echo "break jumped outer loop: i = $i"
     187 end
     188
     189 if ($endmem - $startmem > 10)
     190   $PASS = 0
     191   echo "growth: {$endmem-$startmem}"
     192   echo "kB/loop: {($endmem-$startmem)/10000}"
     193 end
     194end
     195
Note: See TracChangeset for help on using the changeset viewer.