diff mbox series

[i-g-t] i915_pm_freq_api: Add some debug to tests

Message ID 20230707232359.81039-1-vinay.belgaumkar@intel.com (mailing list archive)
State New, archived
Headers show
Series [i-g-t] i915_pm_freq_api: Add some debug to tests | expand

Commit Message

Vinay Belgaumkar July 7, 2023, 11:23 p.m. UTC
Some subtests seem to be failing in CI, use igt_assert_(lt/eq) which
print the values being compared and some additional debug as well.

Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 tests/i915/i915_pm_freq_api.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

Comments

Dixit, Ashutosh July 8, 2023, 7:36 p.m. UTC | #1
On Fri, 07 Jul 2023 16:23:59 -0700, Vinay Belgaumkar wrote:
>
> Some subtests seem to be failing in CI, use igt_assert_(lt/eq) which
> print the values being compared and some additional debug as well.
>
> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> ---
>  tests/i915/i915_pm_freq_api.c | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/tests/i915/i915_pm_freq_api.c b/tests/i915/i915_pm_freq_api.c
> index 522abee35..cdb2e70ca 100644
> --- a/tests/i915/i915_pm_freq_api.c
> +++ b/tests/i915/i915_pm_freq_api.c
> @@ -55,6 +55,7 @@ static void test_freq_basic_api(int dirfd, int gt)
>	rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ);
>	rp0 = get_freq(dirfd, RPS_RP0_FREQ_MHZ);
>	rpe = get_freq(dirfd, RPS_RP1_FREQ_MHZ);
> +	igt_debug("RPn: %d, RPe: %d, RP0: %d", rpn, rpe, rp0);

Print gt here too.

>
>	/*
>	 * Negative bound tests
> @@ -90,21 +91,18 @@ static void test_reset(int i915, int dirfd, int gt, int count)
>	int fd;
>
>	for (int i = 0; i < count; i++) {
> -		igt_assert_f(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0,
> -			     "Failed after %d good cycles\n", i);
> -		igt_assert_f(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0,
> -			     "Failed after %d good cycles\n", i);
> +		igt_debug("Running cycle: %d", i);
> +		igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0);
> +		igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0);
>		usleep(ACT_FREQ_LATENCY_US);
> -		igt_assert_f(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn,
> -			     "Failed after %d good cycles\n", i);
> +		igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);
>
>		/* Manually trigger a GT reset */
>		fd = igt_debugfs_gt_open(i915, gt, "reset", O_WRONLY);
>		igt_require(fd >= 0);
>		igt_ignore_warn(write(fd, "1\n", 2));
>
> -		igt_assert_f(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn,
> -			     "Failed after %d good cycles\n", i);
> +		igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);

Probably ok but why the changes in this loop?

>	}
>	close(fd);
>  }
> @@ -116,13 +114,13 @@ static void test_suspend(int i915, int dirfd, int gt)
>	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0);
>	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0);
>	usleep(ACT_FREQ_LATENCY_US);
> -	igt_assert(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn);
> +	igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);
>
>	/* Manually trigger a suspend */
>	igt_system_suspend_autoresume(SUSPEND_STATE_S3,
>				      SUSPEND_TEST_NONE);
>
> -	igt_assert(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn);
> +	igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);
>  }
>
>  int i915 = -1;
> --
> 2.38.1
>
Vinay Belgaumkar July 17, 2023, 6:26 p.m. UTC | #2
On 7/8/2023 12:36 PM, Dixit, Ashutosh wrote:
> On Fri, 07 Jul 2023 16:23:59 -0700, Vinay Belgaumkar wrote:
>> Some subtests seem to be failing in CI, use igt_assert_(lt/eq) which
>> print the values being compared and some additional debug as well.
>>
>> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
>> ---
>>   tests/i915/i915_pm_freq_api.c | 18 ++++++++----------
>>   1 file changed, 8 insertions(+), 10 deletions(-)
>>
>> diff --git a/tests/i915/i915_pm_freq_api.c b/tests/i915/i915_pm_freq_api.c
>> index 522abee35..cdb2e70ca 100644
>> --- a/tests/i915/i915_pm_freq_api.c
>> +++ b/tests/i915/i915_pm_freq_api.c
>> @@ -55,6 +55,7 @@ static void test_freq_basic_api(int dirfd, int gt)
>> 	rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ);
>> 	rp0 = get_freq(dirfd, RPS_RP0_FREQ_MHZ);
>> 	rpe = get_freq(dirfd, RPS_RP1_FREQ_MHZ);
>> +	igt_debug("RPn: %d, RPe: %d, RP0: %d", rpn, rpe, rp0);
> Print gt here too.
ok.
>
>> 	/*
>> 	 * Negative bound tests
>> @@ -90,21 +91,18 @@ static void test_reset(int i915, int dirfd, int gt, int count)
>> 	int fd;
>>
>> 	for (int i = 0; i < count; i++) {
>> -		igt_assert_f(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0,
>> -			     "Failed after %d good cycles\n", i);
>> -		igt_assert_f(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0,
>> -			     "Failed after %d good cycles\n", i);
>> +		igt_debug("Running cycle: %d", i);
>> +		igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0);
>> +		igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0);
>> 		usleep(ACT_FREQ_LATENCY_US);
>> -		igt_assert_f(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn,
>> -			     "Failed after %d good cycles\n", i);
>> +		igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);
>>
>> 		/* Manually trigger a GT reset */
>> 		fd = igt_debugfs_gt_open(i915, gt, "reset", O_WRONLY);
>> 		igt_require(fd >= 0);
>> 		igt_ignore_warn(write(fd, "1\n", 2));
>>
>> -		igt_assert_f(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn,
>> -			     "Failed after %d good cycles\n", i);
>> +		igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);
> Probably ok but why the changes in this loop?

