[Tinyos-2-commits] CVS: tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestHwAcksNoCca Makefile, NONE, 1.1 TestTunitC.nc, NONE, 1.1 TestTunitP.nc, NONE, 1.1 suite.properties, NONE, 1.1

David Moss mossmoss at users.sourceforge.net
Sat Jul 21 22:31:46 PDT 2007


Update of /cvsroot/tinyos/tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestHwAcksNoCca
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19699/TestHwAcksNoCca

Added Files:
	Makefile TestTunitC.nc TestTunitP.nc suite.properties 
Log Message:
Moved from a flat directory structure to a project-oriented directory structure

--- NEW FILE: Makefile ---
COMPONENT=TestTunitC
CFLAGS += -DCC2420_HW_ACKNOWLEDGEMENTS
include $(MAKERULES)


--- NEW FILE: TestTunitC.nc ---
/*
 * Copyright (c) 2005-2006 Rincon Research Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the
 *   distribution.
 * - Neither the name of the Rincon Research Corporation nor the names of
 *   its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
 * RINCON RESEARCH OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE
 */
 
/**
 * @author David Moss
 */
configuration TestTunitC {
}

implementation {
  components TestTunitP,
      new TestCaseC() as TestAckSuccessRateC,
      new StatisticsC() as SwAckSuccessStatsC,
      ActiveMessageC,
      CC2420ActiveMessageC,
      new AMSenderC(4),
      new AMReceiverC(4),
      LedsC;
  
  TestTunitP.SetUpOneTime -> TestAckSuccessRateC.SetUpOneTime;
  
  TestTunitP.TestRf -> TestAckSuccessRateC;
  TestTunitP.SplitControl -> ActiveMessageC;
  TestTunitP.AMSend -> AMSenderC;
  TestTunitP.Receive -> AMReceiverC;
  TestTunitP.Leds -> LedsC;
  TestTunitP.PacketAcknowledgements -> ActiveMessageC;
  TestTunitP.Statistics -> SwAckSuccessStatsC;
  TestTunitP.RadioBackoff -> CC2420ActiveMessageC.RadioBackoff[4];
  
  TestTunitP.TearDownOneTime -> TestAckSuccessRateC.TearDownOneTime;
  
}


--- NEW FILE: TestTunitP.nc ---
/*
 * Copyright (c) 2005-2006 Rincon Research Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the
 *   distribution.
 * - Neither the name of the Rincon Research Corporation nor the names of
 *   its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
 * RINCON RESEARCH OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE
 */
 
/**
 * @author David Moss
 */

#include "TestCase.h"

module TestTunitP {
  uses {
    interface TestControl as SetUpOneTime;
    interface TestCase as TestRf;
    interface TestControl as TearDownOneTime;
    interface SplitControl;
    interface AMSend;
    interface Receive;
    interface Leds;
    interface PacketAcknowledgements;
    interface Statistics;
    interface RadioBackoff;
  }
}

implementation {

  /** Message to send */
  message_t myMsg;
  
  /** Number of messages sent */
  uint32_t sent;
  
  /** Number of acks missed out of the number of messages sent */
  uint32_t acksReceived;
  
  
  enum {
    TOTAL_PACKETS = 1000,
    LOWER_BOUNDS = 994,  // 99.4% success
  };
  
  
  /***************** Prototypes ****************/
  task void sendMsg();
  
  
  /***************** SetUpOneTime Events ****************/
  event void SetUpOneTime.run() {
    call SplitControl.start();
    call PacketAcknowledgements.requestAck(&myMsg);
  }
  
  /***************** TearDownOneTime Events ****************/
  event void TearDownOneTime.run() {
    call SplitControl.stop();
  }
  
  /***************** SplitControl Events ****************/
  event void SplitControl.startDone(error_t error) {
    call SetUpOneTime.done();
  }
  
  event void SplitControl.stopDone(error_t error) {
    call TearDownOneTime.done();
  }
    
  /***************** RadioBackoff Events ****************/
  async event void RadioBackoff.requestInitialBackoff(message_t *msg) {
  }
  
  async event void RadioBackoff.requestCongestionBackoff(message_t *msg) {
  }
    
  async event void RadioBackoff.requestCca(message_t *msg) {
    call RadioBackoff.setCca(FALSE);
  }
  
  /***************** TestRf Events ****************/
  event void TestRf.run() {
    sent = 0;
    acksReceived = 0;
    post sendMsg();
  }
  
  /***************** AMSend Events ****************/
  event void AMSend.sendDone(message_t *msg, error_t error) {
    sent++;
    if(call PacketAcknowledgements.wasAcked(msg)) {
      acksReceived++;
      call Leds.led2Off();
    } else {
      call Leds.led2On();
    }
    
    if(sent < TOTAL_PACKETS) {
      post sendMsg();
      
    } else {
      assertResultIsAbove("Missed too many acks", LOWER_BOUNDS, acksReceived);
      call Statistics.log("[# acks/1000 msgs]", acksReceived);
      call TestRf.done();
    }
  }
  
  event message_t *Receive.receive(message_t *msg, void *payload, error_t error) {
    call Leds.led1Toggle();
    return msg;
  }
  
  
  /***************** Statistics Events *****************/
  event void Statistics.logDone() {
  }
  
  /***************** Tasks *****************/
  task void sendMsg() {
    call Leds.led0Toggle();
    if(call AMSend.send(1, &myMsg, 0) != SUCCESS) {
      post sendMsg();
    }
  }
}


--- NEW FILE: suite.properties ---
/**
 * Valid keywords are:
 *  @author <optional author(s)>  (multiple)
 *  @testname <optional testname>  (once)
 *  @description <optional, multiline description>  (once)
 *  @extra <any build/install extras> (multiple)
 *  @ignore <single target>  (multiple)
 *  @only <single target> (multiple)
 *  @minnodes <# nodes>  (once)
 *  @maxnodes <# nodes>  (once)
 *  @exactnodes <# of exact nodes>  (once)
 *  @mintargets <# of minimum targets for heterogeneous network testing>  (once)
 *  @timeout <timeout duration of the test in minutes, default is 1 min.>
 *  @skip  (once)
 */

@testname Test Acknowledgements
@author David Moss
@description Make sure we're seeing at least 99.4% successful acknowledgements
    out of 15000 packets.
@exactnodes 2
@timeout 3
@ignore mica2
@ignore mica2dot
//@skip



More information about the Tinyos-2-commits mailing list