[LTP] thermal: add new test group

Petr Vorel pvorel@suse.cz
Fri May 15 16:39:48 CEST 2026


Hi Piotr,

> Hi Piotr,

> On 2026-05-14, Piotr Kubaj wrote:
> > thermal: add new test group

> > +static void run(void)
> > +{
> > +	static bool first_zone = true;
> > +	...
> > +		if (!first_zone) {
> > +			tst_res(TINFO, "Cooling down for %d seconds", COOLDOWN);
> > +			sleep(COOLDOWN);
> > +		}
> > +		first_zone = false;

> The `static` qualifier means `first_zone` is initialized only once, at
> program start. On the second iteration (`-i 2`), it will already be
> `false`, causing the first zone to incur an unnecessary 300-second
> cooldown. Drop `static` so it resets to `true` on every call.

AI is wrong, that was actually the point. IMHO this v20 is better than following
v21. I just wonder if 300 sec isn't too much.

Also, it can still fail if one runs test more times without iterations. But I'm
ok with this known issue.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

If I get Cyril's ack, I'll merge this version with minor formatting diff.

Kind regards,
Petr

diff --git testcases/kernel/thermal/thermal_interrupt_events.c testcases/kernel/thermal/thermal_interrupt_events.c
index b282180314..9d9d9d7e4c 100644
--- testcases/kernel/thermal/thermal_interrupt_events.c
+++ testcases/kernel/thermal/thermal_interrupt_events.c
@@ -201,7 +201,7 @@ static void run(void)
 	for (int i = 0; i < tz_counter; i++) {
 		if (x86_pkg_temp_tz[i]) {
 			if (!first_zone) {
-				tst_res(TINFO, "Cooling down for %d seconds", COOLDOWN);
+				tst_res(TINFO, "Cooling down for %d sec", COOLDOWN);
 				sleep(COOLDOWN);
 			}
 			first_zone = false;
@@ -215,8 +215,8 @@ static void run(void)
 			for (int j = 0; j < nproc; j++) {
 				if (interrupt_later[j] > interrupt_init[j]) {
 					interrupt_increased = true;
-					tst_res(TINFO, "CPU %d interrupt counter: %" PRIu64 " (previous: %" PRIu64 ")",
-						j, interrupt_later[j], interrupt_init[j]);
+					tst_res(TINFO, "CPU %d interrupt counter: %" PRIu64 " => %" PRIu64,
+						j, interrupt_init[j], interrupt_later[j]);
 				}
 			}
 


More information about the ltp mailing list