ARM/IntegratorCP: Add automated run of all tests using expect ("make qemutests").

This commit is contained in:
Kelvin Lawson
2013-02-28 14:09:21 +00:00
parent ba5255ec0b
commit 84e2e7aecf
2 changed files with 47 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ TESTS_DIR=../../../../tests
PORT_DIR=../..
CC=arm-none-eabi-gcc
OBJCOPY=arm-none-eabi-objcopy
QEMU=qemu-system-arm
# Enable stack-checking.
#STACK_CHECK=true
@@ -114,3 +115,10 @@ clean:
doxygen:
doxygen $(KERNEL_DIR)/Doxyfile
doxygen ./Doxyfile
# Run tests within simavr simulator
phony_qemu_elfs = $(addsuffix .sim, $(TEST_ELFS))
qemutests: $(phony_qemu_elfs)
.PHONY: qemutests $(phony_qemu_elfs)
$(phony_qemu_elfs):
./run_test.exp $(QEMU) $(BUILD_DIR)/$(basename $@)

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env expect
# Expect script to run an automated test within QEMU and check for successful
# completion.
#
# Arguments: <path_to_qemu> <test_elf_file>
#
# Returns 0 on successful test run within QEMU, 1 on failure
# Start the test
spawn [lindex $argv 0] -M integratorcp -semihosting -nographic -kernel [lindex $argv 1]
# Expect to see the test starting within 10 seconds
set timeout 10
# Wait for the test to start ("Go")
expect {
"Go" {
puts "Test started"
# The test could take up to 3 minutes to complete once started
set timeout 180
# Now expect to see "Pass" or "Fail" within 3 minutes
expect {
"Pass" { puts "Test passed"; exit 0 }
"Fail" { puts "Test failed"; exit 1 }
timeout { puts "Test timed out without completing"; exit 1 }
}
}
timeout {
# Didn't receive "Go" within 10 seconds
puts "Test failed to start ('Go' not seen)"
exit 1
}
}