static void torture_log_callback(void **state)
{
    struct test_mock_state t = {
        .executed = 0,
    };

    (void)state; /* unused */

    ssh_set_log_callback(test_mock_ssh_logging_callback);
    ssh_set_log_userdata(&t);
    ssh_set_log_level(1);

    expect_value(test_mock_ssh_logging_callback, priority, 1);
    expect_string(test_mock_ssh_logging_callback, function, "torture_log_callback");
    expect_string(test_mock_ssh_logging_callback, buffer, "torture_log_callback: test");

    SSH_LOG(SSH_LOG_WARN, "test");

    assert_int_equal(t.executed, 1);
}

int torture_run_tests(void) {
    int rc;
    UnitTest tests[] = {
        unit_test_setup_teardown(torture_callbacks_size, setup, teardown),
        unit_test_setup_teardown(torture_callbacks_exists, setup, teardown),
        unit_test(torture_log_callback),
    };

    ssh_init();
    torture_filter_tests(tests);
    rc=run_tests(tests);
    ssh_finalize();
    return rc;
}
Beispiel #2
0
int main(void) {
	const UnitTest tests[] = {
		unit_test_setup_teardown(go_secure_test, setup, teardown),
		unit_test_setup_teardown(go_secure_flags_test, setup, teardown),
  	};

	return run_tests(tests);
}
Beispiel #3
0
int main(int argc, const char *argv[])
{
    int rv;
    int no_cleanup = 0;
    poptContext pc;
    int opt;
    struct poptOption long_options[] = {
        POPT_AUTOHELP
        SSSD_DEBUG_OPTS
        {"no-cleanup", 'n', POPT_ARG_NONE, &no_cleanup, 0,
         _("Do not delete the test database after a test run"), NULL },
        POPT_TABLEEND
    };

    const UnitTest tests[] = {
        /* Utility functions unit test */
        unit_test(dyndns_test_get_ifaddr),

        /* Dynamic DNS update unit tests*/
        unit_test_setup_teardown(dyndns_test_ok,
                                 dyndns_test_setup, dyndns_test_teardown),
        unit_test_setup_teardown(dyndns_test_error,
                                 dyndns_test_setup, dyndns_test_teardown),
        unit_test_setup_teardown(dyndns_test_timeout,
                                 dyndns_test_setup, dyndns_test_teardown),
        unit_test_setup_teardown(dyndns_test_interval,
                                 dyndns_test_setup, dyndns_test_teardown),
    };

    /* Set debug level to invalid value so we can deside if -d 0 was used. */
    debug_level = SSSDBG_INVALID;

    pc = poptGetContext(argv[0], argc, argv, long_options, 0);
    while((opt = poptGetNextOpt(pc)) != -1) {
        switch(opt) {
        default:
            fprintf(stderr, "\nInvalid option %s: %s\n\n",
                    poptBadOption(pc, 0), poptStrerror(opt));
            poptPrintUsage(pc, stderr, 0);
            return 1;
        }
    }
    poptFreeContext(pc);

    DEBUG_CLI_INIT(debug_level);

    /* Even though normally the tests should clean up after themselves
     * they might not after a failed run. Remove the old db to be sure */
    tests_set_cwd();
    test_dom_suite_cleanup(TESTS_PATH, TEST_CONF_DB, TEST_SYSDB_FILE);
    test_dom_suite_setup(TESTS_PATH);

    rv = run_tests(tests);
    if (rv == 0 && !no_cleanup) {
        test_dom_suite_cleanup(TESTS_PATH, TEST_CONF_DB, TEST_SYSDB_FILE);
    }
    return rv;
}
int torture_run_tests(void)
{
    const UnitTest tests[] = {
        unit_test_setup_teardown(check_csync_statedb_load, setup, teardown),
        unit_test_setup_teardown(check_csync_statedb_close, setup, teardown),
    };

    return run_tests(tests);
}
int main(int argc, char *argv[0]) {
    const UnitTest tests[] = {
        unit_test_setup_teardown(test_int_min, int_setup, int_teardown),
        unit_test_setup_teardown(test_int_find, int_setup, int_teardown),
        unit_test_setup_teardown(test_float_max, float_setup, float_teardown),
    };

    return run_tests(tests);
}
int main(int argc, char* argv[]) {
    const UnitTest tests[] = {
        unit_test_setup_teardown(test_find_item_by_value, create_key_values,
                                 destroy_key_values),
        unit_test_setup_teardown(test_sort_items_by_key, create_key_values,
                                 destroy_key_values),
    };
    return run_tests(tests);
}
int main(int argc, char *argv[]) {
    const UnitTest tests[] = {
        unit_test_setup_teardown(test_1, setup, teardown),
        unit_test_setup_teardown(test_2, setup, teardown),
        unit_test_setup_teardown(test_3, setup, teardown),
        unit_test_setup_teardown(test_4, setup, teardown),
    };

    return run_tests(tests);
}
Beispiel #8
0
int torture_run_tests(void)
{
    const UnitTest tests[] = {
        unit_test_setup_teardown(check_csync_exclude_add, setup, teardown),
        unit_test_setup_teardown(check_csync_exclude_load, setup, teardown),
        unit_test_setup_teardown(check_csync_excluded, setup_init, teardown),
    };

    return run_tests(tests);
}
int torture_run_tests(void)
{
  const UnitTest tests[] = {
    unit_test_setup_teardown(check_csync_treewalk_local, setup_local, teardown_local ),
    unit_test_setup_teardown(check_csync_treewalk_remote, setup_remote, teardown_remote),
    unit_test_setup_teardown(check_csync_treewalk_local_with_filter, setup_local, teardown_local)
  };

  return run_tests(tests);
}
Beispiel #10
0
int torture_run_tests(void)
{
    const UnitTest tests[] = {
        unit_test_setup_teardown(check_csync_init_null, setup, teardown),
        unit_test_setup_teardown(check_csync_init, setup, teardown),
        unit_test_setup_teardown(check_csync_init, setup_module, teardown),
    };

    return run_tests(tests);
}
Beispiel #11
0
int torture_run_tests(void)
{
    const UnitTest tests[] = {
        unit_test_setup_teardown(check_c_copy, setup, teardown),
        unit_test(check_c_copy_same_file),
        unit_test_setup_teardown(check_c_copy_isdir, setup, teardown),
        unit_test_setup_teardown(check_c_compare_file, setup, teardown),
    };

    return run_tests(tests);
}
Beispiel #12
0
int torture_run_tests(void)
{
    const UnitTest tests[] = {
        unit_test_setup_teardown(check_readdir_shorttree, setup_testenv, teardown),
        unit_test_setup_teardown(check_readdir_with_content, setup_testenv, teardown),
        unit_test_setup_teardown(check_readdir_longtree, setup_testenv, teardown),
        unit_test_setup_teardown(check_readdir_bigunicode, setup_testenv, teardown),
    };

    return run_tests(tests);
}
Beispiel #13
0
int
main(int argc, char* argv[])
{
        cmockery_parse_arguments(argc, argv);

        const UnitTest tests[] = {
        		unit_test_setup_teardown(test__incompatible_module_error__struct_size_mismatch, SetupDataStructures, TeardownDataStructures),
        		unit_test_setup_teardown(test__incompatible_module_error__headerversion_mismatch, SetupDataStructures, TeardownDataStructures),
        		unit_test_setup_teardown(test__incompatible_module_error__headerversion_identical, SetupDataStructures, TeardownDataStructures),
        };
        return run_tests(tests);
}
Beispiel #14
0
int torture_run_tests(void) {
    int rc;
    const UnitTest tests[] = {
        unit_test_setup_teardown(torture_growing_buffer, setup, teardown),
        unit_test_setup_teardown(torture_growing_buffer_shifting, setup, teardown),
        unit_test_setup_teardown(torture_buffer_prepend, setup, teardown),
    };

    ssh_init();
    rc=run_tests(tests);
    ssh_finalize();
    return rc;
}
int torture_run_tests(void)
{
    const UnitTest tests[] = {
        unit_test_setup_teardown(check_long_win_path,                    setup, teardown),
        unit_test_setup_teardown(check_to_multibyte,                    setup, teardown),
        unit_test_setup_teardown(check_iconv_ascii,                     setup, teardown),
        unit_test_setup_teardown(check_iconv_to_native_normalization,   setup, teardown),
        unit_test_setup_teardown(check_iconv_from_native_normalization, setup, teardown),

    };

    return run_tests(tests);
}
int
main (int   argc,
      char *argv[])
{
    const UnitTest tests[] = {
        unit_test_setup_teardown (access_broker_type_test,
                                  access_broker_setup,
                                  access_broker_teardown),
        unit_test_setup_teardown (access_broker_init_tpm_test,
                                  access_broker_setup,
                                  access_broker_teardown),
        unit_test_setup_teardown (access_broker_get_max_command_test,
                                  access_broker_setup_with_init,
                                  access_broker_teardown),
        unit_test_setup_teardown (access_broker_get_max_response_test,
                                  access_broker_setup_with_init,
                                  access_broker_teardown),
        unit_test_setup_teardown (access_broker_lock_test,
                                  access_broker_setup_with_init,
                                  access_broker_teardown),
        unit_test_setup_teardown (access_broker_send_command_tcti_transmit_fail_test,
                                  access_broker_setup_with_command,
                                  access_broker_teardown),
        unit_test_setup_teardown (access_broker_send_command_tcti_receive_fail_test,
                                  access_broker_setup_with_command,
                                  access_broker_teardown),
        unit_test_setup_teardown (access_broker_send_command_success,
                                  access_broker_setup_with_command,
                                  access_broker_teardown),
    };
    return run_tests (tests);
}
Beispiel #17
0
int main()
{
   int rc = 0;
#if defined(PSO_UNIT_TESTS)
   const UnitTest tests[] = {
      unit_test_setup_teardown( test_null_process, setup_test, teardown_test ),
      unit_test_setup_teardown( test_pass,         setup_test, teardown_test ),
   };

   rc = run_tests(tests);
   
#endif
   return rc;
}
Beispiel #18
0
int main()
{
    UnitTest tests[] = {
        unit_test_setup(enron_suite, fixture_setup_enron),
        unit_test_setup_teardown(test_count, setup, teardown),
        unit_test_setup_teardown(test_dev, setup, teardown),
        unit_test_setup_teardown(test_mean, setup, teardown),
        unit_test_setup_teardown(test_score, setup, teardown),
        unit_test_setup_teardown(test_imat, setup, teardown),
        unit_test_teardown(enron_suite, fixture_teardown),

    };
    return run_tests(tests);
}
Beispiel #19
0
int torture_run_tests(void)
{
    const UnitTest tests[] = {
        unit_test_setup_teardown(check_csync_vio_opendir, setup_dir, teardown),
        unit_test_setup_teardown(check_csync_vio_opendir_perm, setup, teardown),
        unit_test(check_csync_vio_closedir_null),
        unit_test_setup_teardown(check_csync_vio_readdir, setup_dir, teardown),

        unit_test_setup_teardown(check_csync_vio_stat_dir, setup_dir, teardown),
        unit_test_setup_teardown(check_csync_vio_stat_file, setup_file, teardown),
    };

    return run_tests(tests);
}
Beispiel #20
0
int main(void)
{
    const UnitTest tests[] = {
        unit_test(test_sss_open_cloexec_success),
        unit_test(test_sss_open_cloexec_fail),
        unit_test_setup_teardown(test_sss_openat_cloexec_success, setup_dirp,
                                 teardown_dirp),
        unit_test_setup_teardown(test_sss_openat_cloexec_fail, setup_dirp,
                                 teardown_dirp)
    };

    tests_set_cwd();
    return run_tests(tests);
}
Beispiel #21
0
int main(void) {
	const UnitTest tests[] = {
		unit_test_setup_teardown(enrollment_test, pbx_setup, pbx_teardown),
  	};

	return run_tests(tests);
}
int
main( void ) {
  const UnitTest tests[] = {
    unit_test_setup_teardown( test_set_config, init_datapath_condition, finalize_datapath_condition ),
  };
  return run_tests( tests );
}
Beispiel #23
0
int main(void) {
	const UnitTest tests[] = {
		unit_test_setup_teardown(srtp_replay_test, setup, teardown),
  	};

	return run_tests(tests);
}
Beispiel #24
0
int
main() {
  const UnitTest tests[] = {
    unit_test_setup_teardown( test_die, setup, teardown ),

    unit_test( test_hash_core ),

    unit_test( test_compare_string ),
    unit_test( test_hash_string ),

    unit_test( test_compare_uint32 ),
    unit_test( test_hash_uint32 ),

    unit_test( test_compare_datapath_id ),
    unit_test( test_hash_datapath_id ),

    unit_test( test_compare_mac ),
    unit_test( test_hash_mac ),
    unit_test( test_mac_to_uint64 ),

    unit_test( test_string_to_datapath_id ),

    unit_test( test_match_to_string ),
    unit_test( test_match_to_string_fails_with_insufficient_buffer ),

    unit_test( test_phy_port_to_string ),
    unit_test( test_phy_port_to_string_fails_with_insufficient_buffer ),

    unit_test( test_get_checksum_udp_packet ),
    unit_test( test_get_checksum_icmp_packet ),
  };
  setup_leak_detector();
  return run_tests( tests );
}
Beispiel #25
0
int main(void) {
	const UnitTest tests[] = {
		unit_test_setup_teardown(session_init_fails_with_no_dh2k, setup, teardown),
  	};

	return run_tests(tests);
}
Beispiel #26
0
int main()
{
   int rc = 0;
#if defined(PSO_UNIT_TESTS)
   const UnitTest tests[] = {
      unit_test_setup_teardown( test_null_context, setup_test, teardown_test ),
      unit_test_setup_teardown( test_null_memobj,  setup_test, teardown_test ),
      unit_test_setup_teardown( test_null_status,  setup_test, teardown_test ),
      unit_test_setup_teardown( test_pass,         setup_test, teardown_test )
   };

   rc = run_tests(tests);
   
#endif
   return rc;
}
Beispiel #27
0
int main()
{
   int rc = 0;
#if defined(PSO_UNIT_TESTS)
   const UnitTest tests[] = {
      unit_test_setup_teardown( test_invalid_sig, setup_test, teardown_test ),
      unit_test_setup_teardown( test_null_lock,   setup_test, teardown_test ),
      unit_test_setup_teardown( test_zero_value,  setup_test, teardown_test ),
      unit_test_setup_teardown( test_pass,        setup_test, teardown_test )
   };

   rc = run_tests(tests);
   
#endif
   return rc;
}
Beispiel #28
0
int main()
{
   int rc = 0;
#if defined(PSO_UNIT_TESTS)
   const UnitTest tests[] = {
      unit_test_setup_teardown( test_null_address,   setup_test, teardown_test ),
      unit_test_setup_teardown( test_null_answer,    setup_test, teardown_test ),
      unit_test_setup_teardown( test_null_connector, setup_test, teardown_test ),
      unit_test_setup_teardown( test_null_error,     setup_test, teardown_test ),
      unit_test_setup_teardown( test_pass,           setup_test, teardown_test )
   };

   rc = run_tests(tests);
   
#endif
   return rc;
}
int 
main(int argc, char* argv[]) 
{
	cmockery_parse_arguments(argc, argv);

	const UnitTest tests[] = 
	{
		unit_test_setup_teardown(test__build_http_header__remote_login_is_null, 
								 common_setup, common_teardown),
		unit_test_setup_teardown(test__build_http_header__remote_login_is_not_null, 
								 common_setup, common_teardown),
		unit_test_setup_teardown(test__build_http_header__remote_credentials_are_not_null, 
								 common_setup, common_teardown)
	};

	return run_tests(tests);
}
Beispiel #30
0
int main()
{
   int rc = 0;
#if defined(PSO_UNIT_TESTS)
   const UnitTest tests[] = {
      unit_test_setup_teardown( test_null_data,    setup_test, teardown_test ),
      unit_test_setup_teardown( test_null_handle,  setup_test, teardown_test ),
      unit_test_setup_teardown( test_null_length,  setup_test, teardown_test ),
      unit_test_setup_teardown( test_wrong_handle, setup_test, teardown_test ),
      unit_test_setup_teardown( test_pass,         setup_test, teardown_test ),
   };

   rc = run_tests(tests);
   
#endif
   return rc;
}