AVR port: introduce simulator for all automated tests, allowing the full test suite to be run within a simulator for continuous integration.

This commit is contained in:
Kelvin Lawson
2012-06-21 23:32:44 +01:00
parent 7ce220e42f
commit 6ce391f581
2 changed files with 41 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ CC=/usr/bin/avr-gcc
OBJCOPY=/usr/bin/avr-objcopy
SIZE=/usr/bin/avr-size
UISP=/usr/bin/uisp
SIMAVR=/tmp/run_avr
# Modify this to the device name of the UART used for UISP
UISP_DEV=/dev/ttyUSB0
@@ -121,6 +122,14 @@ program : $(BUILD_DIR)/$(app).hex
$(SIZE) -C --mcu=$(PART) $(BUILD_DIR)/$(app).elf
$(UISP) -dprog=stk500 -dserial=$(UISP_DEV) -dpart=$(PART) --erase --upload --verify if=$(BUILD_DIR)/$(app).hex
# Generate Doxygen documentation
doxygen:
doxygen $(KERNEL_DIR)/Doxyfile
doxygen ./Doxyfile
# Run tests within simavr simulator
phony_sim_elfs = $(addsuffix .sim, $(TEST_ELFS))
simtests: $(phony_sim_elfs)
.PHONY: simtests $(phony_sim_elfs)
$(phony_sim_elfs):
./run_test.exp $(SIMAVR) $(PART) $(BUILD_DIR)/$(basename $@)

View File

@@ -37,7 +37,9 @@ A couple of additional source files are also included here:
Atomthreads includes a suite of automated tests which prove the key OS
functionality, and can be used with any architecture ports. This port
provides an easy mechanism for building, downloading and running the test
suite to prove the OS on your target.
suite to prove the OS on your target. You may also use the simavr
simulator to run the entire test suite and prove the OS without real
hardware.
The port was carried out and tested on both an ATmega16 and ATmega32
running within an STK500 board, utilising the gcc-avr tools. It is possible
@@ -190,6 +192,35 @@ the OS, creates a main thread, and calls out to the test modules. It also
initialises the UART driver and redirects stdout via the UART.
---------------------------------------------------------------------------
RUNNING TESTS WITHIN THE SIMAVR SIMULATOR
It is also possible to run the full automated test suite in a simulator
without programming the test applications into real hardware. This is very
useful for quick verification of the entire test suite after making any
software changes, and is much faster than download each test application to
a real target.
A single command runs every single test application, and checks the
(simulated) UART output to verify that each test case passes.
This requires two applications on your development PC: expect and the
simavr simulator. You can edit the SIMAVR variable in the Makefile to point
it at the simavr install location on your PC and then run:
* make PART=atmega128 simtests
This will run every single test application within the simulator and quit
immediately if any one test fails. You should pick an ATmega device that is
supported by the simavr simulator: atmega128 is a good choice.
The ability to run these automated tests in one command (and without real
hardware) allows you to easily include the OS test suite in your nightly
build or continous integration system and quickly find out if any of your
local changes have caused any of the operating system tests to fail.
---------------------------------------------------------------------------
WRITING APPLICATIONS