mirror of
https://github.com/kelvinlawson/atomthreads.git
synced 2026-02-26 16:43:14 +01:00
dm36x: Add full run of automated test suite via UART + expect. All tests pass on DM36x!
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
|
||||
# Build all test applications:
|
||||
# make
|
||||
#
|
||||
# Run all tests communicating via UART
|
||||
# make tests
|
||||
|
||||
# Location of build tools and atomthreads sources
|
||||
KERNEL_DIR=../../../../kernel
|
||||
@@ -12,6 +15,15 @@ PORT_DIR=../..
|
||||
CC=arm-none-eabi-gcc
|
||||
OBJCOPY=arm-none-eabi-objcopy
|
||||
|
||||
# Location of TFTP root folder for running tests via U-Boot/TFTP.
|
||||
# Note, you may need to run the Makefile as root in order to write
|
||||
# to this folder.
|
||||
TESTS_TFTPROOT=/var/lib/tftpboot
|
||||
|
||||
# TTY device and baudrate for automated tests.
|
||||
TESTS_TTYDEV=/dev/ttyUSB0
|
||||
TESTS_TTYBAUD=115200
|
||||
|
||||
# Enable stack-checking.
|
||||
#STACK_CHECK=true
|
||||
|
||||
@@ -128,3 +140,11 @@ doxygen:
|
||||
doxygen ../../Doxyfile
|
||||
doxygen ./Doxyfile
|
||||
|
||||
# Run tests on target with expect and serial output
|
||||
phony_test_bins = $(addsuffix .sim, $(TEST_BINS))
|
||||
tests: $(phony_test_bins)
|
||||
.PHONY: tests $(phony_test_bins)
|
||||
$(phony_test_bins):
|
||||
cp $(BUILD_DIR)/$(basename $@) $(TESTS_TFTPROOT)/test.bin
|
||||
@echo Running test $(basename $@)
|
||||
./run_test.exp $(TESTS_TTYDEV) $(TESTS_TTYBAUD)
|
||||
|
||||
50
ports/arm/platforms/dm36x/run_test.exp
Executable file
50
ports/arm/platforms/dm36x/run_test.exp
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env expect
|
||||
|
||||
# Expect script to check an automated test's results via a serial port
|
||||
# and check for successful completion.
|
||||
#
|
||||
# You are expected to set the target's U-boot up to automatically load
|
||||
# the app on your TFTP server called "test.bin". Before this script is
|
||||
# started the Makefile should have copied the next test binary to the
|
||||
# file "test.bin" in your TFTP root folder. The user must sit and
|
||||
# hit the reset button after every test completion in order to make
|
||||
# the board load and run the next test.bin file.
|
||||
#
|
||||
# Arguments: <serial_port_device> <baudrate> <test_bin_file>
|
||||
#
|
||||
# Returns 0 on successful test run, 1 on failure
|
||||
|
||||
# Set the serial port baudrate
|
||||
stty [lindex $argv 1] < [lindex $argv 0]
|
||||
|
||||
# Start the test
|
||||
spawn cat [lindex $argv 0]
|
||||
puts "Ready: reset the target!"
|
||||
|
||||
# Expect to see the test starting within 60 seconds (give long enough
|
||||
# for user to reset the board after running the last test).
|
||||
set timeout 60
|
||||
|
||||
# Wait for the test to start ("Go")
|
||||
expect {
|
||||
"Go\r" {
|
||||
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\r" { puts "Test passed"; exit 0 }
|
||||
"Fail\r" { 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