main.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * lws-api-test-gencrypto
  3. *
  4. * Written in 2010-2018 by Andy Green <[email protected]>
  5. *
  6. * This file is made available under the Creative Commons CC0 1.0
  7. * Universal Public Domain Dedication.
  8. */
  9. #include <libwebsockets.h>
  10. int
  11. test_genaes(struct lws_context *context);
  12. int
  13. test_genec(struct lws_context *context);
  14. int main(int argc, const char **argv)
  15. {
  16. struct lws_context_creation_info info;
  17. struct lws_context *context;
  18. const char *p;
  19. int result = 0, logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE;
  20. if ((p = lws_cmdline_option(argc, argv, "-d")))
  21. logs = atoi(p);
  22. lws_set_log_level(logs, NULL);
  23. lwsl_user("LWS gencrypto apis tests\n");
  24. memset(&info, 0, sizeof info); /* otherwise uninitialized garbage */
  25. info.port = CONTEXT_PORT_NO_LISTEN;
  26. info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
  27. context = lws_create_context(&info);
  28. if (!context) {
  29. lwsl_err("lws init failed\n");
  30. return 1;
  31. }
  32. result |= test_genaes(context);
  33. result |= test_genec(context);
  34. lwsl_user("Completed: %s\n", result ? "FAIL" : "PASS");
  35. lws_context_destroy(context);
  36. return result;
  37. }