Pull in some minor updates to netbsd-tests from upstream
This commit is contained in:
parent
35905afad1
commit
e3f6edcab0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/NetBSD/tests/dist/; revision=313245 svn path=/vendor/NetBSD/tests/02.04.2017_10.12/; revision=313246; tag=vendor/NetBSD/tests/02.04.2017_10.12
File diff suppressed because it is too large
Load Diff
86
fs/vfs/t_mtime_otrunc.c
Normal file
86
fs/vfs/t_mtime_otrunc.c
Normal file
@ -0,0 +1,86 @@
|
||||
/*-
|
||||
* Copyright (c) 2017 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__COPYRIGHT("@(#) Copyright (c) 2013\
|
||||
The NetBSD Foundation, inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: t_mtime_otrunc.c,v 1.1 2017/02/02 22:07:05 martin Exp $");
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <atf-c.h>
|
||||
|
||||
#include <rump/rump_syscalls.h>
|
||||
#include <rump/rump.h>
|
||||
|
||||
#include "../common/h_fsmacros.h"
|
||||
|
||||
#define LOCKFILE "lock"
|
||||
|
||||
static time_t
|
||||
lock_it(void)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (rump_sys_stat(LOCKFILE, &st) != 0)
|
||||
st.st_mtime = 0;
|
||||
|
||||
int f = rump_sys_open(LOCKFILE, O_WRONLY|O_CREAT|O_TRUNC, 0666);
|
||||
if (f == -1) return 0;
|
||||
rump_sys_close(f);
|
||||
|
||||
return st.st_mtime;
|
||||
}
|
||||
|
||||
static void
|
||||
otrunc_mtime_update(const atf_tc_t *tc, const char *path)
|
||||
{
|
||||
time_t last_ts = 0;
|
||||
int res;
|
||||
|
||||
/* atf_tc_expect_fail("PR kern/51762"); */
|
||||
|
||||
res = rump_sys_chdir(path);
|
||||
if (res == -1)
|
||||
atf_tc_fail("chdir failed");
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
time_t l = lock_it();
|
||||
printf("last lock: %ld\n", (long)l);
|
||||
ATF_REQUIRE_MSG(i == 0 || l > last_ts,
|
||||
"iteration %d: lock time did not increase, old time %lu, "
|
||||
"new time %lu", i,
|
||||
(unsigned long)last_ts, (unsigned long)l);
|
||||
last_ts = l;
|
||||
sleep(2);
|
||||
}
|
||||
rump_sys_chdir("/");
|
||||
}
|
||||
|
||||
ATF_FSAPPLY(otrunc_mtime_update, "Checks for mtime updates by open(O_TRUNC) (PR kern/51762)");
|
233
fs/vfs/t_rwtoro.c
Normal file
233
fs/vfs/t_rwtoro.c
Normal file
@ -0,0 +1,233 @@
|
||||
/* $NetBSD: t_rwtoro.c,v 1.1 2017/01/27 10:45:11 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2017 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
#include <atf-c.h>
|
||||
#include <fcntl.h>
|
||||
#include <libgen.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rump/rump_syscalls.h>
|
||||
#include <rump/rump.h>
|
||||
|
||||
#include <miscfs/nullfs/null.h>
|
||||
#include <fs/tmpfs/tmpfs_args.h>
|
||||
|
||||
#include "../common/h_fsmacros.h"
|
||||
#include "../../h_macros.h"
|
||||
|
||||
static const char *unsupported = "fs does not support r/o remount";
|
||||
static char file_path[MAXPATHLEN];
|
||||
static int file_fd;
|
||||
|
||||
/*
|
||||
* Remount the filesystem read-only and test errno.
|
||||
* Skip filesystems that don't implement read-write -> read-only.
|
||||
*/
|
||||
static void
|
||||
remount_ro(const atf_tc_t *tc, const char *mp, int expected_errno)
|
||||
{
|
||||
int error;
|
||||
union {
|
||||
struct tmpfs_args tmpfs;
|
||||
char data[4095];
|
||||
} mount_args;
|
||||
int mount_args_length;
|
||||
struct statvfs sbuf;
|
||||
|
||||
if (FSTYPE_ZFS(tc))
|
||||
atf_tc_skip("%s", unsupported);
|
||||
|
||||
/* Prepare mount arguments. */
|
||||
RL(rump_sys_statvfs1(mp, &sbuf, ST_WAIT));
|
||||
mount_args_length = sizeof(mount_args);
|
||||
memset(&mount_args, 0, mount_args_length);
|
||||
if (FSTYPE_TMPFS(tc))
|
||||
mount_args.tmpfs.ta_version = TMPFS_ARGS_VERSION;
|
||||
mount_args_length = rump_sys_mount(sbuf.f_fstypename, mp, MNT_GETARGS,
|
||||
&mount_args, mount_args_length);
|
||||
ATF_CHECK(mount_args_length >= 0);
|
||||
|
||||
/* Remount and test result. */
|
||||
error = rump_sys_mount(sbuf.f_fstypename, mp, MNT_UPDATE | MNT_RDONLY,
|
||||
&mount_args, mount_args_length);
|
||||
if (errno == EOPNOTSUPP)
|
||||
atf_tc_skip("%s", unsupported);
|
||||
if (expected_errno == 0)
|
||||
ATF_CHECK(error == 0);
|
||||
else
|
||||
ATF_CHECK_ERRNO(expected_errno, error == -1);
|
||||
}
|
||||
|
||||
static void
|
||||
open_file_ro(const char *prefix)
|
||||
{
|
||||
|
||||
snprintf(file_path, sizeof(file_path), "%s/file", prefix);
|
||||
RL(file_fd = rump_sys_open(file_path, O_CREAT | O_RDWR, 0777));
|
||||
RL(rump_sys_close(file_fd));
|
||||
RL(file_fd = rump_sys_open(file_path, O_RDONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
open_file_ro_unlink(const char *prefix)
|
||||
{
|
||||
|
||||
snprintf(file_path, sizeof(file_path), "%s/file", prefix);
|
||||
RL(file_fd = rump_sys_open(file_path, O_CREAT | O_RDWR, 0777));
|
||||
RL(rump_sys_close(file_fd));
|
||||
RL(file_fd = rump_sys_open(file_path, O_RDONLY));
|
||||
RL(rump_sys_unlink(file_path));
|
||||
}
|
||||
|
||||
static void
|
||||
open_file_rw(const char *prefix)
|
||||
{
|
||||
|
||||
snprintf(file_path, sizeof(file_path), "%s/file", prefix);
|
||||
RL(file_fd = rump_sys_open(file_path, O_CREAT | O_RDWR, 0777));
|
||||
}
|
||||
|
||||
static void
|
||||
close_file(const char *unused)
|
||||
{
|
||||
|
||||
RL(rump_sys_close(file_fd));
|
||||
}
|
||||
|
||||
static void
|
||||
basic_test(const atf_tc_t *tc, const char *mp, int expected_errno,
|
||||
bool use_layer, void (*pre)(const char *), void (*post)(const char *))
|
||||
{
|
||||
const char *null_mount = "/nullm";
|
||||
struct null_args nargs;
|
||||
|
||||
if (use_layer) {
|
||||
RL(rump_sys_mkdir(null_mount, 0777));
|
||||
memset(&nargs, 0, sizeof(nargs));
|
||||
nargs.nulla_target = __UNCONST(mp);;
|
||||
RL(rump_sys_mount(MOUNT_NULL, null_mount, 0,
|
||||
&nargs, sizeof(nargs)));
|
||||
}
|
||||
if (pre)
|
||||
(*pre)(use_layer ? null_mount : mp);
|
||||
remount_ro(tc, mp, expected_errno);
|
||||
if (post)
|
||||
(*post)(use_layer ? null_mount : mp);
|
||||
if (use_layer)
|
||||
RL(rump_sys_unmount(null_mount, 0));
|
||||
}
|
||||
|
||||
static void
|
||||
noneopen(const atf_tc_t *tc, const char *mp)
|
||||
{
|
||||
|
||||
basic_test(tc, mp, 0, false, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
readopen(const atf_tc_t *tc, const char *mp)
|
||||
{
|
||||
|
||||
basic_test(tc, mp, 0, false, open_file_ro, close_file);
|
||||
}
|
||||
|
||||
static void
|
||||
writeopen(const atf_tc_t *tc, const char *mp)
|
||||
{
|
||||
|
||||
basic_test(tc, mp, EBUSY, false, open_file_rw, close_file);
|
||||
}
|
||||
|
||||
static void
|
||||
read_unlinked(const atf_tc_t *tc, const char *mp)
|
||||
{
|
||||
|
||||
basic_test(tc, mp, EBUSY, false, open_file_ro_unlink, close_file);
|
||||
}
|
||||
|
||||
static void
|
||||
layer_noneopen(const atf_tc_t *tc, const char *mp)
|
||||
{
|
||||
|
||||
basic_test(tc, mp, 0, true, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
layer_readopen(const atf_tc_t *tc, const char *mp)
|
||||
{
|
||||
|
||||
basic_test(tc, mp, 0, true, open_file_ro, close_file);
|
||||
}
|
||||
|
||||
static void
|
||||
layer_writeopen(const atf_tc_t *tc, const char *mp)
|
||||
{
|
||||
|
||||
basic_test(tc, mp, EBUSY, true, open_file_rw, close_file);
|
||||
}
|
||||
|
||||
static void
|
||||
layer_read_unlinked(const atf_tc_t *tc, const char *mp)
|
||||
{
|
||||
|
||||
basic_test(tc, mp, EBUSY, true, open_file_ro_unlink, close_file);
|
||||
}
|
||||
|
||||
ATF_TC_FSAPPLY(noneopen, "remount r/o with no file open");
|
||||
ATF_TC_FSAPPLY(readopen, "remount r/o with file open for reading");
|
||||
ATF_TC_FSAPPLY(writeopen, "remount r/o with file open for writing");
|
||||
ATF_TC_FSAPPLY(read_unlinked,
|
||||
"remount r/o with unlinked file open for reading");
|
||||
ATF_TC_FSAPPLY(layer_noneopen, "remount r/o with no file open on layer");
|
||||
ATF_TC_FSAPPLY(layer_readopen,
|
||||
"remount r/o with file open for reading on layer");
|
||||
ATF_TC_FSAPPLY(layer_writeopen,
|
||||
"remount r/o with file open for writing on layer");
|
||||
ATF_TC_FSAPPLY(layer_read_unlinked,
|
||||
"remount r/o with unlinked file open for reading on layer");
|
||||
|
||||
ATF_TP_ADD_TCS(tp)
|
||||
{
|
||||
|
||||
ATF_TP_FSAPPLY(noneopen);
|
||||
ATF_TP_FSAPPLY(readopen);
|
||||
ATF_TP_FSAPPLY(writeopen);
|
||||
ATF_TP_FSAPPLY(read_unlinked);
|
||||
ATF_TP_FSAPPLY(layer_noneopen);
|
||||
ATF_TP_FSAPPLY(layer_readopen);
|
||||
ATF_TP_FSAPPLY(layer_writeopen);
|
||||
ATF_TP_FSAPPLY(layer_read_unlinked);
|
||||
|
||||
return atf_no_error();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: t_pow.c,v 1.4 2015/09/08 05:24:27 dholland Exp $ */
|
||||
/* $NetBSD: t_pow.c,v 1.5 2017/01/20 21:15:56 maya Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
@ -29,7 +29,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_pow.c,v 1.4 2015/09/08 05:24:27 dholland Exp $");
|
||||
__RCSID("$NetBSD: t_pow.c,v 1.5 2017/01/20 21:15:56 maya Exp $");
|
||||
|
||||
#include <atf-c.h>
|
||||
#include <math.h>
|
||||
@ -379,12 +379,12 @@ ATF_TC_BODY(powf_inf_neg_x, tc)
|
||||
*/
|
||||
z = powf(x, 3.0);
|
||||
|
||||
if (isinff(z) == 0 || signbit(z) == 0)
|
||||
if (isinf(z) == 0 || signbit(z) == 0)
|
||||
atf_tc_fail_nonfatal("powf(-Inf, 3.0) != -Inf");
|
||||
|
||||
z = powf(x, 4.0);
|
||||
|
||||
if (isinff(z) == 0 || signbit(z) != 0)
|
||||
if (isinf(z) == 0 || signbit(z) != 0)
|
||||
atf_tc_fail_nonfatal("powf(-Inf, 4.0) != +Inf");
|
||||
|
||||
/*
|
||||
@ -421,7 +421,7 @@ ATF_TC_BODY(powf_inf_neg_y, tc)
|
||||
*/
|
||||
z = powf(0.1, y);
|
||||
|
||||
if (isinff(z) == 0 || signbit(z) != 0)
|
||||
if (isinf(z) == 0 || signbit(z) != 0)
|
||||
atf_tc_fail_nonfatal("powf(0.1, -Inf) != +Inf");
|
||||
|
||||
z = powf(1.1, y);
|
||||
@ -452,7 +452,7 @@ ATF_TC_BODY(powf_inf_pos_x, tc)
|
||||
|
||||
z = powf(x, 2.0);
|
||||
|
||||
if (isinff(z) == 0 || signbit(z) != 0)
|
||||
if (isinf(z) == 0 || signbit(z) != 0)
|
||||
atf_tc_fail_nonfatal("powf(+Inf, 2.0) != +Inf");
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ ATF_TC_BODY(powf_inf_pos_y, tc)
|
||||
|
||||
z = powf(1.1, y);
|
||||
|
||||
if (isinff(z) == 0 || signbit(z) != 0)
|
||||
if (isinf(z) == 0 || signbit(z) != 0)
|
||||
atf_tc_fail_nonfatal("powf(1.1, +Inf) != +Inf");
|
||||
}
|
||||
|
||||
@ -496,8 +496,8 @@ ATF_TC_BODY(powf_one_neg_x, tc)
|
||||
/*
|
||||
* If x is -1.0, and y is +-Inf, 1.0 shall be returned.
|
||||
*/
|
||||
ATF_REQUIRE(isinff(infp) != 0);
|
||||
ATF_REQUIRE(isinff(infn) != 0);
|
||||
ATF_REQUIRE(isinf(infp) != 0);
|
||||
ATF_REQUIRE(isinf(infn) != 0);
|
||||
|
||||
if (powf(-1.0, infp) != 1.0) {
|
||||
atf_tc_expect_fail("PR lib/45372");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: t_bpf.c,v 1.6 2017/01/13 21:30:42 christos Exp $ */
|
||||
/* $NetBSD: t_bpf.c,v 1.7 2017/02/01 08:04:49 ozaki-r Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
|
||||
@ -25,7 +25,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_bpf.c,v 1.6 2017/01/13 21:30:42 christos Exp $");
|
||||
__RCSID("$NetBSD: t_bpf.c,v 1.7 2017/02/01 08:04:49 ozaki-r Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -166,6 +166,39 @@ ATF_TC_BODY(bpfwritetrunc, tc)
|
||||
}
|
||||
#endif /* #if (SIZE_MAX > UINT_MAX) */
|
||||
|
||||
ATF_TC(bpf_ioctl_BLEN);
|
||||
ATF_TC_HEAD(bpf_ioctl_BLEN, tc)
|
||||
{
|
||||
|
||||
atf_tc_set_md_var(tc, "descr", "Checks behaviors of BIOCGBLEN and "
|
||||
"BIOCSBLEN");
|
||||
}
|
||||
|
||||
ATF_TC_BODY(bpf_ioctl_BLEN, tc)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
int ifnum, bpfd;
|
||||
u_int blen = 0;
|
||||
|
||||
RZ(rump_init());
|
||||
RZ(rump_pub_shmif_create(NULL, &ifnum));
|
||||
sprintf(ifr.ifr_name, "shmif%d", ifnum);
|
||||
|
||||
RL(bpfd = rump_sys_open("/dev/bpf", O_RDWR));
|
||||
|
||||
RL(rump_sys_ioctl(bpfd, BIOCGBLEN, &blen));
|
||||
ATF_REQUIRE(blen != 0);
|
||||
blen = 100;
|
||||
RL(rump_sys_ioctl(bpfd, BIOCSBLEN, &blen));
|
||||
RL(rump_sys_ioctl(bpfd, BIOCGBLEN, &blen));
|
||||
ATF_REQUIRE_EQ(blen, 100);
|
||||
|
||||
RL(rump_sys_ioctl(bpfd, BIOCSETIF, &ifr));
|
||||
|
||||
ATF_REQUIRE_EQ_MSG(rump_sys_ioctl(bpfd, BIOCSBLEN, &blen), -1,
|
||||
"Don't allow to change buflen after binding bpf to an interface");
|
||||
}
|
||||
|
||||
ATF_TP_ADD_TCS(tp)
|
||||
{
|
||||
|
||||
@ -173,5 +206,6 @@ ATF_TP_ADD_TCS(tp)
|
||||
#if (SIZE_MAX > UINT_MAX)
|
||||
ATF_TP_ADD_TC(tp, bpfwritetrunc);
|
||||
#endif
|
||||
ATF_TP_ADD_TC(tp, bpf_ioctl_BLEN);
|
||||
return atf_no_error();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: t_ifconfig.sh,v 1.14 2016/10/01 22:15:04 kre Exp $
|
||||
# $NetBSD: t_ifconfig.sh,v 1.15 2017/01/20 08:35:33 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2015 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
@ -181,7 +181,7 @@ ifconfig_options_body()
|
||||
|
||||
# ifconfig -C
|
||||
# -C shows all of the interface cloners available on the system
|
||||
atf_check -s exit:0 -o match:'shmif lo carp' rump.ifconfig -C
|
||||
atf_check -s exit:0 -o match:'shmif carp lo' rump.ifconfig -C
|
||||
|
||||
unset RUMP_SERVER
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user