1316099Sngie/*- 2346920Sngie * Copyright (c) 2017 Enji Cooper <ngie@freebsd.org> 3316099Sngie * 4316099Sngie * Redistribution and use in source and binary forms, with or without 5316099Sngie * modification, are permitted provided that the following conditions 6316099Sngie * are met: 7316099Sngie * 1. Redistributions of source code must retain the above copyright 8316099Sngie * notice, this list of conditions and the following disclaimer. 9316099Sngie * 2. Redistributions in binary form must reproduce the above copyright 10316099Sngie * notice, this list of conditions and the following disclaimer in the 11316099Sngie * documentation and/or other materials provided with the distribution. 12316099Sngie * 13316099Sngie * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14316099Sngie * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15316099Sngie * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16316099Sngie * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17316099Sngie * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18316099Sngie * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19316099Sngie * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20316099Sngie * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21316099Sngie * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22316099Sngie * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23316099Sngie * SUCH DAMAGE. 24316099Sngie */ 25316099Sngie 26316099Sngie#include <sys/cdefs.h> 27316099Sngie__FBSDID("$FreeBSD: stable/11/lib/libkvm/tests/kvm_close_test.c 346920 2019-04-29 19:36:46Z ngie $"); 28316099Sngie 29316099Sngie#include <errno.h> 30316099Sngie#include <fcntl.h> 31316099Sngie#include <kvm.h> 32316099Sngie#include <signal.h> 33316099Sngie 34316099Sngie#include <atf-c.h> 35316099Sngie 36316099SngieATF_TC(kvm_close_negative_test_NULL); 37316099SngieATF_TC_HEAD(kvm_close_negative_test_NULL, tc) 38316099Sngie{ 39316099Sngie 40316099Sngie atf_tc_set_md_var(tc, "descr", 41316099Sngie "test that kvm_close(NULL) succeeds without error"); 42316099Sngie} 43316099Sngie 44316099SngieATF_TC_BODY(kvm_close_negative_test_NULL, tc) 45316099Sngie{ 46316099Sngie 47316099Sngie ATF_REQUIRE_ERRNO(EINVAL, kvm_close(NULL) == -1); 48316099Sngie} 49316099Sngie 50316099SngieATF_TP_ADD_TCS(tp) 51316099Sngie{ 52316099Sngie 53316099Sngie ATF_TP_ADD_TC(tp, kvm_close_negative_test_NULL); 54316099Sngie 55316099Sngie return (atf_no_error()); 56316099Sngie} 57