← Back to team overview

maria-discuss team mailing list archive

Re: Maria/Aria unit test failures

 

On 4/19/2012 10:30 PM, Elena Stepanova wrote:
> Hi,
> >> My build tool runs 'make test-unit' and the following errors appear.
>
> >> [16:34:05] ../storage/maria/unittest/ma_test_all-t
> >> .....................
> >> 73/830
> >> Failed test '../storage/maria/unittest/../ma_test2 -s -htmp -m10000
> >> -e4096 -K ' (loop iteration 8.) at line 316
> >> (errcode: 256, test: 83)
>
>
> From what I see, ma_test2 has the array key3[5000], used in a loop
> which sets
> n3=rnd(5000);
> and then reads
> key3[n3] == ...
>
> while rnd(uint max_value) is
> return (uint) ((rand() & 32767)/32767.0*max_value);
>
> which means with some luck it can return max_value itself.
> Luck happens, rnd returns 5000, key3[n3] reads something entirely
> wrong (in my case the value of 'silent' variable which is int and set
> to 1 as the unit test is launched with -s), the entire condition check
> with key3[n3] gets twisted, the bogus error occurs.

That patch led me in the right direction.

The attached patch also lists a second possible index issue below what
you pointed out.

I'll file a bug to get this included in the future.

Brian

--- mysql/storage/maria/ma_test2.c	2012-04-05 06:48:45.000000000 -0400
+++ mysql.new/storage/maria/ma_test2.c	2012-04-25 10:08:30.768603663 -0400
@@ -259,7 +259,7 @@
   for (i=0 ; i < recant ; i++)
   {
     ulong blob_length;
-    n1=rnd(1000); n2=rnd(100); n3=rnd(5000);
+    n1=rnd(1000); n2=rnd(100); n3=rnd(4999);
     sprintf((char*) record,"%6d:%4d:%8d:Pos: %4d    ",n1,n2,n3,write_count);
     int4store(record+STANDARD_LENGTH-4,(long) i);
     fix_length(record,(uint) STANDARD_LENGTH+rnd(60));
@@ -374,7 +374,7 @@
 
   for (i=0 ; i < update_count ; i++)
   {
-    n1=rnd(1000); n2=rnd(100); n3=rnd(5000);
+    n1=rnd(1000); n2=rnd(100); n3=rnd(4999);
     sprintf((char*) record2,"%6d:%4d:%8d:XXX: %4d     ",n1,n2,n3,update);
     int4store(record2+STANDARD_LENGTH-4,(long) i);
     fix_length(record2,(uint) STANDARD_LENGTH+rnd(60));

References