/*
Authors:
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) 2014 Red Hat
SSSD tests: Child handlers
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 <talloc.h>
#include <tevent.h>
#include <errno.h>
#include <popt.h>
#include "util/child_common.h"
#include "tests/cmocka/common_mock.h"
static int destructor_called;
struct child_test_ctx {
};
{
*state = child_tctx;
return 0;
}
{
struct child_test_ctx);
return 0;
}
/* Just make sure the exec works. The child does nothing but exits */
{
int status;
struct child_test_ctx);
if (child_pid == 0) {
} else {
do {
errno = 0;
if (ret > 0) {
assert_int_equal(ret, 0);
}
} else {
"Failed to wait for children %d\n", child_pid);
}
}
}
{
if (ret != 0) {
return ret;
}
*state = child_tctx;
return 0;
}
{
struct child_test_ctx);
if (ret != 0) {
return ret;
}
return 0;
}
bool extra_args_only)
{
int status;
"--drums=ringo",
NULL };
if (child_pid == 0) {
debug_timestamps = 1;
} else {
do {
errno = 0;
if (ret > 0) {
assert_int_equal(ret, 0);
}
} else {
"Failed to wait for children %d\n", child_pid);
}
}
}
/* Make sure extra arguments are passed correctly */
{
struct child_test_ctx);
extra_args_test(child_tctx, false);
}
/* Make sure extra arguments are passed correctly */
{
struct child_test_ctx);
extra_args_test(child_tctx, true);
}
{
struct child_test_ctx);
extra_args_test(child_tctx, false);
}
struct child_test_ctx *child_tctx,
struct child_io_fds *io_fds,
const char *input);
int __real_child_io_destructor(void *ptr);
{
destructor_called = 1;
return __real_child_io_destructor(ptr);
}
/* Test that writing to the pipes works as expected */
{
struct child_test_ctx);
destructor_called = 0;
errno = 0;
errno = 0;
assert_int_equal(errno, 0);
errno = 0;
assert_int_equal(errno, 0);
errno = 0;
}
void test_child_cb(int child_status,
struct tevent_signal *sige,
void *pvt);
/* Test that writing to the pipes works as expected */
{
struct child_test_ctx);
assert_int_equal(ret, 0);
if (child_pid == 0) {
}
}
struct tevent_signal *sige,
void *pvt)
{
}
}
/* Test that writing to the pipes works as expected */
{
struct child_test_ctx);
if (child_pid == 0) {
STDIN_FILENO, 3);
}
}
struct test_exec_echo_state {
};
struct child_test_ctx *child_tctx,
struct child_io_fds *io_fds,
const char *input)
{
return req;
}
{
}
{
}
/* Just make sure the exec works. The child does nothing but exits */
{
struct child_test_ctx);
assert_int_equal(ret, 0);
if (child_pid == 0) {
}
child_tctx, &sss_child);
}
{
}
}
{
int rv;
int opt;
};
};
/* Set debug level to invalid value so we can decide if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
return rv;
}