There are a couple of bugs that are failing around this area.

Thanks,

Vinay.

>
>> 	}
>> 	close(fd);
>>   }
>> @@ -116,13 +114,13 @@ static void test_suspend(int i915, int dirfd, int gt)
>> 	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0);
>> 	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0);
>> 	usleep(ACT_FREQ_LATENCY_US);
>> -	igt_assert(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn);
>> +	igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);
>>
>> 	/* Manually trigger a suspend */
>> 	igt_system_suspend_autoresume(SUSPEND_STATE_S3,
>> 				      SUSPEND_TEST_NONE);
>>
>> -	igt_assert(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn);
>> +	igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);
>>   }
>>
>>   int i915 = -1;
>> --
>> 2.38.1
>>
diff mbox series

Patch

diff --git a/tests/i915/i915_pm_freq_api.c b/tests/i915/i915_pm_freq_api.c
index 522abee35..cdb2e70ca 100644
--- a/tests/i915/i915_pm_freq_api.c
+++ b/tests/i915/i915_pm_freq_api.c
@@ -55,6 +55,7 @@  static void test_freq_basic_api(int dirfd, int gt)
 	rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ);
 	rp0 = get_freq(dirfd, RPS_RP0_FREQ_MHZ);
 	rpe = get_freq(dirfd, RPS_RP1_FREQ_MHZ);
+	igt_debug("RPn: %d, RPe: %d, RP0: %d", rpn, rpe, rp0);
 
 	/*
 	 * Negative bound tests
@@ -90,21 +91,18 @@  static void test_reset(int i915, int dirfd, int gt, int count)
 	int fd;
 
 	for (int i = 0; i < count; i++) {
-		igt_assert_f(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0,
-			     "Failed after %d good cycles\n", i);
-		igt_assert_f(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0,
-			     "Failed after %d good cycles\n", i);
+		igt_debug("Running cycle: %d", i);
+		igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0);
+		igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0);
 		usleep(ACT_FREQ_LATENCY_US);
-		igt_assert_f(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn,
-			     "Failed after %d good cycles\n", i);
+		igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);
 
 		/* Manually trigger a GT reset */
 		fd = igt_debugfs_gt_open(i915, gt, "reset", O_WRONLY);
 		igt_require(fd >= 0);
 		igt_ignore_warn(write(fd, "1\n", 2));
 
-		igt_assert_f(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn,
-			     "Failed after %d good cycles\n", i);
+		igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);
 	}
 	close(fd);
 }
@@ -116,13 +114,13 @@  static void test_suspend(int i915, int dirfd, int gt)
 	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0);
 	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0);
 	usleep(ACT_FREQ_LATENCY_US);
-	igt_assert(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn);
+	igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);
 
 	/* Manually trigger a suspend */
 	igt_system_suspend_autoresume(SUSPEND_STATE_S3,
 				      SUSPEND_TEST_NONE);
 
-	igt_assert(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn);
+	igt_assert_eq(get_freq(dirfd, RPS_CUR_FREQ_MHZ), rpn);
 }
 
 int i915 = -1;