tests: Add repeat argument to run-verify
* tests/run-verify.c (main): Add repeat argument. -- This helps reproducing rare / random crashes.
This commit is contained in:
parent
8f27511862
commit
681525be00
@ -230,6 +230,7 @@ show_usage (int ex)
|
|||||||
" --openpgp use the OpenPGP protocol (default)\n"
|
" --openpgp use the OpenPGP protocol (default)\n"
|
||||||
" --cms use the CMS protocol\n"
|
" --cms use the CMS protocol\n"
|
||||||
" --sender MBOX use MBOX as sender address\n"
|
" --sender MBOX use MBOX as sender address\n"
|
||||||
|
" --repeat N repeat the operation N times\n"
|
||||||
" --auto-key-retrieve\n"
|
" --auto-key-retrieve\n"
|
||||||
, stderr);
|
, stderr);
|
||||||
exit (ex);
|
exit (ex);
|
||||||
@ -241,17 +242,11 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int last_argc = -1;
|
int last_argc = -1;
|
||||||
const char *s;
|
const char *s;
|
||||||
gpgme_error_t err;
|
|
||||||
gpgme_ctx_t ctx;
|
|
||||||
gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP;
|
gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP;
|
||||||
FILE *fp_sig = NULL;
|
|
||||||
gpgme_data_t sig = NULL;
|
|
||||||
FILE *fp_msg = NULL;
|
|
||||||
gpgme_data_t msg = NULL;
|
|
||||||
gpgme_verify_result_t result;
|
|
||||||
int print_status = 0;
|
int print_status = 0;
|
||||||
const char *sender = NULL;
|
const char *sender = NULL;
|
||||||
int auto_key_retrieve = 0;
|
int auto_key_retrieve = 0;
|
||||||
|
int repeats = 1;
|
||||||
|
|
||||||
if (argc)
|
if (argc)
|
||||||
{ argc--; argv++; }
|
{ argc--; argv++; }
|
||||||
@ -294,6 +289,14 @@ main (int argc, char **argv)
|
|||||||
sender = *argv;
|
sender = *argv;
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp (*argv, "--repeat"))
|
||||||
|
{
|
||||||
|
argc--; argv++;
|
||||||
|
if (!argc)
|
||||||
|
show_usage (1);
|
||||||
|
repeats = atoi (*argv);
|
||||||
|
argc--; argv++;
|
||||||
|
}
|
||||||
else if (!strcmp (*argv, "--auto-key-retrieve"))
|
else if (!strcmp (*argv, "--auto-key-retrieve"))
|
||||||
{
|
{
|
||||||
auto_key_retrieve = 1;
|
auto_key_retrieve = 1;
|
||||||
@ -308,6 +311,23 @@ main (int argc, char **argv)
|
|||||||
if (argc < 1 || argc > 2)
|
if (argc < 1 || argc > 2)
|
||||||
show_usage (1);
|
show_usage (1);
|
||||||
|
|
||||||
|
init_gpgme (protocol);
|
||||||
|
|
||||||
|
for (int i = 0; i < repeats; i++)
|
||||||
|
{
|
||||||
|
gpgme_error_t err;
|
||||||
|
gpgme_ctx_t ctx;
|
||||||
|
FILE *fp_sig = NULL;
|
||||||
|
gpgme_data_t sig = NULL;
|
||||||
|
FILE *fp_msg = NULL;
|
||||||
|
gpgme_data_t msg = NULL;
|
||||||
|
gpgme_verify_result_t result;
|
||||||
|
|
||||||
|
if (repeats > 1)
|
||||||
|
{
|
||||||
|
printf ("Repeat: %i\n", i);
|
||||||
|
}
|
||||||
|
|
||||||
fp_sig = fopen (argv[0], "rb");
|
fp_sig = fopen (argv[0], "rb");
|
||||||
if (!fp_sig)
|
if (!fp_sig)
|
||||||
{
|
{
|
||||||
@ -328,8 +348,6 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init_gpgme (protocol);
|
|
||||||
|
|
||||||
err = gpgme_new (&ctx);
|
err = gpgme_new (&ctx);
|
||||||
fail_if_err (err);
|
fail_if_err (err);
|
||||||
gpgme_set_protocol (ctx, protocol);
|
gpgme_set_protocol (ctx, protocol);
|
||||||
@ -390,5 +408,11 @@ main (int argc, char **argv)
|
|||||||
gpgme_data_release (sig);
|
gpgme_data_release (sig);
|
||||||
|
|
||||||
gpgme_release (ctx);
|
gpgme_release (ctx);
|
||||||
|
|
||||||
|
if (fp_msg)
|
||||||
|
fclose (fp_msg);
|
||||||
|
if (fp_sig)
|
||||||
|
fclose (fp_sig);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user