[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/storage/Config RandRWC.nc, 1.1.2.3, 1.1.2.4

David Gay idgay at users.sourceforge.net
Wed Jun 7 16:08:26 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/storage/Config
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv5232

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	RandRWC.nc 
Log Message:
update test for "read-old-date" semantics


Index: RandRWC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/storage/Config/Attic/RandRWC.nc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** RandRWC.nc	7 Jun 2006 19:57:50 -0000	1.1.2.3
--- RandRWC.nc	7 Jun 2006 23:08:24 -0000	1.1.2.4
***************
*** 14,23 ****
   * @author David Gay
   */
- /*
-   address & 3:
-   1: erase, write
-   2: read
-   3: write some more
- */
  module RandRWC {
    uses {
--- 14,17 ----
***************
*** 41,45 ****
  
    uint8_t data[512], rdata[512];
!   int count, testCount, writeCount;
    struct {
      uint32_t addr;
--- 35,39 ----
  
    uint8_t data[512], rdata[512];
!   int count, testCount, writeCount, countAtCommit;
    struct {
      uint32_t addr;
***************
*** 70,77 ****
    }
  
!   void resetSeed() {
!     shiftReg = 119 * 119 * ((TOS_NODE_ID >> 1) + 1 + writeCount);
      initSeed = shiftReg;
!     mask = 137 * 29 * ((TOS_NODE_ID >> 1) + 1 + writeCount);
    }
    
--- 64,71 ----
    }
  
!   void resetSeed(int offset) {
!     shiftReg = 119 * 119 * ((TOS_NODE_ID >> 1) + 1 + offset);
      initSeed = shiftReg;
!     mask = 137 * 29 * ((TOS_NODE_ID >> 1) + 1 + offset);
    }
    
***************
*** 111,120 ****
    }
  
!   void setupOps() {
      int i;
      uint16_t offset;
  
      count = 0;
!     resetSeed();
  
      for (i = 0; i < NWRITES; i++)
--- 105,114 ----
    }
  
!   void setupOps(int wcount) {
      int i;
      uint16_t offset;
  
      count = 0;
!     resetSeed(wcount);
  
      for (i = 0; i < NWRITES; i++)
***************
*** 191,195 ****
      int i;
  
!     resetSeed();
      for (i = 0; i < sizeof data; i++)
        data[i++] = rand() >> 8;
--- 185,189 ----
      int i;
  
!     resetSeed(0);
      for (i = 0; i < sizeof data; i++)
        data[i++] = rand() >> 8;
***************
*** 221,233 ****
        {
        case A_COMMIT:
  	scheck(call ConfigStorage.commit());
  	break;
        case A_WRITE:
! 	writeCount++;
! 	setupOps();
  	nextWrite();
  	break;
        case A_READ:
! 	setupOps();
  	nextRead();
  	break;
--- 215,227 ----
        {
        case A_COMMIT:
+ 	countAtCommit = writeCount;
  	scheck(call ConfigStorage.commit());
  	break;
        case A_WRITE:
! 	setupOps(++writeCount);
  	nextWrite();
  	break;
        case A_READ:
! 	setupOps(countAtCommit);
  	nextRead();
  	break;
***************
*** 237,241 ****
    const uint8_t actions[] = {
      A_WRITE,
-     //A_READ,
      A_COMMIT,
      A_READ,
--- 231,234 ----
***************
*** 243,247 ****
      A_COMMIT,
      A_READ,
!     A_WRITE
    };
  
--- 236,241 ----
      A_COMMIT,
      A_READ,
!     A_WRITE,
!     A_READ
    };
  
***************
*** 257,261 ****
  	    uint8_t i, nwrites = 0;
  
! 	    /* Figure out what writeCount was at last commit */
  	    for (i = 0; i < sizeof actions; i++)
  	      switch (actions[i])
--- 251,255 ----
  	    uint8_t i, nwrites = 0;
  
! 	    /* Figure out countAtCommit */
  	    for (i = 0; i < sizeof actions; i++)
  	      switch (actions[i])
***************
*** 265,269 ****
  		  break;
  		case A_COMMIT:
! 		  writeCount = nwrites;
  		  break;
  		}
--- 259,263 ----
  		  break;
  		case A_COMMIT:
! 		  countAtCommit = nwrites;
  		  break;
  		}



More information about the Tinyos-2-commits mailing list