[Drbd-dev] user interface test of drbd.conf

Lars Ellenberg Lars.Ellenberg at linbit.com
Thu Oct 21 19:03:33 CEST 2004


/ 2004-10-21 17:56:14 +0200
\ Helmut Wollmersdorfer:
> >>>>From my experience as tester I will not expect, that _any_ values will 
> >>>>work correctly without "dry-run".
> 
> >>>hm?

> If I only test with dry-run, I only test the parser. This cannot uncover 
> errors in afterwards logic.
> 
> >and to improve the scanner, maybe limiting to 9 digits will do?
> [...]
> >+OUT_OF_RANGE_NUM	  [0-9]{10,}[kmgKMG]? 
> >+NUM			  [0-9]{1,9}
> >+NUM_U			  [0-9]{1,9}[kmgKMG]?
> Let's try
> 999999999k ~ 1 T
> 999999999M ~ 1000 T
> 999999999G ~ 1000000 T

well, of course there should be additional range_checks
in drbdadm_parser.y

but 9 digits do fit very well into a 32bit integer.
(the default return type of strtol on a 32bit arch).
then the overflow conditions need to be checked before
using the unit multiplier, as mentioned previously.

> [...]
> > <NUM>{
> >   {NUM}			yy_pop_state(); CP; return TK_INTEGER;
> >+  {OUT_OF_RANGE_NUM}	{
> >+			  PRINTF("%s: number too big\n", yytext);
> Better:
> +	PRINTF("%s: number exceeds limit of 9 digits\n", yytext);

yeah, whatever :)

I'm going to make up a decent patch somewhen this weekend, I guess.
though I'll be distracted by some major family meeting ...

	lge


More information about the drbd-dev mailing list