MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Ritheesh Vedire Date:November 13 2009 3:12pm
Subject:bzr commit into mysql-6.0-backup branch (ritheesh.vedire:2890)
Bug#47540
View as plain text  
#At file:///home/rith/Work/MySQl/bug47540/ based on revid:charles.bell@stripped

 2890 Ritheesh Vedire	2009-11-13
      BUG#47540: Backup unit tests errors on Solaris.
      
      The common error is the placement of plan() at the end
       of run_test().Tests passed when plan() is placed at the begining of
       run_test() adhering to unit test frame work.
      
      In few unit tests, where number of tests to planned are not known before hand,
      plan(NO_PLAN) was called. Whenever ok() fails, g_test.failed is incremented (tap.c)
      and failed tests are reported. 
     @ sql/backup/stream_v1_transport.c
        This solves BUG#46880. See Rafal's note on BUG#46880 page.
     @ unittest/backup/bstr_callback_errors-t.c
        Tests to be planned are known, hence called plan(planned).
     @ unittest/backup/bstr_eos-t.c
        Tests to be planned are not known, hence called plan(NO_PLAN).
        Unit test had an additional issue due to BUG#46880.
     @ unittest/backup/bstr_io_errors-t.c
        Tests to be planned are not known, hence called plan(NO_PLAN).
     @ unittest/backup/bstr_random_chunks-t.c
        Tests to be planned are not known, hence called plan(NO_PLAN).

    modified:
      sql/backup/stream_v1_transport.c
      unittest/backup/bstr_callback_errors-t.c
      unittest/backup/bstr_eos-t.c
      unittest/backup/bstr_io_errors-t.c
      unittest/backup/bstr_random_chunks-t.c
=== modified file 'sql/backup/stream_v1_transport.c'
--- a/sql/backup/stream_v1_transport.c	2009-10-22 08:08:43 +0000
+++ b/sql/backup/stream_v1_transport.c	2009-11-13 15:12:39 +0000
@@ -2022,7 +2022,7 @@ int bstream_next_chunk(backup_stream *s)
         empty the buffer so that the next fragment will be loaded into it when
         the buffer is re-filled below.
       */
-      if (s->buf.header < s->buf.pos)
+      if (s->buf.header <= s->buf.pos)
         s->buf.begin= s->buf.header;
       else
       {

=== modified file 'unittest/backup/bstr_callback_errors-t.c'
--- a/unittest/backup/bstr_callback_errors-t.c	2009-10-23 06:24:37 +0000
+++ b/unittest/backup/bstr_callback_errors-t.c	2009-11-13 15:12:39 +0000
@@ -30,14 +30,21 @@ void run_test()
 {
   uint i;
   uint planned;
+  uint read_planned, write_planned;
+  
+  write_planned= 1 + global_count + 4 + db_count
+                   + 1 + global_count + perdb_count;
+ 
+  read_planned= 3 + global_count + perdb_count + 2;
+
+  planned = read_planned+write_planned;
+
+  plan(planned);
 
   init_catalog(&img_header);
 
   diag("Testing callback failures during writing of backup image");
 
-  planned= 1 + global_count + 4 + db_count
-           + 1 + global_count + perdb_count + 1;
-
   /*
     Do a clean write of backup image to fill callback_counts structure holding
     counters for callback functions.
@@ -89,7 +96,6 @@ void run_test()
 
   diag("Testing callback failures during reading of backup image");
 
-  planned+= 3 + global_count + perdb_count + 2;
 
   /* Do a clean read of the backup image to set the callback counters. */
   reset_counts();
@@ -124,8 +130,6 @@ void run_test()
   /* test errors in memory allocation */
   ok(fail_alloc(RD), "Errors in memory allocation");
 
-  /* Plan (1..n) must be at the beginning or end of the TAP output. */
-  plan(planned);
 }
 
 

=== modified file 'unittest/backup/bstr_eos-t.c'
--- a/unittest/backup/bstr_eos-t.c	2009-10-12 09:08:34 +0000
+++ b/unittest/backup/bstr_eos-t.c	2009-11-13 15:12:39 +0000
@@ -60,6 +60,10 @@ void run_test()
   image_header  hdr;
   int  i;
   byte header;
+ /*
+   Number of tests to be planned are not known at this point.
+ */
+  plan(NO_PLAN);
 
   init_catalog(&hdr);
 
@@ -135,8 +139,6 @@ void run_test()
     *chunk[i]= header;
   }
 
