ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh/*
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh SSSD
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh find_uid - Utilities tests
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh Authors:
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh Abhishek Singh <abhishekkumarsingh.cse@gmail.com>
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh Copyright (C) 2013 Red Hat
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh This program is free software; you can redistribute it and/or modify
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh it under the terms of the GNU General Public License as published by
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh the Free Software Foundation; either version 3 of the License, or
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh (at your option) any later version.
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh This program is distributed in the hope that it will be useful,
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh but WITHOUT ANY WARRANTY; without even the implied warranty of
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh GNU General Public License for more details.
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh You should have received a copy of the GNU General Public License
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh along with this program. If not, see <http://www.gnu.org/licenses/>.
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh*/
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include <stdio.h>
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include <fcntl.h>
25255e4d0e1517a5d443e8fee22e91862e255702Abhishek Singh#include <errno.h>
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include <stdlib.h>
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include <stdarg.h>
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include <string.h>
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include <stddef.h>
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include <setjmp.h>
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include <cmocka.h>
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include <dirent.h>
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include <unistd.h>
25255e4d0e1517a5d443e8fee22e91862e255702Abhishek Singh#include <libgen.h>
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include "limits.h"
3996e391054a1c02ab62e1541ae21a8204bd5d0aAmitKumar#include "shared/io.h"
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh#include "util/util.h"
25255e4d0e1517a5d443e8fee22e91862e255702Abhishek Singh#include "tests/common.h"
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
50c9d542e8bf641412debaa82a4dcf67ddb72258Lukas Slebodnik#define TESTS_PATH "tp_" BASE_FILE_STEM
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik#define FILE_TEMPLATE TESTS_PATH"/test_io.XXXXXX"
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik#define NON_EX_PATH TESTS_PATH"/non-existent-path"
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh/* Creates a unique temporary file inside TEST_DIR and returns its path*/
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnikstatic char *get_random_filepath(const char *template)
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh{
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int ret;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik char *path;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik path = strdup(template);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_non_null(path);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = mkstemp(path);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh if (ret == -1) {
25255e4d0e1517a5d443e8fee22e91862e255702Abhishek Singh int err = errno;
25255e4d0e1517a5d443e8fee22e91862e255702Abhishek Singh fprintf(stderr, "mkstemp failed with path:'%s' [%s]\n",
25255e4d0e1517a5d443e8fee22e91862e255702Abhishek Singh path, strerror(err));
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh }
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_not_equal(ret, -1);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik /* We do not need this file descriptor */
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik close(ret);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh return path;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh}
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozekstatic int test_file_setup(void **state)
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik{
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik int ret;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik char *file_path;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = mkdir(TESTS_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_equal(ret, EOK);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik file_path = get_random_filepath(FILE_TEMPLATE);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_non_null(file_path);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = unlink(NON_EX_PATH);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = errno;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_equal(ret, ENOENT);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik *state = file_path;
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek return 0;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik}
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozekstatic int test_file_teardown(void **state)
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh{
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik int ret;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik char *file_path = (char *)*state;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = unlink(file_path);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_equal(ret, EOK);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik free(file_path);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = rmdir(TESTS_PATH);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_equal(ret, EOK);
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek return 0;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik}
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnikstruct dir_state {
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik int dir_fd;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik char *basename;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik /* resources for cleanup*/
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik DIR *dirp;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik char *filename;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik};
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozekstatic int test_dir_setup(void **state)
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik{
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik struct dir_state *data;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik int ret;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik data = (struct dir_state *)calloc(1, sizeof(struct dir_state));
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_non_null(data);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = mkdir(TESTS_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_equal(ret, EOK);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik data->dirp = opendir(TESTS_PATH);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik if (data->dirp == NULL) {
25255e4d0e1517a5d443e8fee22e91862e255702Abhishek Singh int err = errno;
25255e4d0e1517a5d443e8fee22e91862e255702Abhishek Singh fprintf(stderr, "Could not open directory:'%s' [%s]\n",
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik TESTS_PATH, strerror(err));
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh }
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_non_null(data->dirp);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik data->dir_fd = dirfd(data->dirp);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_not_equal(data->dir_fd, -1);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik data->filename = get_random_filepath(FILE_TEMPLATE);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_non_null(data->filename);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik data->basename = basename(data->filename);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = unlink(NON_EX_PATH);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = errno;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_equal(ret, ENOENT);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik *state = data;
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek return 0;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh}
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozekstatic int test_dir_teardown(void **state)
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh{
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik int ret;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik struct dir_state *data = (struct dir_state *) *state;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = unlink(data->filename);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_equal(ret, EOK);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik free(data->filename);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = closedir(data->dirp);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_equal(ret, EOK);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik ret = rmdir(TESTS_PATH);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_equal(ret, EOK);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik free(data);
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek return 0;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh}
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singhvoid test_sss_open_cloexec_success(void **state)
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh{
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int fd;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int ret;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int ret_flag;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int expec_flag;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int flags = O_RDWR;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik char *file_path = (char *) *state;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik fd = sss_open_cloexec(file_path, flags, &ret);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_not_equal(fd, -1);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh ret_flag = fcntl(fd, F_GETFD, 0);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh expec_flag = FD_CLOEXEC;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh assert_true(ret_flag & expec_flag);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh close(fd);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh}
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singhvoid test_sss_open_cloexec_fail(void **state)
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh{
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int fd;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int ret;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int flags = O_RDWR;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh fd = sss_open_cloexec(NON_EX_PATH, flags, &ret);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh assert_true(fd == -1);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh assert_int_not_equal(ret, 0);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh}
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singhvoid test_sss_openat_cloexec_success(void **state)
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh{
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int fd;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int ret;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int ret_flag;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int expec_flag;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik const int flags = O_RDWR;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik struct dir_state *data = (struct dir_state *) *state;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik fd = sss_openat_cloexec(data->dir_fd, data->basename, flags, &ret);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_not_equal(fd, -1);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh ret_flag = fcntl(fd, F_GETFD, 0);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh expec_flag = FD_CLOEXEC;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh assert_true(ret_flag & expec_flag);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh close(fd);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh}
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singhvoid test_sss_openat_cloexec_fail(void **state)
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh{
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int fd;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int ret;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh int flags = O_RDWR;
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik struct dir_state *data = (struct dir_state *) *state;
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik fd = sss_openat_cloexec(data->dir_fd, NON_EX_PATH, flags, &ret);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_equal(fd, -1);
f333ca01311000475db0fbd059243d05f9a90e96Lukas Slebodnik assert_int_equal(ret, ENOENT);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh}
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singhint main(void)
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh{
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek const struct CMUnitTest tests[] = {
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek cmocka_unit_test_setup_teardown(test_sss_open_cloexec_success,
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek test_file_setup, test_file_teardown),
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek cmocka_unit_test_setup_teardown(test_sss_open_cloexec_fail,
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek test_file_setup, test_file_teardown),
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek cmocka_unit_test_setup_teardown(test_sss_openat_cloexec_success,
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek test_dir_setup, test_dir_teardown),
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek cmocka_unit_test_setup_teardown(test_sss_openat_cloexec_fail,
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek test_dir_setup, test_dir_teardown)
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh };
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh
25255e4d0e1517a5d443e8fee22e91862e255702Abhishek Singh tests_set_cwd();
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek return cmocka_run_group_tests(tests, NULL, NULL);
ae6c1596225c65bec2a2dabff9eee4e3e0691181Abhishek Singh}