diff mbox series

[12/16] tests: do not print benchmark output to stdout

Message ID 20200828110734.1638685-13-marcandre.lureau@redhat.com
State New
Headers show
Series [01/16] meson: build qapi tests library | expand

Commit Message

Marc-André Lureau Aug. 28, 2020, 11:07 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

As this makes the TAP output invalid. Use g_test_message().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/benchmark-crypto-cipher.c | 8 ++++----
 tests/benchmark-crypto-hash.c   | 2 +-
 tests/benchmark-crypto-hmac.c   | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

Comments

Philippe Mathieu-Daudé Aug. 31, 2020, 5:43 p.m. UTC | #1
Le ven. 28 août 2020 13:11, <marcandre.lureau@redhat.com> a écrit :

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> As this makes the TAP output invalid. Use g_test_message().
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

---
>  tests/benchmark-crypto-cipher.c | 8 ++++----
>  tests/benchmark-crypto-hash.c   | 2 +-
>  tests/benchmark-crypto-hmac.c   | 8 ++++----
>  3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/tests/benchmark-crypto-cipher.c
> b/tests/benchmark-crypto-cipher.c
> index 53032334ec..1936aa4ae0 100644
> --- a/tests/benchmark-crypto-cipher.c
> +++ b/tests/benchmark-crypto-cipher.c
> @@ -70,8 +70,8 @@ static void test_cipher_speed(size_t chunk_size,
>      }
>      g_test_timer_elapsed();
>
> -    g_print("Enc chunk %zu bytes ", chunk_size);
> -    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
> +    g_test_message("Enc chunk %zu bytes ", chunk_size);
> +    g_test_message("%.2f MB/sec ", (double)total / MiB /
> g_test_timer_last());
>
>      g_test_timer_start();
>      remain = total;
> @@ -85,8 +85,8 @@ static void test_cipher_speed(size_t chunk_size,
>      }
>      g_test_timer_elapsed();
>
> -    g_print("Dec chunk %zu bytes ", chunk_size);
> -    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
> +    g_test_message("Dec chunk %zu bytes ", chunk_size);
> +    g_test_message("%.2f MB/sec ", (double)total / MiB /
> g_test_timer_last());
>
>      qcrypto_cipher_free(cipher);
>      g_free(plaintext);
> diff --git a/tests/benchmark-crypto-hash.c b/tests/benchmark-crypto-hash.c
> index d16837d00a..598111e75a 100644
> --- a/tests/benchmark-crypto-hash.c
> +++ b/tests/benchmark-crypto-hash.c
> @@ -48,7 +48,7 @@ static void test_hash_speed(const void *opaque)
>      }
>      g_test_timer_elapsed();
>
> -    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
> +    g_test_message("%.2f MB/sec ", (double)total / MiB /
> g_test_timer_last());
>
>      g_free(out);
>      g_free(in);
> diff --git a/tests/benchmark-crypto-hmac.c b/tests/benchmark-crypto-hmac.c
> index f1dfa240cb..f9fa22df95 100644
> --- a/tests/benchmark-crypto-hmac.c
> +++ b/tests/benchmark-crypto-hmac.c
> @@ -55,10 +55,10 @@ static void test_hmac_speed(const void *opaque)
>      } while (g_test_timer_elapsed() < 5.0);
>
>      total /= MiB;
> -    g_print("hmac(sha256): ");
> -    g_print("Testing chunk_size %zu bytes ", chunk_size);
> -    g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last());
> -    g_print("%.2f MB/sec\n", total / g_test_timer_last());
> +    g_test_message("hmac(sha256): ");
> +    g_test_message("Testing chunk_size %zu bytes ", chunk_size);
> +    g_test_message("done: %.2f MB in %.2f secs: ", total,
> g_test_timer_last());
> +    g_test_message("%.2f MB/sec\n", total / g_test_timer_last());
>
>      g_free(out);
>      g_free(in);
> --
> 2.26.2
>
>
>
<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 28 août 2020 13:11,  &lt;<a href="mailto:marcandre.lureau@redhat.com">marcandre.lureau@redhat.com</a>&gt; a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Marc-André Lureau &lt;<a href="mailto:marcandre.lureau@redhat.com" target="_blank" rel="noreferrer">marcandre.lureau@redhat.com</a>&gt;<br>
<br>
As this makes the TAP output invalid. Use g_test_message().<br>
<br>
Signed-off-by: Marc-André Lureau &lt;<a href="mailto:marcandre.lureau@redhat.com" target="_blank" rel="noreferrer">marcandre.lureau@redhat.com</a>&gt;<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif;font-size:13.696px">Reviewed-by: Philippe Mathieu-Daudé &lt;</span><a href="mailto:f4bug@amsat.org" style="text-decoration:none;color:rgb(66,133,244);font-family:sans-serif;font-size:13.696px">f4bug@amsat.org</a><span style="font-family:sans-serif;font-size:13.696px">&gt;</span><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
 tests/benchmark-crypto-cipher.c | 8 ++++----<br>
 tests/benchmark-crypto-hash.c   | 2 +-<br>
 tests/benchmark-crypto-hmac.c   | 8 ++++----<br>
 3 files changed, 9 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/tests/benchmark-crypto-cipher.c b/tests/benchmark-crypto-cipher.c<br>
index 53032334ec..1936aa4ae0 100644<br>
--- a/tests/benchmark-crypto-cipher.c<br>
+++ b/tests/benchmark-crypto-cipher.c<br>
@@ -70,8 +70,8 @@ static void test_cipher_speed(size_t chunk_size,<br>
     }<br>
     g_test_timer_elapsed();<br>
