[gmime] Improved debugging output for unit tests
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Improved debugging output for unit tests
- Date: Sat, 11 Mar 2017 19:20:30 +0000 (UTC)
commit f5fb10ba5aff238006d2ab02307369f72c4a95f9
Author: Jeffrey Stedfast <fejj gnome org>
Date: Sat Mar 11 12:11:49 2017 -0500
Improved debugging output for unit tests
tests/test-pgpmime.c | 30 ++++++++++++++++++++++--------
tests/test-smime.c | 28 +++++++++++++++++++++-------
2 files changed, 43 insertions(+), 15 deletions(-)
---
diff --git a/tests/test-pgpmime.c b/tests/test-pgpmime.c
index 3ee91bf..f31a9b9 100644
--- a/tests/test-pgpmime.c
+++ b/tests/test-pgpmime.c
@@ -75,11 +75,13 @@ print_verify_results (GMimeSignatureList *signatures)
status = get_sig_status (signatures);
- fputs ("Overall status: ", stdout);
+ fprintf (stdout, "Overall status: (0x%x) ", status);
if ((status & GMIME_SIGNATURE_STATUS_RED) != 0)
fputs ("BAD\n", stdout);
else if ((status & GMIME_SIGNATURE_STATUS_GREEN) != 0)
fputs ("GOOD\n", stdout);
+ else if ((status & GMIME_SIGNATURE_STATUS_VALID) != 0)
+ fputs ("VALID\n", stdout);
else
fputs ("UNKNOWN\n", stdout);
@@ -119,6 +121,8 @@ print_verify_results (GMimeSignatureList *signatures)
fputs ("BAD\n", stdout);
else if ((sig->status & GMIME_SIGNATURE_STATUS_GREEN) != 0)
fputs ("GOOD\n", stdout);
+ else if ((sig->status & GMIME_SIGNATURE_STATUS_VALID) != 0)
+ fputs ("VALID\n", stdout);
else
fputs ("UNKNOWN\n", stdout);
@@ -129,15 +133,25 @@ print_verify_results (GMimeSignatureList *signatures)
fprintf (stdout, "\tSignature never expires\n");
fprintf (stdout, "\tErrors: ");
- if (sig->status & GMIME_SIGNATURE_STATUS_SIG_EXPIRED)
- fputs ("Expired, ", stdout);
- if (sig->status & GMIME_SIGNATURE_STATUS_KEY_MISSING)
- fputs ("No Pub Key, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_KEY_REVOKED)
+ fputs ("Key Revoked, ", stdout);
if (sig->status & GMIME_SIGNATURE_STATUS_KEY_EXPIRED)
fputs ("Key Expired, ", stdout);
- if (sig->status & GMIME_SIGNATURE_STATUS_KEY_REVOKED)
- fputs ("Key Revoked", stdout);
- if ((sig->status & ~(GMIME_SIGNATURE_STATUS_GREEN | GMIME_SIGNATURE_STATUS_RED)) == 0)
+ if (sig->status & GMIME_SIGNATURE_STATUS_SIG_EXPIRED)
+ fputs ("Sig Expired, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_KEY_MISSING)
+ fputs ("Key Missing, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_CRL_MISSING)
+ fputs ("CRL Missing, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_CRL_TOO_OLD)
+ fputs ("CRL Too Old, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_BAD_POLICY)
+ fputs ("Bad Policy, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_SYS_ERROR)
+ fputs ("System Error, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_TOFU_CONFLICT)
+ fputs ("Tofu Conflict", stdout);
+ if ((sig->status & ~(GMIME_SIGNATURE_STATUS_VALID | GMIME_SIGNATURE_STATUS_GREEN |
GMIME_SIGNATURE_STATUS_RED)) == 0)
fputs ("None", stdout);
fputc ('\n', stdout);
diff --git a/tests/test-smime.c b/tests/test-smime.c
index c1854bb..91b09db 100644
--- a/tests/test-smime.c
+++ b/tests/test-smime.c
@@ -82,6 +82,8 @@ print_verify_results (GMimeSignatureList *signatures)
fputs ("BAD\n", stdout);
else if ((status & GMIME_SIGNATURE_STATUS_GREEN) != 0)
fputs ("GOOD\n", stdout);
+ else if ((status & GMIME_SIGNATURE_STATUS_VALID) != 0)
+ fputs ("VALID\n", stdout);
else
fputs ("UNKNOWN\n", stdout);
@@ -121,6 +123,8 @@ print_verify_results (GMimeSignatureList *signatures)
fputs ("BAD\n", stdout);
else if ((sig->status & GMIME_SIGNATURE_STATUS_GREEN) != 0)
fputs ("GOOD\n", stdout);
+ else if ((sig->status & GMIME_SIGNATURE_STATUS_VALID) != 0)
+ fputs ("VALID\n", stdout);
else
fputs ("UNKNOWN\n", stdout);
@@ -131,15 +135,25 @@ print_verify_results (GMimeSignatureList *signatures)
fprintf (stdout, "\tSignature never expires\n");
fprintf (stdout, "\tErrors: ");
- if (sig->status & GMIME_SIGNATURE_STATUS_SIG_EXPIRED)
- fputs ("Expired, ", stdout);
- if (sig->status & GMIME_SIGNATURE_STATUS_KEY_MISSING)
- fputs ("No Pub Key, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_KEY_REVOKED)
+ fputs ("Key Revoked, ", stdout);
if (sig->status & GMIME_SIGNATURE_STATUS_KEY_EXPIRED)
fputs ("Key Expired, ", stdout);
- if (sig->status & GMIME_SIGNATURE_STATUS_KEY_REVOKED)
- fputs ("Key Revoked", stdout);
- if ((sig->status & ~(GMIME_SIGNATURE_STATUS_GREEN | GMIME_SIGNATURE_STATUS_RED)) == 0)
+ if (sig->status & GMIME_SIGNATURE_STATUS_SIG_EXPIRED)
+ fputs ("Sig Expired, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_KEY_MISSING)
+ fputs ("Key Missing, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_CRL_MISSING)
+ fputs ("CRL Missing, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_CRL_TOO_OLD)
+ fputs ("CRL Too Old, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_BAD_POLICY)
+ fputs ("Bad Policy, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_SYS_ERROR)
+ fputs ("System Error, ", stdout);
+ if (sig->status & GMIME_SIGNATURE_STATUS_TOFU_CONFLICT)
+ fputs ("Tofu Conflict", stdout);
+ if ((sig->status & ~(GMIME_SIGNATURE_STATUS_VALID | GMIME_SIGNATURE_STATUS_GREEN |
GMIME_SIGNATURE_STATUS_RED)) == 0)
fputs ("None", stdout);
fputc ('\n', stdout);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]