Merge branch '46-just-use-clang-format-to-reformat-sources' into 'master'

Reformat source code with clang-format

Closes #46

See merge request isc-projects/bind9!2156

(cherry picked from commit 7099e79a9b)

4c3b063e Import Linux kernel .clang-format with small modifications
f50b1e06 Use clang-format to reformat the source files
11341c76 Update the definition files for Windows
df6c1f76 Remove tkey_test (which is no-op anyway)
This commit is contained in:
Ondřej Surý
2020-02-12 14:33:32 +00:00
parent dbe15330fe
commit c931d8e417
974 changed files with 75952 additions and 74434 deletions

View File

@@ -13,13 +13,12 @@
#if HAVE_CMOCKA && !__SANITIZE_ADDRESS__
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <inttypes.h>
#include <sched.h> /* IWYU pragma: keep */
#include <setjmp.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@@ -37,7 +36,8 @@
#if defined(USE_LIBTOOL) || LD_WRAP
static int
_setup(void **state) {
_setup(void **state)
{
isc_result_t result;
UNUSED(state);
@@ -49,7 +49,8 @@ _setup(void **state) {
}
static int
_teardown(void **state) {
_teardown(void **state)
{
UNUSED(state);
ns_test_end();
@@ -65,25 +66,26 @@ _teardown(void **state) {
* Structure containing parameters for ns__query_sfcache_test().
*/
typedef struct {
const ns_test_id_t id; /* libns test identifier */
unsigned int qflags; /* query flags */
bool cache_entry_present; /* whether a SERVFAIL cache entry
matching the query should be
present */
uint32_t cache_entry_flags; /* NS_FAILCACHE_* flags to set for
the SERVFAIL cache entry */
bool servfail_expected; /* whether a cached SERVFAIL is
expected to be returned */
const ns_test_id_t id; /* libns test identifier */
unsigned int qflags; /* query flags */
bool cache_entry_present; /* whether a SERVFAIL cache entry
matching the query should be
present */
uint32_t cache_entry_flags; /* NS_FAILCACHE_* flags to set for
the SERVFAIL cache entry */
bool servfail_expected; /* whether a cached SERVFAIL is
expected to be returned */
} ns__query_sfcache_test_params_t;
/*%
* Perform a single ns__query_sfcache() check using given parameters.
*/
static void
run_sfcache_test(const ns__query_sfcache_test_params_t *test) {
run_sfcache_test(const ns__query_sfcache_test_params_t *test)
{
ns_hooktable_t *query_hooks = NULL;
query_ctx_t *qctx = NULL;
isc_result_t result;
query_ctx_t * qctx = NULL;
isc_result_t result;
const ns_hook_t hook = {
.action = ns_test_hook_catch_call,
};
@@ -122,7 +124,7 @@ run_sfcache_test(const ns__query_sfcache_test_params_t *test) {
*/
if (test->cache_entry_present) {
isc_interval_t hour;
isc_time_t expire;
isc_time_t expire;
isc_interval_set(&hour, 3600, 0);
result = isc_time_nowplusinterval(&expire, &hour);
@@ -163,7 +165,8 @@ run_sfcache_test(const ns__query_sfcache_test_params_t *test) {
/* test ns__query_sfcache() */
static void
ns__query_sfcache_test(void **state) {
ns__query_sfcache_test(void **state)
{
size_t i;
const ns__query_sfcache_test_params_t tests[] = {
@@ -251,28 +254,28 @@ ns__query_sfcache_test(void **state) {
* Structure containing parameters for ns__query_start_test().
*/
typedef struct {
const ns_test_id_t id; /* libns test identifier */
const char *qname; /* QNAME */
dns_rdatatype_t qtype; /* QTYPE */
unsigned int qflags; /* query flags */
bool disable_name_checks; /* if set to true, owner name
checks will be disabled for the
view created */
bool recursive_service; /* if set to true, the view
created will have a cache
database attached */
const char *auth_zone_origin; /* origin name of the zone the
created view will be
authoritative for */
const char *auth_zone_path; /* path to load the authoritative
zone from */
enum { /* expected result: */
NS__QUERY_START_R_INVALID,
NS__QUERY_START_R_REFUSE, /* query should be REFUSED */
NS__QUERY_START_R_CACHE, /* query should be answered from
cache */
NS__QUERY_START_R_AUTH, /* query should be answered using
authoritative data */
const ns_test_id_t id; /* libns test identifier */
const char * qname; /* QNAME */
dns_rdatatype_t qtype; /* QTYPE */
unsigned int qflags; /* query flags */
bool disable_name_checks; /* if set to true, owner name
checks will be disabled for the
view created */
bool recursive_service; /* if set to true, the view
created will have a cache
database attached */
const char *auth_zone_origin; /* origin name of the zone the
created view will be
authoritative for */
const char *auth_zone_path; /* path to load the authoritative
zone from */
enum { /* expected result: */
NS__QUERY_START_R_INVALID,
NS__QUERY_START_R_REFUSE, /* query should be REFUSED */
NS__QUERY_START_R_CACHE, /* query should be answered from
cache */
NS__QUERY_START_R_AUTH, /* query should be answered using
authoritative data */
} expected_result;
} ns__query_start_test_params_t;
@@ -280,10 +283,11 @@ typedef struct {
* Perform a single ns__query_start() check using given parameters.
*/
static void
run_start_test(const ns__query_start_test_params_t *test) {
run_start_test(const ns__query_start_test_params_t *test)
{
ns_hooktable_t *query_hooks = NULL;
query_ctx_t *qctx = NULL;
isc_result_t result;
query_ctx_t * qctx = NULL;
isc_result_t result;
const ns_hook_t hook = {
.action = ns_test_hook_catch_call,
};
@@ -373,8 +377,7 @@ run_start_test(const ns__query_start_test_params_t *test) {
test->id.description, test->id.lineno);
}
if (qctx->db == NULL ||
qctx->db != qctx->client->view->cachedb)
{
qctx->db != qctx->client->view->cachedb) {
fail_msg("# test \"%s\" on line %d: "
"cache database was expected to be "
"attached to query context, but it was not",
@@ -422,7 +425,8 @@ run_start_test(const ns__query_start_test_params_t *test) {
/* test ns__query_start() */
static void
ns__query_start_test(void **state) {
ns__query_start_test(void **state)
{
size_t i;
const ns__query_start_test_params_t tests[] = {
@@ -592,13 +596,14 @@ ns__query_start_test(void **state) {
#endif
int
main(void) {
main(void)
{
#if defined(USE_LIBTOOL) || LD_WRAP
const struct CMUnitTest tests[] = {
cmocka_unit_test_setup_teardown(ns__query_sfcache_test,
_setup, _teardown),
cmocka_unit_test_setup_teardown(ns__query_start_test,
_setup, _teardown),
cmocka_unit_test_setup_teardown(ns__query_sfcache_test, _setup,
_teardown),
cmocka_unit_test_setup_teardown(ns__query_start_test, _setup,
_teardown),
};
return (cmocka_run_group_tests(tests, NULL, NULL));
@@ -612,14 +617,15 @@ main(void) {
#include <stdio.h>
int
main(void) {
main(void)
{
#if __SANITIZE_ADDRESS__
/*
* We disable this test when the address sanitizer is in
* the use, as libuv will trigger errors.
*/
printf("1..0 # Skip ASAN is in use\n");
#else /* ADDRESS_SANIZITER */
#else /* ADDRESS_SANIZITER */
printf("1..0 # Skip cmocka not available\n");
#endif /* __SANITIZE_ADDRESS__ */
return (0);