Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libc/tests/gen/getentropy_test.c
Show All 25 Lines | |||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <signal.h> | |||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <atf-c.h> | #include <atf-c.h> | ||||
ATF_TC_WITHOUT_HEAD(getentropy_count); | ATF_TC_WITHOUT_HEAD(getentropy_count); | ||||
ATF_TC_BODY(getentropy_count, tc) | ATF_TC_BODY(getentropy_count, tc) | ||||
{ | { | ||||
char buf[2]; | char buf[2]; | ||||
Show All 29 Lines | ATF_TC_BODY(getentropy_sizes, tc) | ||||
/* Smaller sizes always succeed: */ | /* Smaller sizes always succeed: */ | ||||
ATF_REQUIRE_EQ(getentropy(buf, 256), 0); | ATF_REQUIRE_EQ(getentropy(buf, 256), 0); | ||||
ATF_REQUIRE_EQ(getentropy(buf, 128), 0); | ATF_REQUIRE_EQ(getentropy(buf, 128), 0); | ||||
ATF_REQUIRE_EQ(getentropy(buf, 0), 0); | ATF_REQUIRE_EQ(getentropy(buf, 0), 0); | ||||
} | } | ||||
ATF_TP_ADD_TCS(tp) | ATF_TP_ADD_TCS(tp) | ||||
{ | { | ||||
signal(SIGSYS, SIG_IGN); | |||||
ATF_TP_ADD_TC(tp, getentropy_count); | ATF_TP_ADD_TC(tp, getentropy_count); | ||||
ATF_TP_ADD_TC(tp, getentropy_fault); | ATF_TP_ADD_TC(tp, getentropy_fault); | ||||
ATF_TP_ADD_TC(tp, getentropy_sizes); | ATF_TP_ADD_TC(tp, getentropy_sizes); | ||||
return (atf_no_error()); | return (atf_no_error()); | ||||
} | } |