diff options
Diffstat (limited to 'tests/gpg/t-support.h')
| -rw-r--r-- | tests/gpg/t-support.h | 61 | 
1 files changed, 61 insertions, 0 deletions
| diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h index 362b857a..13475f29 100644 --- a/tests/gpg/t-support.h +++ b/tests/gpg/t-support.h @@ -48,6 +48,13 @@    while (0) +static const char * +nonnull (const char *s) +{ +  return s? s :"[none]"; +} + +  void  print_data (gpgme_data_t dh)  { @@ -113,3 +120,57 @@ init_gpgme (gpgme_protocol_t proto)    err = gpgme_engine_check_version (proto);    fail_if_err (err);  } + + +void +print_import_result (gpgme_import_result_t r) +{ +  gpgme_import_status_t st; + +  for (st=r->imports; st; st = st->next) +    { +      printf ("  fpr: %s err: %d (%s) status:", nonnull (st->fpr), +              st->result, gpg_strerror (st->result)); +      if (st->status & GPGME_IMPORT_NEW) +        fputs (" new", stdout); +      if (st->status & GPGME_IMPORT_UID) +        fputs (" uid", stdout); +      if (st->status & GPGME_IMPORT_SIG) +        fputs (" sig", stdout); +      if (st->status & GPGME_IMPORT_SUBKEY) +        fputs (" subkey", stdout); +      if (st->status & GPGME_IMPORT_SECRET) +        fputs (" secret", stdout); +      putchar ('\n'); +    } +  printf ("key import summary:\n" +          "        considered: %d\n" +          "        no user id: %d\n" +          "          imported: %d\n" +          "      imported_rsa: %d\n" +          "         unchanged: %d\n" +          "      new user ids: %d\n" +          "       new subkeys: %d\n" +          "    new signatures: %d\n" +          "   new revocations: %d\n" +          "       secret read: %d\n" +          "   secret imported: %d\n" +          "  secret unchanged: %d\n" +          "  skipped new keys: %d\n" +          "      not imported: %d\n", +          r->considered, +          r->no_user_id, +          r->imported, +          r->imported_rsa, +          r->unchanged, +          r->new_user_ids, +          r->new_sub_keys, +          r->new_signatures, +          r->new_revocations, +          r->secret_read, +          r->secret_imported, +          r->secret_unchanged, +          r->skipped_new_keys, +          r->not_imported); +} + | 
