Detecting Tests Which Don't Have Enough Workspace

Joel Sherrill joel.sherrill at oarcorp.com
Thu Mar 12 17:41:44 UTC 2015


Hi

Many BSPs can link a test but don't actually have enough memory
to run the test. They will fail in the first few lines when the requested
memory for the RTEMS work area is not available. I hacked together
a script which adds together the code, data, bss, work space and
stack space requested. If this exceeds physical memory on the board,
then the test will fail.  It is possible to come close and still run out of
memory during initialization (e.g. malloc, etc) but this approach could
detect some tests which will fail by inspecting them on the host.

This is a shell script but would be better built into the rtems-tools
and using the gdb/mi. Combined with information on the
available memory on the target, we could throw out some obvious
failure cases without touching hardware.

Thoughts?

===============================
#! /bin/sh

if [ $# -le 2 ] ; then
  echo "Usage: $0 ARCH EXE ..."
  exit 1
fi

ARCH=$1
shift

target=${ARCH}-rtems4.11
type ${ARCH}-rtems4.11-size >/dev/null 2>&1
if [ $? -ne 0 ] ; then
  echo "${ARCH} does not appear to have RTEMS 4.11 tools installed"
  exit 1
fi


extract_size()
{
  ( echo "p Configuration.work_space_size" ; \
    echo "quit" ) | ${target}-gdb ${exe} 2>&1 | grep "\$1" | \
  cut -d'=' -f2
}

for exe in $*
do
 image_size=`${target}-size ${exe} | tail -1 | cut -f4`
 wkspace_size=`extract_size Configuration.work_space_size`
 stackspace_size=`extract_size Configuration.stack_space_size`

 #echo ${image_size} ${wkspace_size} ${stackspace_size}
 
 total=`echo ${image_size} ${wkspace_size} + ${stackspace_size} + p | dc`
 echo ${total} ${exe}
done

exit 0

===============================

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985




More information about the devel mailing list