diff mbox series

[kvm-unit-tests,4/9] s390x: topology: Don't use non unique message

Message ID 20231011085635.1996346-5-nsg@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: topology: Fixes and extension | expand

Commit Message

Nina Schoetterl-Glausch Oct. 11, 2023, 8:56 a.m. UTC
When we test something, i.e. do a report() we want unique messages,
otherwise, from the test output, it will appear as if the same test was
run multiple times, possible with different PASS/FAIL values.

Convert some reports that don't actually test anything topology specific
into asserts.
Refine the report message for others.

Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
---
 s390x/topology.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Janosch Frank Oct. 11, 2023, 11:11 a.m. UTC | #1
On 10/11/23 10:56, Nina Schoetterl-Glausch wrote:
> When we test something, i.e. do a report() we want unique messages,
> otherwise, from the test output, it will appear as if the same test was
> run multiple times, possible with different PASS/FAIL values.
> 
> Convert some reports that don't actually test anything topology specific
> into asserts.
> Refine the report message for others.
> 
> Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>

Please change to:
s390x: topology: make report messages unique

Reviewed-by: Janosch Frank <frankja@linux.ibm.com>

> ---
>   s390x/topology.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/s390x/topology.c b/s390x/topology.c
> index 49d6dfeb..5374582f 100644
> --- a/s390x/topology.c
> +++ b/s390x/topology.c
> @@ -114,7 +114,7 @@ static void check_polarization_change(void)
>   	report_prefix_push("Polarization change");
>   
>   	/* We expect a clean state through reset */
> -	report(diag308_load_reset(1), "load normal reset done");
> +	assert(diag308_load_reset(1));
>   
>   	/*
>   	 * Set vertical polarization to verify that RESET sets
> @@ -123,7 +123,7 @@ static void check_polarization_change(void)
>   	cc = ptf(PTF_REQ_VERTICAL, &rc);
>   	report(cc == 0, "Set vertical polarization.");
>   
> -	report(diag308_load_reset(1), "load normal reset done");
> +	assert(diag308_load_reset(1));
>   
>   	cc = ptf(PTF_CHECK, &rc);
>   	report(cc == 0, "Reset should clear topology report");
> @@ -137,25 +137,25 @@ static void check_polarization_change(void)
>   	report(cc == 0, "Change to vertical");
>   
>   	cc = ptf(PTF_CHECK, &rc);
> -	report(cc == 1, "Should report");
> +	report(cc == 1, "Should report change after horizontal -> vertical");
>   
>   	cc = ptf(PTF_REQ_VERTICAL, &rc);
>   	report(cc == 2 && rc == PTF_ERR_ALRDY_POLARIZED, "Double change to vertical");
>   
>   	cc = ptf(PTF_CHECK, &rc);
> -	report(cc == 0, "Should not report");
> +	report(cc == 0, "Should not report change after vertical -> vertical");
>   
>   	cc = ptf(PTF_REQ_HORIZONTAL, &rc);
>   	report(cc == 0, "Change to horizontal");
>   
>   	cc = ptf(PTF_CHECK, &rc);
> -	report(cc == 1, "Should Report");
> +	report(cc == 1, "Should report change after vertical -> horizontal");
>   
>   	cc = ptf(PTF_REQ_HORIZONTAL, &rc);
>   	report(cc == 2 && rc == PTF_ERR_ALRDY_POLARIZED, "Double change to horizontal");
>   
>   	cc = ptf(PTF_CHECK, &rc);
> -	report(cc == 0, "Should not report");
> +	report(cc == 0, "Should not report change after horizontal -> horizontal");
>   
>   	report_prefix_pop();
>   }
Nico Boehr Oct. 13, 2023, 8:16 a.m. UTC | #2
Quoting Nina Schoetterl-Glausch (2023-10-11 10:56:27)
> When we test something, i.e. do a report() we want unique messages,
> otherwise, from the test output, it will appear as if the same test was
> run multiple times, possible with different PASS/FAIL values.
> 
> Convert some reports that don't actually test anything topology specific
> into asserts.
> Refine the report message for others.
> 
> Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>

There is still the "TLE: reserved bits 0000000000000000" message which may
be duplicate, but I think you fix that in a later patch.

Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
Nina Schoetterl-Glausch Oct. 13, 2023, 9:18 a.m. UTC | #3
On Fri, 2023-10-13 at 10:16 +0200, Nico Boehr wrote:
> Quoting Nina Schoetterl-Glausch (2023-10-11 10:56:27)
> > When we test something, i.e. do a report() we want unique messages,
> > otherwise, from the test output, it will appear as if the same test was
> > run multiple times, possible with different PASS/FAIL values.
> > 
> > Convert some reports that don't actually test anything topology specific
> > into asserts.
> > Refine the report message for others.
> > 
> > Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> 
> There is still the "TLE: reserved bits 0000000000000000" message which may
> be duplicate, but I think you fix that in a later patch.
> 
> Reviewed-by: Nico Boehr <nrb@linux.ibm.com>

Yes, this isn't comprehensive, the rewrite takes care of the rest.
diff mbox series

Patch

diff --git a/s390x/topology.c b/s390x/topology.c
index 49d6dfeb..5374582f 100644
--- a/s390x/topology.c
+++ b/s390x/topology.c
@@ -114,7 +114,7 @@  static void check_polarization_change(void)
 	report_prefix_push("Polarization change");
 
 	/* We expect a clean state through reset */
-	report(diag308_load_reset(1), "load normal reset done");
+	assert(diag308_load_reset(1));
 
 	/*
 	 * Set vertical polarization to verify that RESET sets
@@ -123,7 +123,7 @@  static void check_polarization_change(void)
 	cc = ptf(PTF_REQ_VERTICAL, &rc);
 	report(cc == 0, "Set vertical polarization.");
 
-	report(diag308_load_reset(1), "load normal reset done");
+	assert(diag308_load_reset(1));
 
 	cc = ptf(PTF_CHECK, &rc);
 	report(cc == 0, "Reset should clear topology report");
@@ -137,25 +137,25 @@  static void check_polarization_change(void)
 	report(cc == 0, "Change to vertical");
 
 	cc = ptf(PTF_CHECK, &rc);
-	report(cc == 1, "Should report");
+	report(cc == 1, "Should report change after horizontal -> vertical");
 
 	cc = ptf(PTF_REQ_VERTICAL, &rc);
 	report(cc == 2 && rc == PTF_ERR_ALRDY_POLARIZED, "Double change to vertical");
 
 	cc = ptf(PTF_CHECK, &rc);
-	report(cc == 0, "Should not report");
+	report(cc == 0, "Should not report change after vertical -> vertical");
 
 	cc = ptf(PTF_REQ_HORIZONTAL, &rc);
 	report(cc == 0, "Change to horizontal");
 
 	cc = ptf(PTF_CHECK, &rc);
-	report(cc == 1, "Should Report");
+	report(cc == 1, "Should report change after vertical -> horizontal");
 
 	cc = ptf(PTF_REQ_HORIZONTAL, &rc);
 	report(cc == 2 && rc == PTF_ERR_ALRDY_POLARIZED, "Double change to horizontal");
 
 	cc = ptf(PTF_CHECK, &rc);
-	report(cc == 0, "Should not report");
+	report(cc == 0, "Should not report change after horizontal -> horizontal");
 
 	report_prefix_pop();
 }