-
Notifications
You must be signed in to change notification settings - Fork 0
Running Newlib Tests
After building the toolchain using the arc-gnu-toolchain repository, all tests are automatically available as per this section in the readme.
It might be useful to perform tests without having to build the entire toolchain.
The newlib tests are based on dejagnu so it is expected that the framework is installed in your system.
Depending on the simulator used (nSIM or QEMU) it is expected that the correct binaries are present in the PATH
.
The most direct (manual) way to run the tests is to setup the local environment, include the necessary sources and binaries, and run using a site.exp file. A simple test procedure goes as follows:
$ mkdir test_env; cd test_env # There are output binaries and logs, so its' useful to keep them separate
$ mkdir tmp # Directory used to store the generated objects
$ export TOOLCHAIN_SRC=/path/to/parent # Path to parent folder of all ARC tool sources (at least newlib, toolchain and arc-gnu-toolchain)
$ export TOOLCHAIN_INST=/path/to/bins # Path to installed binaries (only required if not in path already)
$ export QEMU_CPU=archs # CPU to use in simulation
$ export PATH=$PATH:$TOOLCHAIN_INST/bin:$TOOLCHAIN_SRC/arc-gnu-toolchain/scripts/wrapper/qemu # Add tools and QEMU wrapper to path (used by arc-sim board)
$ cat > site.exp << 'EOF'
set tool newlib
set tool_version 4.3.0
set tmpdir "./tmp"
set srcdir "$env(TOOLCHAIN_SRC)/newlib/newlib/testsuite"
set target_triplet arc-unknown-elf32
set target_alias arc-elf32
set target_list arc-sim
set CFLAGS_FOR_TARGET "--specs=nsim.specs"
set arc_board_dir "$env(TOOLCHAIN_SRC)/toolchain"
if ![info exists boards_dir] {
lappend boards_dir "$arc_board_dir/dejagnu"
lappend boards_dir "$arc_board_dir/dejagnu/baseboards"
} else {
set boards_dir "$arc_board_dir/dejagnu"
lappend boards_dir "$arc_board_dir/dejagnu/baseboards"
}
EOF
$ runtest # Now we run the tests!
The example above runs for archs. To use other architectures, you can simply:
- Change the available binaries in
$TOOLCHAIN_INST
- Give qemu the appropriate
$QEMU_CPU
- Set the correct
target_triplet
andtarget_alias
Below are some common setups.
- Make available arc64-elf-* tools and necessary resources
- export QEMU_CPU=hs6x
- In site.exp above, set the following:
set target_triplet arc64-unknown-elf
set target_alias arc64-elf
- Make available arc32-elf-* tools and necessary resources
- export QEMU_CPU=hs5x
- In site.exp above, set the following:
set target_triplet arc32-unknown-elf
set target_alias arc32-elf
To use nsim simply set in site.exp the following:
set target_list arc-sim-nsimdrv