summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2011-08-03 09:15:52 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-08-25 15:46:11 -0400
commit89caf5edcc99f5731e89bd51e6ffaad3ec11c304 (patch)
treed7b5638ccf515fac99454d18d7685d2329450e02 /src/tests
parentfe60346714a73ac3987f786731389320633dd245 (diff)
downloadsssd-89caf5edcc99f5731e89bd51e6ffaad3ec11c304.tar.gz
sssd-89caf5edcc99f5731e89bd51e6ffaad3ec11c304.tar.xz
sssd-89caf5edcc99f5731e89bd51e6ffaad3ec11c304.zip
New DEBUG facility - SSSDBG_UNRESOLVED changed from -1 to 0
Removed: SSS_UNRESOLVED_DEBUG_LEVEL (completely replaced with SSSDBG_UNRESOLVED) Added new macro: CONVERT_AND_SET_DEBUG_LEVEL(new_value) Changes unresolved debug level value (SSSDBG_UNRESOLVED) from -1 to 0 so DEBUG macro could be reduced by one condition. Anyway, it has a minor effect, every time you want to load debug_level from command line parameters, you have to use following pattern: /* 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) { ... } CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/auth-tests.c5
-rw-r--r--src/tests/crypto-tests.c5
-rw-r--r--src/tests/debug-tests.c10
-rw-r--r--src/tests/fail_over-tests.c6
-rw-r--r--src/tests/files-tests.c6
-rw-r--r--src/tests/krb5_utils-tests.c5
-rw-r--r--src/tests/refcount-tests.c6
-rw-r--r--src/tests/resolv-tests.c6
-rw-r--r--src/tests/simple_access-tests.c5
-rw-r--r--src/tests/strtonum-tests.c5
-rw-r--r--src/tests/sysdb-tests.c5
-rw-r--r--src/tests/util-tests.c5
12 files changed, 50 insertions, 19 deletions
diff --git a/src/tests/auth-tests.c b/src/tests/auth-tests.c
index aae2d0086..96bae98e6 100644
--- a/src/tests/auth-tests.c
+++ b/src/tests/auth-tests.c
@@ -308,6 +308,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* 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) {
@@ -320,7 +323,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/crypto-tests.c b/src/tests/crypto-tests.c
index 0f6f2fe0c..ba584668d 100644
--- a/src/tests/crypto-tests.c
+++ b/src/tests/crypto-tests.c
@@ -122,6 +122,8 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* 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) {
@@ -135,7 +137,8 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+
tests_set_cwd();
Suite *s = crypto_suite();
diff --git a/src/tests/debug-tests.c b/src/tests/debug-tests.c
index 99f92a0ce..2708cec1d 100644
--- a/src/tests/debug-tests.c
+++ b/src/tests/debug-tests.c
@@ -49,11 +49,6 @@ START_TEST(test_debug_convert_old_level_old_format)
SSSDBG_TRACE_ALL
};
- fail_unless(
- debug_convert_old_level(SSS_UNRESOLVED_DEBUG_LEVEL) == SSSDBG_UNRESOLVED,
- "Invalid conversion of SSS_UNRESOLVED_DEBUG_LEVEL"
- );
-
for (old_level = 0; old_level <= 9; old_level++) {
expected_level |= levels[old_level];
@@ -68,7 +63,7 @@ END_TEST
START_TEST(test_debug_convert_old_level_new_format)
{
fail_unless(
- debug_convert_old_level(SSSDBG_UNRESOLVED) == SSSDBG_UNRESOLVED,
+ debug_convert_old_level(SSSDBG_UNRESOLVED) == SSSDBG_FATAL_FAILURE,
"Invalid conversion of SSSDBG_UNRESOLVED"
);
fail_unless(
@@ -120,7 +115,6 @@ END_TEST
START_TEST(test_debug_get_level_old_format)
{
- fail_unless(debug_get_level(SSS_UNRESOLVED_DEBUG_LEVEL) == SSSDBG_UNRESOLVED, "Invalid conversion of -1");
fail_unless(debug_get_level(0) == SSSDBG_FATAL_FAILURE, "Invalid conversion of 0");
fail_unless(debug_get_level(1) == SSSDBG_CRIT_FAILURE, "Invalid conversion of 1");
fail_unless(debug_get_level(2) == SSSDBG_OP_FAILURE, "Invalid conversion of 2");
@@ -137,7 +131,7 @@ END_TEST
START_TEST(test_debug_get_level_new_format)
{
fail_unless(
- debug_get_level(SSSDBG_UNRESOLVED) == SSSDBG_UNRESOLVED,
+ debug_get_level(SSSDBG_UNRESOLVED) == SSSDBG_FATAL_FAILURE,
"Invalid conversion of SSSDBG_UNRESOLVED"
);
fail_unless(
diff --git a/src/tests/fail_over-tests.c b/src/tests/fail_over-tests.c
index 439e5cf23..64ed19782 100644
--- a/src/tests/fail_over-tests.c
+++ b/src/tests/fail_over-tests.c
@@ -292,6 +292,9 @@ main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* 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) {
@@ -307,7 +310,8 @@ main(int argc, const char *argv[])
}
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug);
+
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/files-tests.c b/src/tests/files-tests.c
index 15d34c8e8..cb20e1aae 100644
--- a/src/tests/files-tests.c
+++ b/src/tests/files-tests.c
@@ -310,6 +310,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, (const char **) argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
fprintf(stderr, "\nInvalid option %s: %s\n\n",
@@ -318,7 +321,8 @@ int main(int argc, const char *argv[])
return 1;
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug);
+
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/krb5_utils-tests.c b/src/tests/krb5_utils-tests.c
index 65e43193b..4392abd7f 100644
--- a/src/tests/krb5_utils-tests.c
+++ b/src/tests/krb5_utils-tests.c
@@ -642,6 +642,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* 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) {
@@ -654,7 +657,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
ret = mkdir(TESTS_PATH, 0775);
if (ret != EOK) {
diff --git a/src/tests/refcount-tests.c b/src/tests/refcount-tests.c
index 99eedd9d6..18f555320 100644
--- a/src/tests/refcount-tests.c
+++ b/src/tests/refcount-tests.c
@@ -207,6 +207,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* 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) {
@@ -218,7 +221,8 @@ int main(int argc, const char *argv[])
}
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug);
+
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/resolv-tests.c b/src/tests/resolv-tests.c
index 3768fc978..b9a33ca75 100644
--- a/src/tests/resolv-tests.c
+++ b/src/tests/resolv-tests.c
@@ -770,6 +770,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* 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) {
@@ -790,7 +793,8 @@ int main(int argc, const char *argv[])
}
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug);
+
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
if (!use_net_test) {
printf("Network tests disabled. Rerun with the \"-n\" "
diff --git a/src/tests/simple_access-tests.c b/src/tests/simple_access-tests.c
index 6ae2356b7..9cd73d84c 100644
--- a/src/tests/simple_access-tests.c
+++ b/src/tests/simple_access-tests.c
@@ -150,6 +150,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* 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) {
@@ -162,7 +165,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
Suite *s = access_simple_suite();
SRunner *sr = srunner_create(s);
diff --git a/src/tests/strtonum-tests.c b/src/tests/strtonum-tests.c
index 8e86c11f2..441b262cb 100644
--- a/src/tests/strtonum-tests.c
+++ b/src/tests/strtonum-tests.c
@@ -434,6 +434,9 @@ int main(int argc, const char *argv[]) {
POPT_TABLEEND
};
+ /* 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) {
@@ -446,7 +449,7 @@ int main(int argc, const char *argv[]) {
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 87b06ee40..c27658288 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -3108,6 +3108,9 @@ int main(int argc, const char *argv[]) {
POPT_TABLEEND
};
+ /* 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) {
@@ -3120,7 +3123,7 @@ int main(int argc, const char *argv[]) {
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c
index b347aa7e1..52d302778 100644
--- a/src/tests/util-tests.c
+++ b/src/tests/util-tests.c
@@ -343,6 +343,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* 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) {
@@ -355,7 +358,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();