mirror of
https://github.com/kelvinlawson/atomthreads.git
synced 2026-03-05 12:03:25 +01:00
ARM/IntegratorCP: Add automated run of all tests using expect ("make qemutests").
This commit is contained in:
@@ -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 $@)
|
||||
|
||||
39
ports/arm/platforms/qemu_integratorcp/run_test.exp
Executable file
39
ports/arm/platforms/qemu_integratorcp/run_test.exp
Executable 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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user