From b47b9697a59dd501fed05edefd661e02a4d12b31 Mon Sep 17 00:00:00 2001 From: Kelvin Lawson Date: Thu, 21 Jun 2012 22:39:25 +0100 Subject: [PATCH] AVR: Add expect script to run test in simavr and check for success. --- ports/avr/run_test.exp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 ports/avr/run_test.exp diff --git a/ports/avr/run_test.exp b/ports/avr/run_test.exp new file mode 100755 index 0000000..7adacad --- /dev/null +++ b/ports/avr/run_test.exp @@ -0,0 +1,31 @@ +#!/usr/bin/env expect + +# Start the test (arguments: ) +spawn [lindex $argv 0] -m [lindex $argv 1] [lindex $argv 2] + +# 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 + } +} +