From 6ce391f581f39d70c4a63b63aae4962a1f13453d Mon Sep 17 00:00:00 2001 From: Kelvin Lawson Date: Thu, 21 Jun 2012 23:32:44 +0100 Subject: [PATCH] AVR port: introduce simulator for all automated tests, allowing the full test suite to be run within a simulator for continuous integration. --- ports/avr/Makefile | 9 +++++++++ ports/avr/README | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/ports/avr/Makefile b/ports/avr/Makefile index 17d7d74..932ad83 100644 --- a/ports/avr/Makefile +++ b/ports/avr/Makefile @@ -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 $@) diff --git a/ports/avr/README b/ports/avr/README index 37413e3..059f3cb 100644 --- a/ports/avr/README +++ b/ports/avr/README @@ -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