summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2014-02-12 10:12:59 -0500
committerJakub Hrozek <jhrozek@redhat.com>2014-02-12 22:31:02 +0100
commit83bf46f4066e3d5e838a32357c201de9bd6ecdfd (patch)
tree65f491f7661bd533398625e015f2b5e5bff3badf /src/tests
parent45a1d9d597df977354428440aeff11c6a0a947fe (diff)
downloadsssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.tar.gz
sssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.tar.xz
sssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.zip
Update DEBUG* invocations to use new levels
Use a script to update DEBUG* macro invocations, which use literal numbers for levels, to use bitmask macros instead: grep -rl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e 'use strict; use File::Slurp; my @map=qw" SSSDBG_FATAL_FAILURE SSSDBG_CRIT_FAILURE SSSDBG_OP_FAILURE SSSDBG_MINOR_FAILURE SSSDBG_CONF_SETTINGS SSSDBG_FUNC_DATA SSSDBG_TRACE_FUNC SSSDBG_TRACE_LIBS SSSDBG_TRACE_INTERNAL SSSDBG_TRACE_ALL "; my $text=read_file(\*STDIN); my $repl; $text=~s/ ^ ( .* \b (DEBUG|DEBUG_PAM_DATA|DEBUG_GR_MEM) \s* \(\s* )( [0-9] )( \s*, ) ( \s* ) ( .* ) $ / $repl = $1.$map[$3].$4.$5.$6, length($repl) <= 80 ? $repl : $1.$map[$3].$4."\n".(" " x length($1)).$6 /xmge; print $text; ' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/auth-tests.c2
-rw-r--r--src/tests/files-tests.c15
-rw-r--r--src/tests/resolv-tests.c45
-rw-r--r--src/tests/sysdb-tests.c5
-rw-r--r--src/tests/sysdb_ssh-tests.c2
5 files changed, 39 insertions, 30 deletions
diff --git a/src/tests/auth-tests.c b/src/tests/auth-tests.c
index 1a93eb110..810a02be8 100644
--- a/src/tests/auth-tests.c
+++ b/src/tests/auth-tests.c
@@ -88,7 +88,7 @@ static int setup_sysdb_tests(struct sysdb_test_ctx **ctx)
talloc_free(test_ctx);
return ENOMEM;
}
- DEBUG(3, "CONFDB: %s\n", conf_db);
+ DEBUG(SSSDBG_MINOR_FAILURE, "CONFDB: %s\n", conf_db);
/* Connect to the conf db */
ret = confdb_init(test_ctx, &test_ctx->confdb, conf_db);
diff --git a/src/tests/files-tests.c b/src/tests/files-tests.c
index 8e1ac0c9d..2a0e7ce41 100644
--- a/src/tests/files-tests.c
+++ b/src/tests/files-tests.c
@@ -64,14 +64,14 @@ static void teardown_files_test(void)
cmd = talloc_asprintf(test_ctx, "/bin/rm -rf %s\n", dir_path);
ret = system(cmd);
if (ret == -1) {
- DEBUG(1, "Removing [%s] failed.\n", dir_path);
+ DEBUG(SSSDBG_CRIT_FAILURE, "Removing [%s] failed.\n", dir_path);
}
}
if (dst_path && test_ctx) {
cmd = talloc_asprintf(test_ctx, "/bin/rm -rf %s\n", dst_path);
ret = system(cmd);
if (ret == -1) {
- DEBUG(1, "Removing [%s] failed.\n", dst_path);
+ DEBUG(SSSDBG_CRIT_FAILURE, "Removing [%s] failed.\n", dst_path);
}
}
@@ -109,7 +109,7 @@ START_TEST(test_remove_tree)
fail_unless(getcwd(origpath, PATH_MAX) == origpath, "Cannot getcwd\n");
fail_unless(errno == 0, "Cannot getcwd\n");
- DEBUG(5, "About to delete %s\n", dir_path);
+ DEBUG(SSSDBG_FUNC_DATA, "About to delete %s\n", dir_path);
/* create a file */
ret = chdir(dir_path);
@@ -182,7 +182,8 @@ START_TEST(test_simple_copy)
fail_if(ret == -1, "Cannot chdir\n");
/* and finally copy.. */
- DEBUG(5, "Will copy from '%s' to '%s'\n", dir_path, dst_path);
+ DEBUG(SSSDBG_FUNC_DATA,
+ "Will copy from '%s' to '%s'\n", dir_path, dst_path);
ret = copy_tree(dir_path, dst_path, 0700, uid, gid);
fail_unless(ret == EOK, "copy_tree failed\n");
@@ -224,7 +225,8 @@ START_TEST(test_copy_symlink)
fail_if(ret == -1, "Cannot chdir\n");
/* and finally copy.. */
- DEBUG(5, "Will copy from '%s' to '%s'\n", dir_path, dst_path);
+ DEBUG(SSSDBG_FUNC_DATA,
+ "Will copy from '%s' to '%s'\n", dir_path, dst_path);
ret = copy_tree(dir_path, dst_path, 0700, uid, gid);
fail_unless(ret == EOK, "copy_tree failed\n");
@@ -262,7 +264,8 @@ START_TEST(test_copy_node)
fail_if(ret == -1, "Cannot chdir\n");
/* and finally copy.. */
- DEBUG(5, "Will copy from '%s' to '%s'\n", dir_path, dst_path);
+ DEBUG(SSSDBG_FUNC_DATA,
+ "Will copy from '%s' to '%s'\n", dir_path, dst_path);
ret = copy_tree(dir_path, dst_path, 0700, uid, gid);
fail_unless(ret == EOK, "copy_tree failed\n");
diff --git a/src/tests/resolv-tests.c b/src/tests/resolv-tests.c
index eb54e2c2c..abf7539db 100644
--- a/src/tests/resolv-tests.c
+++ b/src/tests/resolv-tests.c
@@ -273,11 +273,12 @@ static void test_ip_addr(struct tevent_req *req)
&status, NULL, &rhostent);
talloc_zfree(req);
if (recv_status != EOK) {
- DEBUG(2, "resolv_gethostbyname_recv failed: %d\n", recv_status);
+ DEBUG(SSSDBG_OP_FAILURE,
+ "resolv_gethostbyname_recv failed: %d\n", recv_status);
test_ctx->error = recv_status;
return;
}
- DEBUG(7, "resolv_gethostbyname_recv status: %d\n", status);
+ DEBUG(SSSDBG_TRACE_LIBS, "resolv_gethostbyname_recv status: %d\n", status);
test_ctx->error = ENOENT;
for (i = 0; rhostent->addr_list[i]; i++) {
@@ -310,7 +311,7 @@ START_TEST(test_resolv_ip_addr)
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_ONLY,
default_host_dbs);
- DEBUG(7, "Sent resolv_gethostbyname\n");
+ DEBUG(SSSDBG_TRACE_LIBS, "Sent resolv_gethostbyname\n");
if (req == NULL) {
ret = ENOMEM;
}
@@ -342,11 +343,12 @@ static void test_localhost(struct tevent_req *req)
&status, NULL, &rhostent);
talloc_zfree(req);
if (recv_status != EOK) {
- DEBUG(2, "resolv_gethostbyname_recv failed: %d\n", recv_status);
+ DEBUG(SSSDBG_OP_FAILURE,
+ "resolv_gethostbyname_recv failed: %d\n", recv_status);
test_ctx->error = recv_status;
return;
}
- DEBUG(7, "resolv_gethostbyname_recv status: %d\n", status);
+ DEBUG(SSSDBG_TRACE_LIBS, "resolv_gethostbyname_recv status: %d\n", status);
test_ctx->error = ENOENT;
for (i = 0; rhostent->addr_list[i]; i++) {
@@ -379,7 +381,7 @@ START_TEST(test_resolv_localhost)
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_FIRST,
default_host_dbs);
- DEBUG(7, "Sent resolv_gethostbyname\n");
+ DEBUG(SSSDBG_TRACE_LIBS, "Sent resolv_gethostbyname\n");
if (req == NULL) {
ret = ENOMEM;
}
@@ -410,12 +412,14 @@ static void test_negative(struct tevent_req *req)
&status, NULL, &hostent);
talloc_zfree(req);
if (recv_status == EOK) {
- DEBUG(7, "resolv_gethostbyname_recv succeeded in a negative test\n");
+ DEBUG(SSSDBG_TRACE_LIBS,
+ "resolv_gethostbyname_recv succeeded in a negative test\n");
return;
}
test_ctx->error = status;
- DEBUG(2, "resolv_gethostbyname_recv status: %d: %s\n", status, resolv_strerror(status));
+ DEBUG(SSSDBG_OP_FAILURE,
+ "resolv_gethostbyname_recv status: %d: %s\n", status, resolv_strerror(status));
}
START_TEST(test_resolv_negative)
@@ -435,7 +439,7 @@ START_TEST(test_resolv_negative)
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_FIRST,
default_host_dbs);
- DEBUG(7, "Sent resolv_gethostbyname\n");
+ DEBUG(SSSDBG_TRACE_LIBS, "Sent resolv_gethostbyname\n");
if (req == NULL) {
ret = ENOMEM;
}
@@ -482,7 +486,7 @@ static void test_internet(struct tevent_req *req)
inet_ntop(rhostent->family,
rhostent->addr_list[i]->ipaddr,
addr_buf, sizeof(addr_buf));
- DEBUG(2, "Found address %s with TTL %d\n",
+ DEBUG(SSSDBG_OP_FAILURE, "Found address %s with TTL %d\n",
addr_buf, rhostent->addr_list[i]->ttl);
}
}
@@ -492,7 +496,7 @@ static void test_internet(struct tevent_req *req)
&txt_replies);
test_ctx->error = (txt_replies == NULL) ? ENOENT : EOK;
for (txtptr = txt_replies; txtptr != NULL; txtptr = txtptr->next) {
- DEBUG(2, "TXT Record: %s\n", txtptr->txt);
+ DEBUG(SSSDBG_OP_FAILURE, "TXT Record: %s\n", txtptr->txt);
}
break;
case TESTING_SRV:
@@ -500,7 +504,8 @@ static void test_internet(struct tevent_req *req)
&srv_replies);
test_ctx->error = (srv_replies == NULL) ? ENOENT : EOK;
for (srvptr = srv_replies; srvptr != NULL; srvptr = srvptr->next) {
- DEBUG(2, "SRV Record: %d %d %d %s\n", srvptr->weight,
+ DEBUG(SSSDBG_OP_FAILURE,
+ "SRV Record: %d %d %d %s\n", srvptr->weight,
srvptr->priority, srvptr->port,
srvptr->host);
}
@@ -511,7 +516,7 @@ static void test_internet(struct tevent_req *req)
}
talloc_zfree(req);
fail_if(recv_status != EOK, "The recv function failed: %d", recv_status);
- DEBUG(7, "recv status: %d\n", status);
+ DEBUG(SSSDBG_TRACE_LIBS, "recv status: %d\n", status);
if (rhostent != NULL) {
talloc_free(rhostent);
@@ -541,7 +546,7 @@ START_TEST(test_resolv_internet)
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_FIRST,
default_host_dbs);
- DEBUG(7, "Sent resolv_gethostbyname\n");
+ DEBUG(SSSDBG_TRACE_LIBS, "Sent resolv_gethostbyname\n");
if (req == NULL) {
ret = ENOMEM;
}
@@ -612,7 +617,7 @@ static void resolv_free_context(struct tevent_context *ev,
struct timeval t, void *ptr)
{
struct resolv_ctx *rctx = talloc_get_type(ptr, struct resolv_ctx);
- DEBUG(7, "freeing the context\n");
+ DEBUG(SSSDBG_TRACE_LIBS, "freeing the context\n");
talloc_free(rctx);
}
@@ -622,7 +627,7 @@ static void resolv_free_done(struct tevent_context *ev,
struct timeval t, void *ptr)
{
struct resolv_test_ctx *tctx = talloc_get_type(ptr, struct resolv_test_ctx);
- DEBUG(7, "marking test as done\n");
+ DEBUG(SSSDBG_TRACE_LIBS, "marking test as done\n");
tctx->error = EOK;
tctx->done = true;
@@ -646,7 +651,7 @@ START_TEST(test_resolv_free_context)
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_FIRST,
default_host_dbs);
- DEBUG(7, "Sent resolv_gethostbyname\n");
+ DEBUG(SSSDBG_TRACE_LIBS, "Sent resolv_gethostbyname\n");
if (req == NULL) {
fail("Error calling resolv_gethostbyname_send");
goto done;
@@ -683,7 +688,7 @@ static void resolv_free_req(struct tevent_context *ev,
struct timeval t, void *ptr)
{
struct tevent_req *req = talloc_get_type(ptr, struct tevent_req);
- DEBUG(7, "freeing the request\n");
+ DEBUG(SSSDBG_TRACE_LIBS, "freeing the request\n");
talloc_free(req);
}
@@ -794,7 +799,7 @@ START_TEST(test_resolv_free_req)
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_FIRST,
default_host_dbs);
- DEBUG(7, "Sent resolv_gethostbyname\n");
+ DEBUG(SSSDBG_TRACE_LIBS, "Sent resolv_gethostbyname\n");
if (req == NULL) {
fail("Error calling resolv_gethostbyname_send");
goto done;
@@ -871,7 +876,7 @@ START_TEST(test_resolv_timeout)
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_FIRST,
default_host_dbs);
- DEBUG(7, "Sent resolv_gethostbyname\n");
+ DEBUG(SSSDBG_TRACE_LIBS, "Sent resolv_gethostbyname\n");
if (req == NULL) {
ret = ENOMEM;
}
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index a8177bbd2..ffd11c523 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -99,7 +99,7 @@ static int _setup_sysdb_tests(struct sysdb_test_ctx **ctx, bool enumerate)
talloc_free(test_ctx);
return ENOMEM;
}
- DEBUG(3, "CONFDB: %s\n", conf_db);
+ DEBUG(SSSDBG_MINOR_FAILURE, "CONFDB: %s\n", conf_db);
/* Connect to the conf db */
ret = confdb_init(test_ctx, &test_ctx->confdb, conf_db);
@@ -1785,7 +1785,8 @@ static void cached_authentication_with_expiration(const char *username,
now = time(NULL);
expected_expire_date = now + (24 * 60 * 60);
- DEBUG(9, "Setting SYSDB_LAST_ONLINE_AUTH to [%lld].\n", (long long) now);
+ DEBUG(SSSDBG_TRACE_ALL,
+ "Setting SYSDB_LAST_ONLINE_AUTH to [%lld].\n", (long long) now);
data->attrs = sysdb_new_attrs(data);
ret = sysdb_attrs_add_time_t(data->attrs, SYSDB_LAST_ONLINE_AUTH, now);
diff --git a/src/tests/sysdb_ssh-tests.c b/src/tests/sysdb_ssh-tests.c
index 034922d6f..ae0cb71c7 100644
--- a/src/tests/sysdb_ssh-tests.c
+++ b/src/tests/sysdb_ssh-tests.c
@@ -84,7 +84,7 @@ static int setup_sysdb_tests(struct sysdb_test_ctx **ctx)
talloc_free(test_ctx);
return ENOMEM;
}
- DEBUG(3, "CONFDB: %s\n", conf_db);
+ DEBUG(SSSDBG_MINOR_FAILURE, "CONFDB: %s\n", conf_db);
/* Connect to the conf db */
ret = confdb_init(test_ctx, &test_ctx->confdb, conf_db);