Ejemplo n.º 1
0
int main(int argc, char *argv[]) {
        int r;
        bool run_ambient;

        log_parse_environment();
        log_open();

        if (getuid() != 0)
                return EXIT_TEST_SKIP;

        r = setup_tests(&run_ambient);
        if (r < 0)
                return -r;

        show_capabilities();

        test_drop_privileges();
        test_update_inherited_set();

        fork_test(test_have_effective_cap);

        if (run_ambient)
                fork_test(test_set_ambient_caps);

        return 0;
}
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
    int ret = EXIT_FAILURE;

    test_open_streams();

    if (!global_init()) {
        test_printf_stderr("Global init failed - aborting\n");
        return ret;
    }

    arg_count = argc - 1;
    args = argv;

    setup_test_framework();

    if (setup_tests())
        ret = run_tests(argv[0]);
    cleanup_tests();
    check_arg_usage();

    ret = pulldown_test_framework(ret);
    test_close_streams();
    return ret;    
}
Ejemplo n.º 3
0
int main(int argc, char* argv[])
   {
   try
      {
      if(argc == 2 && (std::string(argv[1]) == "--help" || std::string(argv[1])== "help"))
         {
         return help(std::cout, argv[0]);
         }

      size_t threads = 0;//std::thread::hardware_concurrency();
      size_t soak = 5;
      const std::string drbg_seed = "";
      bool log_success = false;

      std::vector<std::string> req(argv + 1, argv + argc);

      if(req.empty())
         {
         req = {"block", "stream", "hash", "mac", "modes", "aead", "kdf", "pbkdf", "hmac_drbg", "x931_rng", "util"};

         std::set<std::string> all_others = Botan_Tests::Test::registered_tests();

         for(auto f : req)
            all_others.erase(f);

         req.insert(req.end(), all_others.begin(), all_others.end());
         }

      std::unique_ptr<Botan::RandomNumberGenerator> rng =
         setup_tests(std::cout, threads, soak, log_success, drbg_seed);

      size_t failed = run_tests(req, std::cout, threads);

      if(failed)
         return 2;

      return 0;
      }
   catch(std::exception& e)
      {
      std::cout << "Exception caused test abort: " << e.what() << std::endl;
      return 3;
      }
   catch(...)
      {
      std::cout << "Unknown exception caused test abort" << std::endl;
      return 3;
      }
   }
Ejemplo n.º 4
0
int main(int argc, char *argv[]) {
        int r;

        log_parse_environment();
        log_open();

        if (getuid() != 0)
                return EXIT_TEST_SKIP;

        r = setup_tests();
        if (r < 0)
                return -r;

        show_capabilities();

        test_drop_privileges();
        fork_test(test_have_effective_cap);

        return 0;
}
Ejemplo n.º 5
0
/*
 * brp_test is a small test program to validate the brp library.
 * It iterates over an array of test cases, checking the output of
 * both * the bit length and tau functions to ensure they match our
 * expectations.
 */
int
main(int argc, char *argv[])
{
	unsigned int	i, bitlen;
	int		x;
	int		ch;
	int		runs = 1;

	setup_tests();

	while ((ch = getopt(argc, argv, "n:")) != -1) {
		switch (ch) {
		case 'n':
			runs = atoi(optarg);
			break;
		default: /* NOT REACHED */
			abort();
		}
	}

	while (runs-- >= 0) {
		for (i = 0; i < 4; i++) {
			bitlen = brp_bit_length(test_cases[i].value);
			if (bitlen != test_cases[i].bitlen) {
				fprintf(stderr, "expected bit length %u, saw %u\n",
				    test_cases[i].bitlen, bitlen);
				return EXIT_FAILURE;
			}
			x = brp_tau(test_cases[i].value);
			if (x != test_cases[i].expected) {
				fprintf(stderr, "expected tau(%x) -> %x, saw %x\n",
				    test_cases[i].value, test_cases[i].expected, x);
				return EXIT_FAILURE;
			}
		}
	}

	printf("ok\n");
	return EXIT_SUCCESS;
}
Ejemplo n.º 6
0
int
main (int argc, char **argv)
{
	int result;

	openlog (G_LOG_DOMAIN, LOG_CONS | LOG_PERROR, LOG_DAEMON);
	g_type_init ();
	g_test_init (&argc, &argv, NULL);
	/* Enable debug messages if called with --debug */
	for (; *argv; argv++) {
		if (!g_strcmp0 (*argv, "--debug")) {
			nm_logging_setup ("debug", NULL, NULL);
		}
	}

	SETUP ();

	setup_tests ();

	result = g_test_run ();

	nm_platform_free ();
	return result;
}