[LTP] thermal: add new test group
Kubaj, Piotr
piotr.kubaj@intel.com
Wed Jun 10 10:02:44 CEST 2026
I think your changes look good, please push!
2026-06-09 (火) の 14:24 +0200 に Cyril Hrubis さんは書きました:
> Hi!
> I've been debugging the test random failures and it all boils down to
> two things:
>
> - the sysfs temperature values are in mC the increment we have is way
> too small
>
> - we need to set the trigger value in the while(sleep_time > 0) loop
> otherwise we can end up running all the iterations with a value
> that
> is too high (if we enter the function when the CPU temperature was
> high)
>
> The test runs reliably for me with -i 100 with these changes, I can
> push
> the test with these changes added if you agree:
>
> diff --git a/testcases/kernel/thermal/thermal_interrupt_events.c
> b/testcases/kernel/thermal/thermal_interrupt_events.c
> index 42e1532f6..ed55632dc 100644
> --- a/testcases/kernel/thermal/thermal_interrupt_events.c
> +++ b/testcases/kernel/thermal/thermal_interrupt_events.c
> @@ -20,10 +20,10 @@
> #include "tst_timer_test.h"
>
> #define TEST_RUNTIME ((RUNTIME + SLEEPTIME) * (SLEEPTIME /
> 2) + COOLDOWN)
> -#define RUNTIME 30
> +#define RUNTIME 10
> #define SLEEPTIME 10
> #define COOLDOWN 300
> -#define TEMP_INCREMENT 10
> +#define TEMP_INCREMENT 5000
>
> static bool *x86_pkg_temp_tz;
> static char temp_path[PATH_MAX], trip_path[PATH_MAX];
> @@ -135,13 +135,8 @@ static void cpu_workload(double run_time)
> }
> }
>
> -static void test_zone(int i)
> +static void set_trippoint(void)
> {
> - int sleep_time = SLEEPTIME;
> - double run_time = RUNTIME;
> -
> - snprintf(temp_path, PATH_MAX,
> "/sys/class/thermal/thermal_zone%d/temp", i);
> - tst_res(TINFO, "Testing %s", temp_path);
> SAFE_FILE_SCANF(temp_path, "%d", &temp);
> if (temp < 0)
> tst_brk(TBROK, "Unexpected zone temperature value
> %d", temp);
> @@ -150,10 +145,21 @@ static void test_zone(int i)
>
> temp_high = temp + TEMP_INCREMENT;
>
> - snprintf(trip_path, PATH_MAX,
> "/sys/class/thermal/thermal_zone%d/trip_point_1_temp", i);
> -
> tst_res(TDEBUG, "Setting new trip_point_1_temp value: %d",
> temp_high);
> SAFE_FILE_PRINTF(trip_path, "%d", temp_high);
> +}
> +
> +static void test_zone(int i)
> +{
> + int sleep_time = SLEEPTIME;
> + double run_time = RUNTIME;
> +
> + snprintf(temp_path, PATH_MAX,
> "/sys/class/thermal/thermal_zone%d/temp", i);
> + snprintf(trip_path, PATH_MAX,
> "/sys/class/thermal/thermal_zone%d/trip_point_1_temp", i);
> +
> + tst_res(TINFO, "Testing %s", temp_path);
> +
> + set_trippoint();
>
> while (sleep_time > 0) {
> tst_res(TDEBUG, "Running for %f seconds, then
> sleeping for %d seconds", run_time, sleep_time);
> @@ -173,7 +179,9 @@ static void test_zone(int i)
> if (temp > temp_high)
> break;
> sleep(sleep_time--);
> - run_time -= 3;
> + run_time--;
> +
> + set_trippoint();
> }
> }
>
---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.
Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
More information about the ltp
mailing list