prepare tests to run with configuration parameters

This commit is contained in:
maniacbug 2011-07-13 16:01:45 -07:00
parent af37c345e8
commit 7640852edf
3 changed files with 19 additions and 12 deletions

View File

@ -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 done; //*< Are we done with the test? */
bool passed; //*< Have we passed 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? */ 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 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? */ 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. // 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 // Setup and configure rf radio
// //
@ -203,15 +209,8 @@ void setup(void)
// //
attachInterrupt(0, check_radio, FALLING); 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 message_count = 0;
static uint32_t last_message_count = 0; static uint32_t last_message_count = 0;
@ -250,8 +249,10 @@ void loop(void)
// //
// Stop the test if we're done and report results // Stop the test if we're done and report results
// //
if ( done ) if ( done && ! notified )
{ {
notified = true;
printf("\n\r+OK "); printf("\n\r+OK ");
if ( passed ) if ( passed )
printf("PASS\n\r\n\r"); printf("PASS\n\r\n\r");

View File

@ -12,8 +12,13 @@ def read_until(token):
return line 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") line = read_until("+OK")
ser.close()
if (line.find("PASS") != -1): if (line.find("PASS") != -1):
sys.exit(0) sys.exit(0)
else: else:

View File

@ -3,6 +3,7 @@
# Connect p6 to receiver, p4 to sender # Connect p6 to receiver, p4 to sender
jam p4 p6 || exit 1 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 ./runtest.py /dev/tty.usbserial-A40081RP || exit 1
kill `jobs -p`
exit 0 exit 0