On Tue, Oct 26, 2021 at 12:02 AM Cyril Hrubis wrote: > Rarely there is a need to set the test runtime dynamically, the only > tests in LTP that does this are the timer tests that can get two > parameters, number of iterations and sleep time, and the test runtime is > close to the multiplication of these two. > > It's still cleaner to set the runtime and let the test library figure > out the timeout in this case. > If so, should we consider to hinden the .timeout in struct tst_test to prevent users from changing it? IIRC, we currently have ".timeout == -1" to disable test timed out in unsure situation, e.g some OOM tests. But in this patch, I saw you remove that, but not handle it in tst_set_runtime. > > Also when no parameters are passed to these tests the runtime is a sum > of multiplications from the tst_timer_test.c source so we define a > constant in the tst_timer_test.h header and set the max_runtime in the > testcases accordingly. With this we get correct estimate for the test > runtime and tighter, but still forgiving enough, timeout as well. > -- Regards, Li Wang