[LTP] [PATCH v3] tst_test: Add min_runtime to control lower bound of scaled runtime

Wei Gao wegao@suse.com
Wed Jun 25 13:49:06 CEST 2025


On Tue, Jun 24, 2025 at 09:14:13PM +0800, Li Wang wrote:
> When LTP_RUNTIME_MUL is set to a value < 1.0 (commonly in CI or fast test
> modes), the effective runtime of tests may be scaled down too aggressively.
> For some tests especially those relying on probabilistic triggers or sampling
> (e.g., fuzzy sync, CVE stress loops, long fault injection), this can result in
> too few iterations or missed conditions, leading to unreliable results.
> 
> This patch introduces a new field: .min_runtime;
> 
> If set, this specifies the minimum allowed runtime (in seconds) after applying
> the LTP_RUNTIME_MUL scaling factor. The final runtime is calculated as:
> 
>   MAX(runtime * LTP_RUNTIME_MUL, min_runtime)
> 
> If min_runtime is not set, a default minimum of 1 second is enforced.
> 
> This approach replaces the need for special flags such as
> TST_NO_FRAC_RUNTIME_MUL and provides a more systematic, flexible solution.
> 
> To validate this logic, I ran the `fuzzy_sync` tests on a Cortex-A55
> CPU at 1.2GHz, running Linux 5.14 (aarch64), with only a single core
> assigned using `taskset` to simulate a worst-case, single-core execution
> scenario:
> 
>     time taskset -c 0 ./cve-2016-7117
> 
> (The test was locally modified to only perform the sampling phase.)
> 
> This setup allows accurate measurement of sampling duration under
> heavily constrained CPU conditions.
> 
> Based on the observed sampling time, I apply the following policy
> for setting `.min_runtime` in affected tests:
> 
>   1. If the sampling time is very short (< 1s), set .min_runtime = 2.
> 
>   2. If the sampling time is > 2s but still less than .runtime,
>      set .min_runtime = 2 * sampling_time, and leave .runtime unchanged.
> 
>   3. If the sampling time exceeds .runtime, set .min_runtime = .runtime
>      and remove .runtime.
> 
> This ensures that the sampling phase is not prematurely interrupted due
> to aggressive runtime scaling, which is especially important in CI and
> low-power platforms.
> 
> This change improves test reliability under constrained runtime conditions
> without sacrificing flexibility for fast-path test execution.
> 
> Tested on:
>   - Cortex-A55, 1.2GHz
>   - Linux 5.14.0-587.536.el9iv.aarch64
> 
> Suggested-by: Martin Doucha <mdoucha@suse.cz>
> Signed-off-by: Li Wang <liwang@redhat.com>
> Cc: Ian Wienand <iwienand@redhat.com>
> Cc: Wei Gao <wegao@suse.com>
> ---

Reviewed-by: Wei Gao <wegao@suse.com>


More information about the ltp mailing list