Blame src/lib/krad/t_test.c

Packit fd8b60
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
Packit fd8b60
/* lib/krad/t_test.c - Utility functions for libkrad tests */
Packit fd8b60
/*
Packit fd8b60
 * Copyright 2013 Red Hat, Inc.  All rights reserved.
Packit fd8b60
 *
Packit fd8b60
 * Redistribution and use in source and binary forms, with or without
Packit fd8b60
 * modification, are permitted provided that the following conditions are met:
Packit fd8b60
 *
Packit fd8b60
 *    1. Redistributions of source code must retain the above copyright
Packit fd8b60
 *       notice, this list of conditions and the following disclaimer.
Packit fd8b60
 *
Packit fd8b60
 *    2. Redistributions in binary form must reproduce the above copyright
Packit fd8b60
 *       notice, this list of conditions and the following disclaimer in
Packit fd8b60
 *       the documentation and/or other materials provided with the
Packit fd8b60
 *       distribution.
Packit fd8b60
 *
Packit fd8b60
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
Packit fd8b60
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
Packit fd8b60
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
Packit fd8b60
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
Packit fd8b60
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
Packit fd8b60
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
Packit fd8b60
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Packit fd8b60
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
Packit fd8b60
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
Packit fd8b60
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Packit fd8b60
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit fd8b60
 */
Packit fd8b60
Packit fd8b60
#include "t_test.h"
Packit fd8b60
Packit fd8b60
void
Packit fd8b60
noerror_impl(const char *file, int line, const char *cmd, int retval)
Packit fd8b60
{
Packit fd8b60
    if (retval == 0)
Packit fd8b60
        return;
Packit fd8b60
Packit fd8b60
    fprintf(stderr, "%s:%d: %s:\n\t%s\n", file, line, strerror(retval), cmd);
Packit fd8b60
    exit(1);
Packit fd8b60
}
Packit fd8b60
Packit fd8b60
void
Packit fd8b60
insist_impl(const char *file, int line, const char *cmd, krb5_boolean result)
Packit fd8b60
{
Packit fd8b60
    if (result)
Packit fd8b60
        return;
Packit fd8b60
Packit fd8b60
    fprintf(stderr, "%s:%d: insist failed:\n\t%s\n", file, line, cmd);
Packit fd8b60
    exit(1);
Packit fd8b60
}