<br>
-    g_print(&quot;Enc chunk %zu bytes &quot;, chunk_size);<br>
-    g_print(&quot;%.2f MB/sec &quot;, (double)total / MiB / g_test_timer_last());<br>
+    g_test_message(&quot;Enc chunk %zu bytes &quot;, chunk_size);<br>
+    g_test_message(&quot;%.2f MB/sec &quot;, (double)total / MiB / g_test_timer_last());<br>
<br>
     g_test_timer_start();<br>
     remain = total;<br>
@@ -85,8 +85,8 @@ static void test_cipher_speed(size_t chunk_size,<br>
     }<br>
     g_test_timer_elapsed();<br>
<br>
-    g_print(&quot;Dec chunk %zu bytes &quot;, chunk_size);<br>
-    g_print(&quot;%.2f MB/sec &quot;, (double)total / MiB / g_test_timer_last());<br>
+    g_test_message(&quot;Dec chunk %zu bytes &quot;, chunk_size);<br>
+    g_test_message(&quot;%.2f MB/sec &quot;, (double)total / MiB / g_test_timer_last());<br>
<br>
     qcrypto_cipher_free(cipher);<br>
     g_free(plaintext);<br>
diff --git a/tests/benchmark-crypto-hash.c b/tests/benchmark-crypto-hash.c<br>
index d16837d00a..598111e75a 100644<br>
--- a/tests/benchmark-crypto-hash.c<br>
+++ b/tests/benchmark-crypto-hash.c<br>
@@ -48,7 +48,7 @@ static void test_hash_speed(const void *opaque)<br>
     }<br>
     g_test_timer_elapsed();<br>
<br>
-    g_print(&quot;%.2f MB/sec &quot;, (double)total / MiB / g_test_timer_last());<br>
+    g_test_message(&quot;%.2f MB/sec &quot;, (double)total / MiB / g_test_timer_last());<br>
<br>
     g_free(out);<br>
     g_free(in);<br>
diff --git a/tests/benchmark-crypto-hmac.c b/tests/benchmark-crypto-hmac.c<br>
index f1dfa240cb..f9fa22df95 100644<br>
--- a/tests/benchmark-crypto-hmac.c<br>
+++ b/tests/benchmark-crypto-hmac.c<br>
@@ -55,10 +55,10 @@ static void test_hmac_speed(const void *opaque)<br>
     } while (g_test_timer_elapsed() &lt; 5.0);<br>
<br>
     total /= MiB;<br>
-    g_print(&quot;hmac(sha256): &quot;);<br>
-    g_print(&quot;Testing chunk_size %zu bytes &quot;, chunk_size);<br>
-    g_print(&quot;done: %.2f MB in %.2f secs: &quot;, total, g_test_timer_last());<br>
-    g_print(&quot;%.2f MB/sec\n&quot;, total / g_test_timer_last());<br>
+    g_test_message(&quot;hmac(sha256): &quot;);<br>
+    g_test_message(&quot;Testing chunk_size %zu bytes &quot;, chunk_size);<br>
+    g_test_message(&quot;done: %.2f MB in %.2f secs: &quot;, total, g_test_timer_last());<br>
+    g_test_message(&quot;%.2f MB/sec\n&quot;, total / g_test_timer_last());<br>
<br>
     g_free(out);<br>
     g_free(in);<br>
-- <br>
2.26.2<br>
<br>
<br>
</blockquote></div></div></div>
diff mbox series

Patch

diff --git a/tests/benchmark-crypto-cipher.c b/tests/benchmark-crypto-cipher.c
index 53032334ec..1936aa4ae0 100644
--- a/tests/benchmark-crypto-cipher.c
+++ b/tests/benchmark-crypto-cipher.c
@@ -70,8 +70,8 @@  static void test_cipher_speed(size_t chunk_size,
     }
     g_test_timer_elapsed();
 
-    g_print("Enc chunk %zu bytes ", chunk_size);
-    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+    g_test_message("Enc chunk %zu bytes ", chunk_size);
+    g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
 
     g_test_timer_start();
     remain = total;
@@ -85,8 +85,8 @@  static void test_cipher_speed(size_t chunk_size,
     }
     g_test_timer_elapsed();
 
-    g_print("Dec chunk %zu bytes ", chunk_size);
-    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+    g_test_message("Dec chunk %zu bytes ", chunk_size);
+    g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
 
     qcrypto_cipher_free(cipher);
     g_free(plaintext);
diff --git a/tests/benchmark-crypto-hash.c b/tests/benchmark-crypto-hash.c
index d16837d00a..598111e75a 100644
--- a/tests/benchmark-crypto-hash.c
+++ b/tests/benchmark-crypto-hash.c
@@ -48,7 +48,7 @@  static void test_hash_speed(const void *opaque)
     }
     g_test_timer_elapsed();
 
-    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+    g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
 
     g_free(out);
     g_free(in);
diff --git a/tests/benchmark-crypto-hmac.c b/tests/benchmark-crypto-hmac.c
index f1dfa240cb..f9fa22df95 100644
--- a/tests/benchmark-crypto-hmac.c
+++ b/tests/benchmark-crypto-hmac.c
@@ -55,10 +55,10 @@  static void test_hmac_speed(const void *opaque)
     } while (g_test_timer_elapsed() < 5.0);
 
     total /= MiB;
-    g_print("hmac(sha256): ");
-    g_print("Testing chunk_size %zu bytes ", chunk_size);
-    g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last());
-    g_print("%.2f MB/sec\n", total / g_test_timer_last());
+    g_test_message("hmac(sha256): ");
+    g_test_message("Testing chunk_size %zu bytes ", chunk_size);
+    g_test_message("done: %.2f MB in %.2f secs: ", total, g_test_timer_last());
+    g_test_message("%.2f MB/sec\n", total / g_test_timer_last());
 
     g_free(out);
     g_free(in);