b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech Petr Čech <pcech@redhat.com>
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech Copyright (C) 2015 Red Hat
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech This program is free software; you can redistribute it and/or modify
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech it under the terms of the GNU General Public License as published by
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech the Free Software Foundation; either version 3 of the License, or
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech (at your option) any later version.
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech This program is distributed in the hope that it will be useful,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech but WITHOUT ANY WARRANTY; without even the implied warranty of
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech GNU General Public License for more details.
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech You should have received a copy of the GNU General Public License
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech along with this program. If not, see <http://www.gnu.org/licenses/>.
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cechstatic void create_empty_file(TALLOC_CTX *test_ctx, const char *path,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech const char *name)
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech file_name = talloc_asprintf(tmp_ctx, "%s/%s", path, name);
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cechstatic void create_nonempty_file(TALLOC_CTX *test_ctx,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech create_empty_file(test_ctx, TESTS_PATH, TESTS_FILE);
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech create_empty_file(test_ctx, TESTS_PATH, TESTS_FILE);
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech create_nonempty_file(test_ctx, TESTS_PATH, TESTS_FILE);
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech if (ret != 0) {
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech db = sss_colondb_open(test_ctx, SSS_COLONDB_WRITE,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech db = sss_colondb_open(test_ctx, SSS_COLONDB_WRITE,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech db = sss_colondb_open(test_ctx, SSS_COLONDB_WRITE,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech db = sss_colondb_open(test_ctx, SSS_COLONDB_WRITE,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech db = sss_colondb_open(test_ctx, SSS_COLONDB_WRITE,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech db = sss_colondb_open(test_ctx, SSS_COLONDB_WRITE,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech ret = sss_colondb_readline(test_ctx, db, table_out);
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech cmocka_unit_test_setup_teardown(test_open_nonexist_for_read,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech cmocka_unit_test_setup_teardown(test_open_nonexist_for_write,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech cmocka_unit_test_setup_teardown(test_open_exist_for_read,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech cmocka_unit_test_setup_teardown(test_open_exist_for_write,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech cmocka_unit_test_setup_teardown(test_open_nonempty_for_read,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech cmocka_unit_test_setup_teardown(test_open_nonempty_for_write,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech cmocka_unit_test_setup_teardown(test_write_to_empty,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech cmocka_unit_test_setup_teardown(test_write_to_nonempty,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech cmocka_unit_test_setup_teardown(test_read_from_empty,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech cmocka_unit_test_setup_teardown(test_read_from_nonempty,
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech /* Set debug level to invalid value so we can decide if -d 0 was used. */
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech pc = poptGetContext(argv[0], argc, argv, long_options, 0);
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech fprintf(stderr, "\nInvalid option %s: %s\n\n", poptBadOption(pc, 0),
b590f44c06158485357d69cc5b24d5af05f1bb95Petr Cech /* Even though normally the tests should clean up after themselves
57c5ea8825c7179fd93382dbcbb07e828e5aec19René Genz * they might not after a failed run. Remove the old DB to be sure */