debug-tests.c revision fe60346714a73ac3987f786731389320633dd245
/*
SSSD
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2011 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <check.h>
#include <stdio.h>
#include <talloc.h>
#include <errno.h>
#include <string.h>
#define DEBUG_TEST_NOK -1
#define DEBUG_TEST_NOK_TS -2
{
int expected_level = 0x0000;
int old_level;
int levels[] = {
};
"Invalid conversion of SSS_UNRESOLVED_DEBUG_LEVEL"
);
}
}
{
"Invalid conversion of SSSDBG_UNRESOLVED"
);
"Invalid conversion of SSSDBG_FATAL_FAILURE"
);
"Invalid conversion of SSSDBG_CRIT_FAILURE"
);
"Invalid conversion of SSSDBG_OP_FAILURE"
);
"Invalid conversion of SSSDBG_MINOR_FAILURE"
);
"Invalid conversion of SSSDBG_CONF_SETTINGS"
);
"Invalid conversion of SSSDBG_FUNC_DATA"
);
"Invalid conversion of SSSDBG_TRACE_FUNC"
);
"Invalid conversion of SSSDBG_TRACE_LIBS"
);
"Invalid conversion of SSSDBG_TRACE_INTERNAL"
);
"Invalid conversion of SSSDBG_TRACE_ALL"
);
"Invalid conversion of SSSDBG_MASK_ALL"
);
}
{
fail_unless(debug_get_level(SSS_UNRESOLVED_DEBUG_LEVEL) == SSSDBG_UNRESOLVED, "Invalid conversion of -1");
}
{
"Invalid conversion of SSSDBG_UNRESOLVED"
);
"Invalid conversion of SSSDBG_FATAL_FAILURE"
);
"Invalid conversion of SSSDBG_CRIT_FAILURE"
);
"Invalid conversion of SSSDBG_OP_FAILURE"
);
"Invalid conversion of SSSDBG_MINOR_FAILURE"
);
"Invalid conversion of SSSDBG_CONF_SETTINGS"
);
"Invalid conversion of SSSDBG_FUNC_DATA"
);
"Invalid conversion of SSSDBG_TRACE_FUNC"
);
"Invalid conversion of SSSDBG_TRACE_LIBS"
);
"Invalid conversion of SSSDBG_TRACE_INTERNAL"
);
"Invalid conversion of SSSDBG_TRACE_ALL"
);
}
{
char *compare_to = NULL;
const char *function = __FUNCTION__;
const char *body = "some error\n";
int filesize;
int fsize;
int fd;
int set_fd_result;
int ret;
if (fd == -1) {
return errno;
}
goto done;
}
if (set_fd_result != EOK) {
ret = set_fd_result;
goto done;
}
if (msgmode == 0) {
} else {
}
goto done;
}
goto done;
}
if (debug_timestamps == 1) {
int time_day_num = 0;
int time_hour = 0;
int time_min = 0;
int time_sec = 0;
int time_year = 0;
if (scan_return != 7) {
goto done;
}
"(%s %s %2d %.2d:%.2d:%.2d %.4d) "
"[%s] [%s] (%#.4x): %s",
if (compare_to == NULL) {
goto done;
}
} else {
if (compare_to == NULL) {
goto done;
}
}
done:
return ret;
}
{
int fd;
int filesize;
int set_fd_result;
int ret;
if (fd == -1)
return errno;
goto done;
}
if (set_fd_result != EOK) {
ret = set_fd_result;
goto done;
}
if (msgmode == 0) {
} else {
}
done:
return ret;
}
{
int i;
int result;
int levels[] = {
};
char *error_msg;
debug_timestamps = 0;
debug_to_file = 1;
debug_prg_name = "sssd";
for (i = 0; i <= 9; i++) {
debug_level = levels[i];
}
}
{
int i;
int result;
int levels[] = {
};
char *error_msg;
debug_timestamps = 1;
debug_to_file = 1;
debug_prg_name = "sssd";
for (i = 0; i <= 9; i++) {
debug_level = levels[i];
}
}
{
int i;
int result;
int all_set = SSSDBG_MASK_ALL;
int levels[] = {
};
char *error_msg;
debug_timestamps = 0;
debug_to_file = 1;
debug_prg_name = "sssd";
for (i = 0; i <= 9; i++) {
"Test of level %#.4x failed - message has been written",
levels[i]);
}
}
{
int i;
int result;
int all_set = SSSDBG_MASK_ALL;
int levels[] = {
};
char *error_msg;
debug_timestamps = 0;
debug_to_file = 1;
debug_prg_name = "sssd";
for (i = 0; i <= 9; i++) {
"Test of level %#.4x failed - message has been written",
levels[i]);
}
}
{
int i;
int result;
int levels[] = {
};
char *error_msg;
debug_timestamps = 0;
debug_to_file = 1;
debug_prg_name = "sssd";
for (i = 0; i <= 9; i++) {
debug_level = levels[i];
}
}
{
int i;
int result;
int levels[] = {
};
char *error_msg;
debug_timestamps = 1;
debug_to_file = 1;
debug_prg_name = "sssd";
for (i = 0; i <= 9; i++) {
debug_level = levels[i];
}
}
{
int i;
int result;
int all_set = SSSDBG_MASK_ALL;
int levels[] = {
};
char *error_msg;
debug_timestamps = 0;
debug_to_file = 1;
debug_prg_name = "sssd";
for (i = 0; i <= 9; i++) {
}
}
{
int i;
int result;
int all_set = SSSDBG_MASK_ALL;
int levels[] = {
};
char *error_msg;
debug_timestamps = 0;
debug_to_file = 1;
debug_prg_name = "sssd";
for (i = 0; i <= 9; i++) {
}
}
{
int i;
int result;
int levels[] = {
};
for (i = 0; i <= 9; i++) {
}
}
{
int i;
int result;
int all_set = SSSDBG_MASK_ALL;
int levels[] = {
};
for (i = 0; i <= 9; i++) {
}
}
Suite *debug_suite(void)
{
suite_add_tcase(s, tc_debug);
return s;
}
{
int number_failed;
Suite *s = debug_suite();
if (number_failed == 0)
return EXIT_SUCCESS;
return EXIT_FAILURE;
}