[Drbd-dev] user interface test of drbd.conf
Helmut Wollmersdorfer
helmut at wollmersdorfer.at
Thu Oct 21 17:56:14 CEST 2004
Lars Ellenberg wrote:
> / 2004-10-21 14:36:16 +0200
> \ Helmut Wollmersdorfer:
>
>>Lars Ellenberg wrote:
>>
>>>/ 2004-10-20 18:17:27 +0200
>>>\ Helmut Wollmersdorfer:
>>>>From my experience as tester I will not expect, that _any_ values will
>>>>work correctly without "dry-run".
>>>hm?
>>Very easy explanation:
>>As we all know, usally numbers represented in text are converted to an
>>easier to handle representation inside a program. This can be hex,
>>decimal packed, floating etc. and mostly will be of fixed length. Even
>>bignums will have an upper limit (e.g. 64Kdigits). If there is no check
>>for a maximum value at input, funny things can happen in program logik
>>afterwards: overruns, skip to negative values, truncated values, which
>>possible could cause crazy program behaviour.
> but what has that to do with dry-run?
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
[...]
> <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);
Helmut Wollmersdorfer
More information about the drbd-dev
mailing list