-  /* Plan (1..n) must be at the beginning or end of the TAP output. */
-  plan(1 + 2*chunk_count + 3*(chunk_count-3));
 }
 
 

=== modified file 'unittest/backup/bstr_io_errors-t.c'
--- a/unittest/backup/bstr_io_errors-t.c	2009-10-12 09:08:34 +0000
+++ b/unittest/backup/bstr_io_errors-t.c	2009-11-13 15:12:39 +0000
@@ -16,7 +16,11 @@ void run_test()
 {
   int i;
   int  can_pass;
-  uint planned;
+  
+  /*
+    Number of tests to be planned are not known at this point.
+  */
+  plan(NO_PLAN);
 
   init_catalog(&img_header);
 
@@ -29,7 +33,6 @@ void run_test()
   diag("Made %lu write calls", io_counts.write);
   diag("Wrote %lu bytes", (long unsigned)io_counts.write_bytes);
 
-  planned= 1 + 2*io_counts.write;
 
   /*
     Errors during last 2 write calls (which happen during closing of a stream)
@@ -61,7 +64,6 @@ void run_test()
   diag("Made %lu read calls", io_counts.read);
   diag("Read %lu bytes", (long unsigned)io_counts.read_bytes);
 
-  planned+= 1 + io_counts.read;
 
   for(i= io_counts.read; i > 0 ; --i)
   {
@@ -71,7 +73,4 @@ void run_test()
        "Failing %d-th read call", i);
   }
 
-  /* Plan (1..n) must be at the beginning or end of the TAP output. */
-  plan(planned);
 }
-

=== modified file 'unittest/backup/bstr_random_chunks-t.c'
--- a/unittest/backup/bstr_random_chunks-t.c	2009-10-12 09:08:34 +0000
+++ b/unittest/backup/bstr_random_chunks-t.c	2009-11-13 15:12:39 +0000
@@ -44,9 +44,12 @@ void run_test()
   size_t byte_count;
   size_t csize;
   int    ret;
-  uint   planned;
 
   stream_block_size= BSIZE;
+ /*
+   Number of tests to be planned are not known at this point.
+  */
+  plan(NO_PLAN);
 
   diag("Writing");
 
@@ -62,7 +65,7 @@ void run_test()
   for(byte_count=0 ; byte_count < DATA_AMOUNT ; )
   {
     csize= chunk_size[hash(CSIZE_NUM, chunk_count)];
-
+    
     ok(!write_chunk((backup_stream*)&stream, csize),
        "Wrote chunk #%lu of size %lu bytes", chunk_count, (long unsigned)csize);
 
@@ -79,7 +82,6 @@ void run_test()
 
   diag("Reading");
 
-  planned= 2*chunk_count + 2;
 
   ret= backup_stream_open_rd(&stream, "random.bst"); 
   if (ret)
@@ -111,8 +113,6 @@ void run_test()
   ok(BSTREAM_EOS == ret,"Moving to next chunk after EOS was hit");
 
  end:
-  /* Plan (1..n) must be at the beginning or end of the TAP output. */
-  plan(planned);
 
   backup_stream_close(&stream);
 }


Attachment: [text/bzr-bundle]
Thread
bzr commit into mysql-6.0-backup branch (ritheesh.vedire:2890)Bug#47540Ritheesh Vedire13 Nov
  • Re: bzr commit into mysql-6.0-backup branch (ritheesh.vedire:2890)Bug#47540Rafal Somla13 Nov
  • Re: bzr commit into mysql-6.0-backup branch (ritheesh.vedire:2890)Bug#47540Charles Bell13 Nov