avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] HOWTO run the gcc testsuite using simulavr.


From: Björn Haase
Subject: [avr-libc-dev] HOWTO run the gcc testsuite using simulavr.
Date: Wed, 29 Dec 2004 16:31:42 +0100

Hi,

as promised, you will find enclosed a file describing how to run the gcc test 
suite by using
simulavr.

Next step will be to configure the test suite so that all the tests that are 
not relevant for the 
avr targets are skipped.

BTW. Did anyone fill a bug report so far: 

gcc 4.0 head is broken since someone has incorporated
changes in reload.c.

Yours,

Björn




This how-to file contains informations on the way how I succeeded in
running the gcc test suite for gcc using simulavr and avr-gdb.

In order to run the test suite you will need to set up four 
files for which you should find templates next to this how-to document.

   DOTdejagnurc          as template for your $HOME/.dejagnurc file
   run-atmega128         an executable "expect" script for launching 
                         the simulator and avr-gdb.
   atmega128-sim.exp     as template for your target board description file. 
   exit.c                containing stub functions to be linked together with
                         all the test suite programs.
.
The following how-to file first describes top-down what steps are needed for
setting up the test environment (0.) to 4.) ) and then sums up 
how to realize it.

So far it is tested only on a linux box. It should also run under cygwin.

Yours,

Björn Haase



0.) Preconditions 

In the following, I assume that the following preconditions are fullfilled:

a) simulavr and avr-gdb are working on your host machine and included in your 
search path.
b) all the required additional tools (e.g. autogen) for running the test suite 
are installed.
c) you have sucessfully compiled and installed avr-libc and your avr-gcc under 
test finds
   the avr-libc library files without supplying an additional search path by -L 
.
 
In order to control that the test suite code runs correctly on your host ( b) 
), I'd suggest to
first compile a native compiler for your host machine and make sure that
"make all check" in your native-gcc build directory works.

In the following I will describe top-down how to run the test suite. 


1.) How to run the testsuite given that everything is configured properly

The test suite will later on be run by the command

   make check RUNTESTFLAGS=--target_board=atmega128-sim

that needs to be executed in your avr-gcc build directory.

By setting the RUNTESTFLAGS environment variable one tells the dejagnu framework
to look for an expect script named "atmega128-sim.exp" that contains the
information on how to compile and execute the testsuite programs for your 
target.

In order to make "make check RUNTESTFLAGS=--target_board=atmega128-sim" work
you thus need to
  - provide a suitable atmega128-sim.exp
  - make sure that the dejagnu harness finds your atmega128-sim.exp
.


2.) How to make sure that the dejagnu framework finds your atmega128-sim.exp 

First choose a directory where you whish to store your target board description
files.

In order to tell the dejagnu framework to add this directory to the search 
path for the target-board description scripts, you can use the 

  .dejagnurc

script that needs to be located in your $HOME/ directory. Assuming your
target board scripts are located in /home/my_user_name/dejagnuboards/ you could 
use 
the line

set boards_dir /home/my_user_name/dejagnubords/ 

.

3.) How to adapt a target board description file to your host configuration

You should find enclosed to this how-to document a template for your 
   atmega128-sim.exp 
file.

This script makes use of another program run-atmega128 that you will need
to install in step 4.) .

You will need to adapt the template atmega128-sim.exp such that it contains the 
correct
path to the exit.c file that needs to be compiled and linked together with the
test suite program:

The test suite programs that are supposed to be executed contain one main 
function
that never returns. Depending on the outcome of the test, either a function 
abort() or
a function exit() are executed. The exit() and abort() functions that are 
defined in 
libgcc and avr-libc cannot be used for the tests, since they are defined in 
assembler
modules and it is not possible to define a breakpoint at these library 
functions.

For this reason the CC flags that are defined in the atmega128-sim.exp template 
make sure
that a file exit.c is compiled and linked together with the test suite programs.


4.) Installing run-atmega128

run-atmega128 is an executable that needs to be copied somewhere into your 
search path
for executables. Make sure by using 

chmod a+x run-atmega128 
 
that this file can be executed. Since it is an expect program make sure that in 
the
first line of the run-atmega128 file you have the correct path of your expect 
program.

run-atmega128 will first start simulavr and avr-gdb.
It then will load the avr-binary under test into simulavr by using avr-gdb.
It then will add two breakpoints: one bp at the exit() function and one at the
abort() function that are supposed to be defined in the avr-binary under test.

It will then start the simulation. In case that the simulation stops due to the
abort() breakpoint, run-atmega128 will printout "ABORTED". In case that the
execution stops at the exit() breakpoint it will printout "EXIT".


5.) Summing up

After describing how the test suite configuration for avr-gcc works, again all 
the
individual steps.


A) Create a directory for storing atmega128-sim.exp
B) Copy the atmega128-sim.exp template and the exit.c file to this directory.
C) Edit your atmega128-sim.exp file to contain the correct path to the exit.c 
file
D) Copy the run-atmega128 executable to a directory included in your $PATH 
variable.
E) Make sure that the first line or your run-atmega128 contains the correct 
location of
   the expect program.
F) Create a .dejagnurc file in your $HOME directory and make sure that it sets
   the boards_dir variable so that it refers to the directory where you have 
stored your atmega128-sim.exp
   file.
G) Go to your avr-gcc build directory and launch
   make check RUNTESTFLAGS=--target_board=atmega128-sim

.
  

__________________________________________________________
Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min.
weltweit telefonieren! http://freephone.web.de/?mc=021201

reply via email to

[Prev in Thread] Current Thread [Next in Thread]