mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Pull in ^/vendor/NetBSD/tests/dist@r312219
Remove divergence with upstream where possible
This commit is contained in:
commit
f40f3adc42
14 changed files with 364 additions and 125 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_mqueue.c,v 1.5 2017/01/10 22:10:22 christos Exp $ */
|
||||
/* $NetBSD: t_mqueue.c,v 1.6 2017/01/14 20:57:24 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Test for POSIX message queue priority handling.
|
||||
|
|
@ -6,23 +6,20 @@
|
|||
* This file is in the Public Domain.
|
||||
*/
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "freebsd_test_suite/macros.h"
|
||||
#endif
|
||||
|
||||
#include <atf-c.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <mqueue.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <mqueue.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include "freebsd_test_suite/macros.h"
|
||||
#endif
|
||||
|
||||
#define MQ_PRIO_BASE 24
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_ptrace_wait.c,v 1.58 2017/01/14 04:37:55 kamil Exp $ */
|
||||
/* $NetBSD: t_ptrace_wait.c,v 1.60 2017/01/14 19:17:10 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2016 The NetBSD Foundation, Inc.
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_ptrace_wait.c,v 1.58 2017/01/14 04:37:55 kamil Exp $");
|
||||
__RCSID("$NetBSD: t_ptrace_wait.c,v 1.60 2017/01/14 19:17:10 kamil Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
|
@ -39,6 +39,7 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.58 2017/01/14 04:37:55 kamil Exp $");
|
|||
#include <machine/reg.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <lwp.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -1184,6 +1185,116 @@ ATF_TC_BODY(eventmask4, tc)
|
|||
TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
|
||||
}
|
||||
|
||||
ATF_TC(eventmask5);
|
||||
ATF_TC_HEAD(eventmask5, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Verify that PTRACE_LWP_CREATE in EVENT_MASK is preserved");
|
||||
}
|
||||
|
||||
ATF_TC_BODY(eventmask5, tc)
|
||||
{
|
||||
const int exitval = 5;
|
||||
const int sigval = SIGSTOP;
|
||||
pid_t child, wpid;
|
||||
#if defined(TWAIT_HAVE_STATUS)
|
||||
int status;
|
||||
#endif
|
||||
ptrace_event_t set_event, get_event;
|
||||
const int len = sizeof(ptrace_event_t);
|
||||
|
||||
printf("Before forking process PID=%d\n", getpid());
|
||||
ATF_REQUIRE((child = fork()) != -1);
|
||||
if (child == 0) {
|
||||
printf("Before calling PT_TRACE_ME from child %d\n", getpid());
|
||||
FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
|
||||
|
||||
printf("Before raising %s from child\n", strsignal(sigval));
|
||||
FORKEE_ASSERT(raise(sigval) == 0);
|
||||
|
||||
printf("Before exiting of the child process\n");
|
||||
_exit(exitval);
|
||||
}
|
||||
printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
|
||||
|
||||
printf("Before calling %s() for the child\n", TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
|
||||
|
||||
validate_status_stopped(status, sigval);
|
||||
|
||||
set_event.pe_set_event = PTRACE_LWP_CREATE;
|
||||
ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1);
|
||||
ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1);
|
||||
ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0);
|
||||
|
||||
printf("Before resuming the child process where it left off and "
|
||||
"without signal to be sent\n");
|
||||
ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
|
||||
|
||||
printf("Before calling %s() for the child\n", TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
|
||||
|
||||
validate_status_exited(status, exitval);
|
||||
|
||||
printf("Before calling %s() for the child\n", TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
|
||||
}
|
||||
|
||||
ATF_TC(eventmask6);
|
||||
ATF_TC_HEAD(eventmask6, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Verify that PTRACE_LWP_EXIT in EVENT_MASK is preserved");
|
||||
}
|
||||
|
||||
ATF_TC_BODY(eventmask6, tc)
|
||||
{
|
||||
const int exitval = 5;
|
||||
const int sigval = SIGSTOP;
|
||||
pid_t child, wpid;
|
||||
#if defined(TWAIT_HAVE_STATUS)
|
||||
int status;
|
||||
#endif
|
||||
ptrace_event_t set_event, get_event;
|
||||
const int len = sizeof(ptrace_event_t);
|
||||
|
||||
printf("Before forking process PID=%d\n", getpid());
|
||||
ATF_REQUIRE((child = fork()) != -1);
|
||||
if (child == 0) {
|
||||
printf("Before calling PT_TRACE_ME from child %d\n", getpid());
|
||||
FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
|
||||
|
||||
printf("Before raising %s from child\n", strsignal(sigval));
|
||||
FORKEE_ASSERT(raise(sigval) == 0);
|
||||
|
||||
printf("Before exiting of the child process\n");
|
||||
_exit(exitval);
|
||||
}
|
||||
printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
|
||||
|
||||
printf("Before calling %s() for the child\n", TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
|
||||
|
||||
validate_status_stopped(status, sigval);
|
||||
|
||||
set_event.pe_set_event = PTRACE_LWP_EXIT;
|
||||
ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1);
|
||||
ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1);
|
||||
ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0);
|
||||
|
||||
printf("Before resuming the child process where it left off and "
|
||||
"without signal to be sent\n");
|
||||
ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
|
||||
|
||||
printf("Before calling %s() for the child\n", TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
|
||||
|
||||
validate_status_exited(status, exitval);
|
||||
|
||||
printf("Before calling %s() for the child\n", TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
|
||||
}
|
||||
|
||||
#if defined(TWAIT_HAVE_PID)
|
||||
ATF_TC(fork1);
|
||||
ATF_TC_HEAD(fork1, tc)
|
||||
|
|
@ -5286,6 +5397,207 @@ ATF_TC_BODY(siginfo6, tc)
|
|||
}
|
||||
#endif
|
||||
|
||||
volatile lwpid_t the_lwp_id = 0;
|
||||
|
||||
static void
|
||||
lwp_main_func(void *arg)
|
||||
{
|
||||
the_lwp_id = _lwp_self();
|
||||
_lwp_exit();
|
||||
}
|
||||
|
||||
ATF_TC(lwp_create1);
|
||||
ATF_TC_HEAD(lwp_create1, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Verify that 1 LWP creation is intercepted by ptrace(2) with "
|
||||
"EVENT_MASK set to PTRACE_LWP_CREATE");
|
||||
}
|
||||
|
||||
ATF_TC_BODY(lwp_create1, tc)
|
||||
{
|
||||
const int exitval = 5;
|
||||
const int sigval = SIGSTOP;
|
||||
pid_t child, wpid;
|
||||
#if defined(TWAIT_HAVE_STATUS)
|
||||
int status;
|
||||
#endif
|
||||
ptrace_state_t state;
|
||||
const int slen = sizeof(state);
|
||||
ptrace_event_t event;
|
||||
const int elen = sizeof(event);
|
||||
ucontext_t uc;
|
||||
lwpid_t lid;
|
||||
static const size_t ssize = 16*1024;
|
||||
void *stack;
|
||||
|
||||
printf("Before forking process PID=%d\n", getpid());
|
||||
ATF_REQUIRE((child = fork()) != -1);
|
||||
if (child == 0) {
|
||||
printf("Before calling PT_TRACE_ME from child %d\n", getpid());
|
||||
FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
|
||||
|
||||
printf("Before raising %s from child\n", strsignal(sigval));
|
||||
FORKEE_ASSERT(raise(sigval) == 0);
|
||||
|
||||
printf("Before allocating memory for stack in child\n");
|
||||
FORKEE_ASSERT((stack = malloc(ssize)) != NULL);
|
||||
|
||||
printf("Before making context for new lwp in child\n");
|
||||
_lwp_makecontext(&uc, lwp_main_func, NULL, NULL, stack, ssize);
|
||||
|
||||
printf("Before creating new in child\n");
|
||||
FORKEE_ASSERT(_lwp_create(&uc, 0, &lid) == 0);
|
||||
|
||||
printf("Before waiting for lwp %d to exit\n", lid);
|
||||
FORKEE_ASSERT(_lwp_wait(lid, NULL) == 0);
|
||||
|
||||
printf("Before verifying that reported %d and running lid %d "
|
||||
"are the same\n", lid, the_lwp_id);
|
||||
FORKEE_ASSERT_EQ(lid, the_lwp_id);
|
||||
|
||||
printf("Before exiting of the child process\n");
|
||||
_exit(exitval);
|
||||
}
|
||||
printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
|
||||
|
||||
printf("Before calling %s() for the child\n", TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
|
||||
|
||||
validate_status_stopped(status, sigval);
|
||||
|
||||
printf("Set empty EVENT_MASK for the child %d\n", child);
|
||||
event.pe_set_event = PTRACE_LWP_CREATE;
|
||||
ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
|
||||
|
||||
printf("Before resuming the child process where it left off and "
|
||||
"without signal to be sent\n");
|
||||
ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
|
||||
|
||||
printf("Before calling %s() for the child - expected stopped "
|
||||
"SIGTRAP\n", TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
|
||||
|
||||
validate_status_stopped(status, SIGTRAP);
|
||||
|
||||
ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
|
||||
|
||||
ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_LWP_CREATE);
|
||||
|
||||
lid = state.pe_lwp;
|
||||
printf("Reported PTRACE_LWP_CREATE event with lid %d\n", lid);
|
||||
|
||||
printf("Before resuming the child process where it left off and "
|
||||
"without signal to be sent\n");
|
||||
ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
|
||||
|
||||
printf("Before calling %s() for the child - expected exited\n",
|
||||
TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
|
||||
|
||||
validate_status_exited(status, exitval);
|
||||
|
||||
printf("Before calling %s() for the child - expected no process\n",
|
||||
TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
|
||||
}
|
||||
|
||||
ATF_TC(lwp_exit1);
|
||||
ATF_TC_HEAD(lwp_exit1, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Verify that 1 LWP creation is intercepted by ptrace(2) with "
|
||||
"EVENT_MASK set to PTRACE_LWP_EXIT");
|
||||
}
|
||||
|
||||
ATF_TC_BODY(lwp_exit1, tc)
|
||||
{
|
||||
const int exitval = 5;
|
||||
const int sigval = SIGSTOP;
|
||||
pid_t child, wpid;
|
||||
#if defined(TWAIT_HAVE_STATUS)
|
||||
int status;
|
||||
#endif
|
||||
ptrace_state_t state;
|
||||
const int slen = sizeof(state);
|
||||
ptrace_event_t event;
|
||||
const int elen = sizeof(event);
|
||||
ucontext_t uc;
|
||||
lwpid_t lid;
|
||||
static const size_t ssize = 16*1024;
|
||||
void *stack;
|
||||
|
||||
printf("Before forking process PID=%d\n", getpid());
|
||||
ATF_REQUIRE((child = fork()) != -1);
|
||||
if (child == 0) {
|
||||
printf("Before calling PT_TRACE_ME from child %d\n", getpid());
|
||||
FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
|
||||
|
||||
printf("Before raising %s from child\n", strsignal(sigval));
|
||||
FORKEE_ASSERT(raise(sigval) == 0);
|
||||
|
||||
printf("Before allocating memory for stack in child\n");
|
||||
FORKEE_ASSERT((stack = malloc(ssize)) != NULL);
|
||||
|
||||
printf("Before making context for new lwp in child\n");
|
||||
_lwp_makecontext(&uc, lwp_main_func, NULL, NULL, stack, ssize);
|
||||
|
||||
printf("Before creating new in child\n");
|
||||
FORKEE_ASSERT(_lwp_create(&uc, 0, &lid) == 0);
|
||||
|
||||
printf("Before waiting for lwp %d to exit\n", lid);
|
||||
FORKEE_ASSERT(_lwp_wait(lid, NULL) == 0);
|
||||
|
||||
printf("Before verifying that reported %d and running lid %d "
|
||||
"are the same\n", lid, the_lwp_id);
|
||||
FORKEE_ASSERT_EQ(lid, the_lwp_id);
|
||||
|
||||
printf("Before exiting of the child process\n");
|
||||
_exit(exitval);
|
||||
}
|
||||
printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
|
||||
|
||||
printf("Before calling %s() for the child\n", TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
|
||||
|
||||
validate_status_stopped(status, sigval);
|
||||
|
||||
printf("Set empty EVENT_MASK for the child %d\n", child);
|
||||
event.pe_set_event = PTRACE_LWP_EXIT;
|
||||
ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
|
||||
|
||||
printf("Before resuming the child process where it left off and "
|
||||
"without signal to be sent\n");
|
||||
ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
|
||||
|
||||
printf("Before calling %s() for the child - expected stopped "
|
||||
"SIGTRAP\n", TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
|
||||
|
||||
validate_status_stopped(status, SIGTRAP);
|
||||
|
||||
ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
|
||||
|
||||
ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_LWP_EXIT);
|
||||
|
||||
lid = state.pe_lwp;
|
||||
printf("Reported PTRACE_LWP_EXIT event with lid %d\n", lid);
|
||||
|
||||
printf("Before resuming the child process where it left off and "
|
||||
"without signal to be sent\n");
|
||||
ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
|
||||
|
||||
printf("Before calling %s() for the child - expected exited\n",
|
||||
TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
|
||||
|
||||
validate_status_exited(status, exitval);
|
||||
|
||||
printf("Before calling %s() for the child - expected no process\n",
|
||||
TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
|
||||
}
|
||||
|
||||
ATF_TP_ADD_TCS(tp)
|
||||
{
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
|
|
@ -5307,6 +5619,8 @@ ATF_TP_ADD_TCS(tp)
|
|||
ATF_TP_ADD_TC(tp, eventmask2);
|
||||
ATF_TP_ADD_TC(tp, eventmask3);
|
||||
ATF_TP_ADD_TC(tp, eventmask4);
|
||||
ATF_TP_ADD_TC(tp, eventmask5);
|
||||
ATF_TP_ADD_TC(tp, eventmask6);
|
||||
|
||||
ATF_TP_ADD_TC_HAVE_PID(tp, fork1);
|
||||
ATF_TP_ADD_TC(tp, fork2);
|
||||
|
|
@ -5380,5 +5694,9 @@ ATF_TP_ADD_TCS(tp)
|
|||
ATF_TP_ADD_TC_HAVE_PID(tp, siginfo5);
|
||||
ATF_TP_ADD_TC_PT_STEP(tp, siginfo6);
|
||||
|
||||
ATF_TP_ADD_TC(tp, lwp_create1);
|
||||
|
||||
ATF_TP_ADD_TC(tp, lwp_exit1);
|
||||
|
||||
return atf_no_error();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $ */
|
||||
/* $NetBSD: t_mkfifoat.c,v 1.4 2017/01/14 20:55:26 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2012 The NetBSD Foundation, Inc.
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
|
||||
__RCSID("$NetBSD: t_mkfifoat.c,v 1.4 2017/01/14 20:55:26 christos Exp $");
|
||||
|
||||
#include <atf-c.h>
|
||||
#include <errno.h>
|
||||
|
|
@ -55,13 +55,11 @@ ATF_TC_HEAD(mkfifoat_fd, tc)
|
|||
ATF_TC_BODY(mkfifoat_fd, tc)
|
||||
{
|
||||
int dfd;
|
||||
int fd;
|
||||
mode_t mode = 0600;
|
||||
|
||||
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
|
||||
ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
|
||||
ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1);
|
||||
ATF_REQUIRE(close(fd) == 0);
|
||||
ATF_REQUIRE(mkfifoat(dfd, BASEFIFO, mode) != -1);
|
||||
ATF_REQUIRE(access(FIFO, F_OK) == 0);
|
||||
(void)close(dfd);
|
||||
}
|
||||
|
|
@ -74,12 +72,10 @@ ATF_TC_HEAD(mkfifoat_fdcwd, tc)
|
|||
}
|
||||
ATF_TC_BODY(mkfifoat_fdcwd, tc)
|
||||
{
|
||||
int fd;
|
||||
mode_t mode = 0600;
|
||||
|
||||
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
|
||||
ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFO, mode)) != -1);
|
||||
ATF_REQUIRE(close(fd) == 0);
|
||||
ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFO, mode) != -1);
|
||||
ATF_REQUIRE(access(FIFO, F_OK) == 0);
|
||||
}
|
||||
|
||||
|
|
@ -91,10 +87,9 @@ ATF_TC_HEAD(mkfifoat_fdcwderr, tc)
|
|||
}
|
||||
ATF_TC_BODY(mkfifoat_fdcwderr, tc)
|
||||
{
|
||||
int fd;
|
||||
mode_t mode = 0600;
|
||||
|
||||
ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFOERR, mode)) == -1);
|
||||
ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFOERR, mode) == -1);
|
||||
}
|
||||
|
||||
ATF_TC(mkfifoat_fderr);
|
||||
|
|
@ -110,7 +105,7 @@ ATF_TC_BODY(mkfifoat_fderr, tc)
|
|||
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
|
||||
ATF_REQUIRE((fd = open(FIFO, O_CREAT|O_RDWR, 0644)) != -1);
|
||||
ATF_REQUIRE(close(fd) == 0);
|
||||
ATF_REQUIRE((fd = mkfifoat(-1, FIFO, mode)) == -1);
|
||||
ATF_REQUIRE(mkfifoat(-1, FIFO, mode) == -1);
|
||||
}
|
||||
|
||||
ATF_TP_ADD_TCS(tp)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_glob.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */
|
||||
/* $NetBSD: t_glob.c,v 1.5 2017/01/14 20:47:41 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_glob.c,v 1.4 2017/01/13 21:30:41 christos Exp $");
|
||||
__RCSID("$NetBSD: t_glob.c,v 1.5 2017/01/14 20:47:41 christos Exp $");
|
||||
|
||||
#include <atf-c.h>
|
||||
|
||||
|
|
@ -50,7 +50,6 @@ __RCSID("$NetBSD: t_glob.c,v 1.4 2017/01/13 21:30:41 christos Exp $");
|
|||
|
||||
#ifdef __FreeBSD__
|
||||
#define __gl_stat_t struct stat
|
||||
#define _S_IFDIR S_IFDIR
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -157,7 +156,7 @@ gl_stat(const char *name , __gl_stat_t *st)
|
|||
memset(st, 0, sizeof(*st));
|
||||
|
||||
if (strcmp(buf, "a") == 0 || strcmp(buf, "a/b") == 0) {
|
||||
st->st_mode |= _S_IFDIR;
|
||||
st->st_mode |= S_IFDIR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_regex_att.c,v 1.2 2017/01/14 00:50:56 christos Exp $ */
|
||||
/* $NetBSD: t_regex_att.c,v 1.3 2017/01/14 20:59:23 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
|
|
@ -37,20 +37,18 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_regex_att.c,v 1.2 2017/01/14 00:50:56 christos Exp $");
|
||||
__RCSID("$NetBSD: t_regex_att.c,v 1.3 2017/01/14 20:59:23 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <regex.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <vis.h>
|
||||
#include <ctype.h>
|
||||
#include <atf-c.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <libutil.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <util.h>
|
||||
#include <vis.h>
|
||||
|
||||
static const char sep[] = "\r\n\t";
|
||||
static const char delim[3] = "\\\\\0";
|
||||
|
|
@ -575,9 +573,6 @@ ATF_TC_BODY(leftassoc, tc)
|
|||
* disabled this test in a very unconventional way without giving
|
||||
* any explation. Mark as broken here, but I don't know why. */
|
||||
atf_tc_expect_fail("Reason for breakage unknown");
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
atf_tc_expect_fail("The expected and matched groups are mismatched on FreeBSD");
|
||||
#endif
|
||||
att_test(tc, "leftassoc");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_setjmp.c,v 1.1 2010/12/27 19:35:31 pgoyette Exp $ */
|
||||
/* $NetBSD: t_setjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
#include <sys/cdefs.h>
|
||||
__COPYRIGHT("@(#) Copyright (c) 2008\
|
||||
The NetBSD Foundation, inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: t_setjmp.c,v 1.1 2010/12/27 19:35:31 pgoyette Exp $");
|
||||
__RCSID("$NetBSD: t_setjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_threadjmp.c,v 1.1 2011/04/21 18:58:20 martin Exp $ */
|
||||
/* $NetBSD: t_threadjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
#include <sys/cdefs.h>
|
||||
__COPYRIGHT("@(#) Copyright (c) 2008\
|
||||
The NetBSD Foundation, inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: t_threadjmp.c,v 1.1 2011/04/21 18:58:20 martin Exp $");
|
||||
__RCSID("$NetBSD: t_threadjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_strlen.c,v 1.5 2011/07/14 07:33:20 jruoho Exp $ */
|
||||
/* $NetBSD: t_strlen.c,v 1.6 2017/01/14 20:49:24 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@acorntoolworks.com>
|
||||
|
|
@ -40,9 +40,7 @@ ATF_TC_HEAD(strlen_basic, tc)
|
|||
|
||||
ATF_TC_BODY(strlen_basic, tc)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
void *dl_handle;
|
||||
#endif
|
||||
/* try to trick the compiler */
|
||||
size_t (*strlen_fn)(const char *);
|
||||
|
||||
|
|
@ -110,12 +108,8 @@ ATF_TC_BODY(strlen_basic, tc)
|
|||
* During testing it is useful have the rest of the program
|
||||
* use a known good version!
|
||||
*/
|
||||
#ifdef __FreeBSD__
|
||||
dl_handle = dlopen(NULL, RTLD_LAZY);
|
||||
strlen_fn = dlsym(dl_handle, "test_strlen");
|
||||
#else
|
||||
strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen");
|
||||
#endif
|
||||
if (!strlen_fn)
|
||||
strlen_fn = strlen;
|
||||
|
||||
|
|
@ -142,9 +136,7 @@ ATF_TC_BODY(strlen_basic, tc)
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef __FreeBSD__
|
||||
(void)dlclose(dl_handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
ATF_TC(strlen_huge);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_mincore.c,v 1.9 2017/01/10 22:36:29 christos Exp $ */
|
||||
/* $NetBSD: t_mincore.c,v 1.10 2017/01/14 20:51:13 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_mincore.c,v 1.9 2017/01/10 22:36:29 christos Exp $");
|
||||
__RCSID("$NetBSD: t_mincore.c,v 1.10 2017/01/14 20:51:13 christos Exp $");
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
@ -141,9 +141,7 @@ ATF_TC_WITH_CLEANUP(mincore_resid);
|
|||
ATF_TC_HEAD(mincore_resid, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr", "Test page residency with mincore(2)");
|
||||
#ifdef __FreeBSD__
|
||||
atf_tc_set_md_var(tc, "require.user", "root");
|
||||
#endif
|
||||
}
|
||||
|
||||
ATF_TC_BODY(mincore_resid, tc)
|
||||
|
|
@ -155,13 +153,11 @@ ATF_TC_BODY(mincore_resid, tc)
|
|||
struct rlimit rlim;
|
||||
|
||||
ATF_REQUIRE(getrlimit(RLIMIT_MEMLOCK, &rlim) == 0);
|
||||
#ifdef __FreeBSD__
|
||||
/*
|
||||
* Bump the mlock limit to unlimited so the rest of the testcase
|
||||
* passes instead of failing on the mlock call.
|
||||
*/
|
||||
rlim.rlim_max = RLIM_INFINITY;
|
||||
#endif
|
||||
rlim.rlim_cur = rlim.rlim_max;
|
||||
ATF_REQUIRE(setrlimit(RLIMIT_MEMLOCK, &rlim) == 0);
|
||||
|
||||
|
|
@ -276,9 +272,7 @@ ATF_TC_BODY(mincore_resid, tc)
|
|||
(void)munmap(addr2, npgs * page);
|
||||
(void)munmap(addr3, npgs * page);
|
||||
(void)unlink(path);
|
||||
#ifdef __FreeBSD__
|
||||
free(buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
ATF_TC_CLEANUP(mincore_resid, tc)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_msync.c,v 1.2 2012/03/16 06:15:17 matt Exp $ */
|
||||
/* $NetBSD: t_msync.c,v 1.3 2017/01/14 20:52:42 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_msync.c,v 1.2 2012/03/16 06:15:17 matt Exp $");
|
||||
__RCSID("$NetBSD: t_msync.c,v 1.3 2017/01/14 20:52:42 christos Exp $");
|
||||
|
||||
#include <sys/mman.h>
|
||||
|
||||
|
|
@ -52,12 +52,7 @@ msync_sync(const char *garbage, int flags)
|
|||
{
|
||||
char *buf, *map = MAP_FAILED;
|
||||
const char *str = NULL;
|
||||
#ifdef __FreeBSD__
|
||||
size_t len;
|
||||
#else
|
||||
size_t i, len;
|
||||
ssize_t tot;
|
||||
#endif
|
||||
int fd, rv;
|
||||
|
||||
/*
|
||||
|
|
@ -69,41 +64,17 @@ msync_sync(const char *garbage, int flags)
|
|||
if (buf == NULL)
|
||||
return NULL;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
memset(buf, 'x', page);
|
||||
#else
|
||||
for (i = 0; i < (size_t)page; i++)
|
||||
buf[i] = 'x';
|
||||
#endif
|
||||
|
||||
fd = open(path, O_RDWR | O_CREAT, 0700);
|
||||
|
||||
if (fd < 0) {
|
||||
#ifdef __FreeBSD__
|
||||
free(buf);
|
||||
return "failed to open";
|
||||
#else
|
||||
str = "failed to open";
|
||||
goto out;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if __FreeBSD__
|
||||
(void)write(fd, buf, page);
|
||||
#else
|
||||
tot = 0;
|
||||
|
||||
while (tot < page) {
|
||||
|
||||
rv = write(fd, buf, sizeof(buf));
|
||||
if (rv < 0) {
|
||||
str = "failed to write";
|
||||
goto out;
|
||||
}
|
||||
|
||||
tot += rv;
|
||||
}
|
||||
#endif
|
||||
ATF_REQUIRE_MSG(write(fd, buf, page) != -1, "write(2) failed: %s",
|
||||
strerror(errno));
|
||||
|
||||
map = mmap(NULL, page, PROT_READ | PROT_WRITE, MAP_FILE|MAP_PRIVATE,
|
||||
fd, 0);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_unlink.c,v 1.3 2017/01/13 19:33:03 christos Exp $ */
|
||||
/* $NetBSD: t_unlink.c,v 1.4 2017/01/14 20:55:26 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_unlink.c,v 1.3 2017/01/13 19:33:03 christos Exp $");
|
||||
__RCSID("$NetBSD: t_unlink.c,v 1.4 2017/01/14 20:55:26 christos Exp $");
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
|
@ -111,11 +111,8 @@ ATF_TC_HEAD(unlink_fifo, tc)
|
|||
|
||||
ATF_TC_BODY(unlink_fifo, tc)
|
||||
{
|
||||
int fd;
|
||||
|
||||
ATF_REQUIRE_MSG((fd = mkfifo(path, 0666)) == 0,
|
||||
"mkfifo failed: %s", strerror(errno));
|
||||
(void)close(fd);
|
||||
ATF_REQUIRE(mkfifo(path, 0666) == 0);
|
||||
ATF_REQUIRE(unlink(path) == 0);
|
||||
|
||||
errno = 0;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_sem.c,v 1.2 2010/11/08 13:05:49 njoly Exp $ */
|
||||
/* $NetBSD: t_sem.c,v 1.3 2017/01/14 20:58:20 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
#include <sys/cdefs.h>
|
||||
__COPYRIGHT("@(#) Copyright (c) 2008, 2010\
|
||||
The NetBSD Foundation, inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: t_sem.c,v 1.2 2010/11/08 13:05:49 njoly Exp $");
|
||||
__RCSID("$NetBSD: t_sem.c,v 1.3 2017/01/14 20:58:20 christos Exp $");
|
||||
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_grep.sh,v 1.2 2013/05/17 15:39:17 christos Exp $
|
||||
# $NetBSD: t_grep.sh,v 1.3 2017/01/14 20:43:52 christos Exp $
|
||||
#
|
||||
# Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
|
|
@ -43,20 +43,9 @@ binary_head()
|
|||
}
|
||||
binary_body()
|
||||
{
|
||||
# Begin FreeBSD
|
||||
#
|
||||
# Generate stable output instead of depending on uname to match the
|
||||
# branded OS name of /bin/sh
|
||||
if true; then
|
||||
dd if=/dev/zero count=1 of=test.file
|
||||
echo -n "foobar" >> test.file
|
||||
atf_check -o file:"$(atf_get_srcdir)/d_binary.out" grep foobar test.file
|
||||
else
|
||||
# End FreeBSD
|
||||
atf_check -o file:"$(atf_get_srcdir)/d_binary.out" grep $(uname) /bin/sh
|
||||
# Begin FreeBSD
|
||||
fi
|
||||
# End FreeBSD
|
||||
}
|
||||
|
||||
atf_test_case recurse
|
||||
|
|
@ -70,15 +59,7 @@ recurse_body()
|
|||
echo -e "cod\ndover sole\nhaddock\nhalibut\npilchard" > recurse/d/fish
|
||||
echo -e "cod\nhaddock\nplaice" > recurse/a/f/favourite-fish
|
||||
|
||||
# Begin FreeBSD
|
||||
if true; then
|
||||
atf_check -o file:"$(atf_get_srcdir)/d_recurse.out" -x "grep -r haddock recurse | sort"
|
||||
else
|
||||
# End FreeBSD
|
||||
atf_check -o file:"$(atf_get_srcdir)/d_recurse.out" grep -r haddock recurse
|
||||
# Begin FreeBSD
|
||||
fi
|
||||
# End FreeBSD
|
||||
atf_check -o file:"$(atf_get_srcdir)/d_recurse.out" -x "grep -r haddock recurse | sort"
|
||||
}
|
||||
|
||||
atf_test_case recurse_symlink
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_mtree.sh,v 1.6 2013/02/05 16:49:42 christos Exp $
|
||||
# $NetBSD: t_mtree.sh,v 1.7 2017/01/14 20:45:16 christos Exp $
|
||||
#
|
||||
# Copyright (c) 2009, 2012 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
|
|
|
|||
Loading…
Reference in a new issue