[LTP] [PATCH v3 2/4] tst_test.c: Add tst_multiply_timeout()
Petr Vorel
pvorel@suse.cz
Thu Oct 17 10:47:52 CEST 2019
Hi Clemens,
> This function is used to adjust timeout values with environment
> variables like LTP_TIMEOUT_MUL.
> Signed-off-by: Clemens Famulla-Conrad <cfamullaconrad@suse.de>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
LGTM, minor formatting/wording bellow.
...
> -void tst_set_timeout(int timeout)
> +unsigned int tst_multiply_timeout(unsigned int timeout)
> {
> - char *mul = getenv("LTP_TIMEOUT_MUL");
> + char *mul;
> + float mul_float;
> +
> + if (timeout_mul == -1){
Please add space before { (on more places + unnecessary { }).
linux/scripts/checkpatch.pl --terse --no-tree -f lib/tst_test.c
would tell you :)
([1] but we don't follow it fully - common sense is applied, but we try).
> + mul = getenv("LTP_TIMEOUT_MUL");
> + if (mul) {
> + timeout_mul = mul_float = atof(mul);
> + if (timeout_mul != mul_float){
> + timeout_mul++;
> + tst_res(TINFO, "ceiling LTP_TIMEOUT_MUL to %d", timeout_mul);
> + }
> + } else {
> + timeout_mul = 1;
> + }
> + }
> + if (timeout_mul < 1)
> + tst_brk(TBROK, "LTP_TIMEOUT_MUL need to be int >= 1! (%d)", timeout_mul);
> +
> + if (timeout < 1)
> + tst_brk(TBROK, "timeout need to be >= 1! (%d)", timeout);
nit: need => maybe must/needs ?
Kind regards,
Petr
[1] https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#131-c-coding-style
More information about the ltp
mailing list