Skip to content

Commit

Permalink
prepare tests to run with configuration parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
maniacbug committed Jul 14, 2011
1 parent af37c34 commit 7640852
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
21 changes: 11 additions & 10 deletions tests/pingpair_test/pingpair_test.pde
Original file line number Diff line number Diff line change
Expand Up @@ -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? */
Expand Down Expand Up @@ -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
//
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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");
Expand Down
7 changes: 6 additions & 1 deletion tests/pingpair_test/runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion tests/pingpair_test/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7640852

Please sign in to comment.