summaryrefslogtreecommitdiff
path: root/src/p11-tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/p11-tests.c')
-rw-r--r--src/p11-tests.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/p11-tests.c b/src/p11-tests.c
index a77ccea..65414dd 100644
--- a/src/p11-tests.c
+++ b/src/p11-tests.c
@@ -9,19 +9,23 @@
static void
usage()
{
- fprintf(stderr, "usage: p11-tests module [init_string]\n");
+ fprintf(stderr, "usage: p11-tests [-f config] module\n");
exit(2);
}
int
main(int argc, char* argv[])
{
+ const char *config = NULL;
int ch;
- while((ch = getopt(argc, argv, "")) != -1)
+ while((ch = getopt(argc, argv, "f")) != -1)
{
switch(ch)
{
+ case 'f':
+ config = optarg;
+ break;
case '?':
default:
usage();
@@ -32,12 +36,15 @@ main(int argc, char* argv[])
argc -= optind;
argv += optind;
- if(argc < 1 || argc > 2)
+ if(argc != 1)
usage();
+ if(config)
+ p11t_config_parse(config);
+
/* Basic module tests */
p11t_module_load(argv[0]);
- p11t_module_initialize(argc == 2 ? argv[1] : NULL);
+ p11t_module_initialize();
p11t_slot_tests();
p11t_session_tests();
@@ -46,5 +53,7 @@ main(int argc, char* argv[])
p11t_module_finalize();
p11t_module_unload();
+ p11t_config_cleanup();
+
return 0;
}