From 7640852edf6e3cf139608fe70505cffa93a8c650 Mon Sep 17 00:00:00 2001 From: maniacbug Date: Wed, 13 Jul 2011 16:01:45 -0700 Subject: [PATCH] prepare tests to run with configuration parameters --- tests/pingpair_test/pingpair_test.pde | 21 +++++++++++---------- tests/pingpair_test/runtest.py | 7 ++++++- tests/pingpair_test/runtests.sh | 3 ++- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/tests/pingpair_test/pingpair_test.pde b/tests/pingpair_test/pingpair_test.pde index 5840c3c..39ae648 100644 --- a/tests/pingpair_test/pingpair_test.pde +++ b/tests/pingpair_test/pingpair_test.pde @@ -81,6 +81,7 @@ char receive_payload[max_payload_size+1]; // +1 to allow room for a terminating bool done; //*< Are we done with the test? */ bool passed; //*< Have we passed the test? */ +bool notified; //*< Have we notified the user we're done? */ const int num_needed = 10; //*< How many success/failures until we're done? */ int receives_remaining = num_needed; //*< How many ack packets until we declare victory? */ int failures_remaining = num_needed; //*< How many more failed sends until we declare failure? */ @@ -147,6 +148,11 @@ void setup(void) // the test on the sender. // + printf("+READY press any key to start\n\r\n\r"); + + while (! Serial.available() ) {} + Serial.read(); + // // Setup and configure rf radio // @@ -203,16 +209,9 @@ void setup(void) // attachInterrupt(0, check_radio, FALLING); - - // - // Receiver node automatically "passes" the test - // - if ( role == role_receiver ) - { - done = passed = true; - } } + static uint32_t message_count = 0; static uint32_t last_message_count = 0; @@ -246,12 +245,14 @@ void loop(void) // // Receiver role: Does nothing! All the work is in IRQ // - + // // Stop the test if we're done and report results // - if ( done ) + if ( done && ! notified ) { + notified = true; + printf("\n\r+OK "); if ( passed ) printf("PASS\n\r\n\r"); diff --git a/tests/pingpair_test/runtest.py b/tests/pingpair_test/runtest.py index 5611d2c..3b9e0c3 100755 --- a/tests/pingpair_test/runtest.py +++ b/tests/pingpair_test/runtest.py @@ -12,8 +12,13 @@ def read_until(token): return line -ser = serial.Serial(sys.argv[1], 57600, timeout=5) +ser = serial.Serial(sys.argv[1], 57600, timeout=5, dsrdtr=False, rtscts=False) + +read_until("+READY") +ser.write(" ") + line = read_until("+OK") +ser.close() if (line.find("PASS") != -1): sys.exit(0) else: diff --git a/tests/pingpair_test/runtests.sh b/tests/pingpair_test/runtests.sh index 1d0181d..61ed042 100755 --- a/tests/pingpair_test/runtests.sh +++ b/tests/pingpair_test/runtests.sh @@ -3,6 +3,7 @@ # Connect p6 to receiver, p4 to sender jam p4 p6 || exit 1 -./runtest.py /dev/tty.usbserial-A600eHIs || exit 1 +./runtest.py /dev/tty.usbserial-A600eHIs & ./runtest.py /dev/tty.usbserial-A40081RP || exit 1 +kill `jobs -p` exit 0