Merge ^/head r313301 through r313643.

This commit is contained in:
Dimitry Andric 2017-02-11 14:04:18 +00:00
commit 1a36faad54
594 changed files with 151985 additions and 16988 deletions

View File

@ -151,6 +151,13 @@ OLD_FILES+=usr/lib/clang/3.9.1/lib/freebsd/libclang_rt.ubsan_standalone_cxx-x86_
OLD_DIRS+=usr/lib/clang/3.9.1/lib/freebsd
OLD_DIRS+=usr/lib/clang/3.9.1/lib
OLD_DIRS+=usr/lib/clang/3.9.1
# 20170206: remove bdes(1)
OLD_FILES+=usr/bin/bdes
OLD_FILES+=usr/lib/debug/usr/bin/bdes.debug
OLD_FILES+=usr/share/man/man1/bdes.1.gz
# 20170206: merged projects/ipsec
OLD_FILES+=usr/include/netinet/ip_ipsec.h
OLD_FILES+=usr/include/netinet6/ip6_ipsec.h
# 20170128: remove pc98 support
OLD_FILES+=usr/include/dev/ic/i8251.h
OLD_FILES+=usr/include/dev/ic/i8255.h

View File

@ -1,5 +1,5 @@
.\" $FreeBSD$
.Dd October 2, 2016
.Dd February 5, 2017
.Dt ED 1
.Os
.Sh NAME
@ -871,9 +871,6 @@ writes.
If a newline alone is entered as the key, then encryption is
turned off.
Otherwise, echoing is disabled while a key is read.
Encryption/decryption is done using the
.Xr bdes 1
algorithm.
.It Pf (.+1)z n
Scroll
.Ar n
@ -962,7 +959,6 @@ results in an error.
If the command is entered a second time, it succeeds,
but any changes to the buffer are lost.
.Sh SEE ALSO
.Xr bdes 1 ,
.Xr sed 1 ,
.Xr sh 1 ,
.Xr vi 1 ,

View File

@ -261,7 +261,7 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
sym->st_value = 0;
sym->st_size = 0;
sym->st_info = ELF32_ST_INFO(STB_GLOBAL, STT_FUNC);
sym->st_other = ELF32_ST_VISIBILITY(STV_HIDDEN);
sym->st_other = 0;
sym->st_shndx = SHN_UNDEF;
rel++;
@ -445,7 +445,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep)
sym->st_value = 0;
sym->st_size = 0;
sym->st_info = GELF_ST_INFO(STB_GLOBAL, STT_FUNC);
sym->st_other = ELF64_ST_VISIBILITY(STV_HIDDEN);
sym->st_other = 0;
sym->st_shndx = SHN_UNDEF;
rel++;
@ -1187,6 +1187,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
static const char dt_enabled[] = "enabled";
static const char dt_symprefix[] = "$dtrace";
static const char dt_symfmt[] = "%s%ld.%s";
static const char dt_weaksymfmt[] = "%s.%s";
char probename[DTRACE_NAMELEN];
int fd, i, ndx, eprobe, mod = 0;
Elf *elf = NULL;
@ -1548,44 +1549,46 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
if (dt_symtab_lookup(data_sym, osym, isym,
rela.r_offset, shdr_rel.sh_info, &fsym,
(emachine1 == EM_PPC64), elf) != 0 &&
dt_symtab_lookup(data_sym, 0, osym,
(emachine1 == EM_PPC64), elf) == 0) {
if (fsym.st_name > data_str->d_size)
goto err;
r = s = (char *) data_str->d_buf + fsym.st_name;
assert(strstr(s, dt_symprefix) == s);
s = strchr(s, '.') + 1;
} else if (dt_symtab_lookup(data_sym, 0, osym,
rela.r_offset, shdr_rel.sh_info, &fsym,
(emachine1 == EM_PPC64), elf) != 0)
goto err;
(emachine1 == EM_PPC64), elf) == 0) {
u_int bind;
if (fsym.st_name > data_str->d_size)
goto err;
assert(GELF_ST_TYPE(fsym.st_info) == STT_FUNC);
/*
* If this is our first time encountering this symbol,
* emit an alias.
*/
s = (char *)data_str->d_buf + fsym.st_name;
if (strncmp(s, dt_symprefix,
sizeof (dt_symprefix) - 1) != 0) {
u_int bind = GELF_ST_BIND(fsym.st_info);
bind = GELF_ST_BIND(fsym.st_info) == STB_WEAK ?
STB_WEAK : STB_GLOBAL;
/*
* Emit an alias for the symbol. It needs to be
* non-preemptible so that .SUNW_dof relocations
* may be resolved at static link time. Aliases
* of weak symbols are given a non-unique name
* so that they may be merged by the linker.
*/
dsym = fsym;
dsym.st_name = istr;
dsym.st_info = GELF_ST_INFO(bind == STB_LOCAL ?
STB_GLOBAL : bind, STT_FUNC);
dsym.st_info = GELF_ST_INFO(bind, STT_FUNC);
dsym.st_other = GELF_ST_VISIBILITY(STV_HIDDEN);
(void) gelf_update_sym(data_sym, isym, &dsym);
r = (char *) data_str->d_buf + istr;
istr += 1 + sprintf(r, dt_symfmt, dt_symprefix, objkey,
s);
s = (char *) data_str->d_buf + fsym.st_name;
if (bind == STB_WEAK)
istr += sprintf(r, dt_weaksymfmt,
dt_symprefix, s);
else
istr += sprintf(r, dt_symfmt,
dt_symprefix, objkey, s);
istr++;
isym++;
assert(isym <= nsym);
} else {
r = s;
s = strchr(s, '.');
assert(s != NULL);
s++;
}
} else
goto err;
if ((pvp = dt_provider_lookup(dtp, pname)) == NULL) {
return (dt_link_error(dtp, elf, fd, bufs,

View File

@ -178,7 +178,7 @@ extern int YYPARSE_DECL();
#define ID 257
#define CONST 258
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT expr.oxout_lhs[] = { -1,
2, 0, 1, 3, 3, 3, 3, 3, 3, 3,
};

View File

@ -23,11 +23,6 @@
#ifdef _FILE_OFFSET_BITS
#undef _FILE_OFFSET_BITS
#endif
#if SANITIZER_FREEBSD
#define _WANT_RTENTRY
#include <sys/param.h>
#include <sys/socketvar.h>
#endif
#include <arpa/inet.h>
#include <dirent.h>
#include <errno.h>
@ -433,6 +428,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
unsigned struct_input_absinfo_sz = sizeof(struct input_absinfo);
unsigned struct_input_id_sz = sizeof(struct input_id);
unsigned struct_mtpos_sz = sizeof(struct mtpos);
unsigned struct_rtentry_sz = sizeof(struct rtentry);
unsigned struct_termio_sz = sizeof(struct termio);
unsigned struct_vt_consize_sz = sizeof(struct vt_consize);
unsigned struct_vt_sizes_sz = sizeof(struct vt_sizes);
@ -452,7 +448,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
unsigned struct_midi_info_sz = sizeof(struct midi_info);
unsigned struct_mtget_sz = sizeof(struct mtget);
unsigned struct_mtop_sz = sizeof(struct mtop);
unsigned struct_rtentry_sz = sizeof(struct rtentry);
unsigned struct_sbi_instrument_sz = sizeof(struct sbi_instrument);
unsigned struct_seq_event_rec_sz = sizeof(struct seq_event_rec);
unsigned struct_synth_info_sz = sizeof(struct synth_info);

View File

@ -126,6 +126,15 @@ struct _Elftc_Bfd_Target _libelftc_targets[] = {
.bt_machine = EM_PPC,
},
{
.bt_name = "elf32-powerpc-freebsd",
.bt_type = ETF_ELF,
.bt_byteorder = ELFDATA2MSB,
.bt_elfclass = ELFCLASS32,
.bt_machine = EM_PPC,
.bt_osabi = ELFOSABI_FREEBSD,
},
{
.bt_name = "elf32-powerpcle",
.bt_type = ETF_ELF,
@ -289,6 +298,15 @@ struct _Elftc_Bfd_Target _libelftc_targets[] = {
.bt_machine = EM_PPC64,
},
{
.bt_name = "elf64-powerpc-freebsd",
.bt_type = ETF_ELF,
.bt_byteorder = ELFDATA2MSB,
.bt_elfclass = ELFCLASS64,
.bt_machine = EM_PPC64,
.bt_osabi = ELFOSABI_FREEBSD,
},
{
.bt_name = "elf64-powerpcle",
.bt_type = ETF_ELF,

View File

@ -356,7 +356,7 @@ archive_read_format_cpio_read_header(struct archive_read *a,
struct archive_entry *entry)
{
struct cpio *cpio;
const void *h;
const void *h, *hl;
struct archive_string_conv *sconv;
size_t namelength;
size_t name_pad;
@ -406,11 +406,11 @@ archive_read_format_cpio_read_header(struct archive_read *a,
"Rejecting malformed cpio archive: symlink contents exceed 1 megabyte");
return (ARCHIVE_FATAL);
}
h = __archive_read_ahead(a,
hl = __archive_read_ahead(a,
(size_t)cpio->entry_bytes_remaining, NULL);
if (h == NULL)
if (hl == NULL)
return (ARCHIVE_FATAL);
if (archive_entry_copy_symlink_l(entry, (const char *)h,
if (archive_entry_copy_symlink_l(entry, (const char *)hl,
(size_t)cpio->entry_bytes_remaining, sconv) != 0) {
if (errno == ENOMEM) {
archive_set_error(&a->archive, ENOMEM,
@ -434,7 +434,7 @@ archive_read_format_cpio_read_header(struct archive_read *a,
* header. XXX */
/* Compare name to "TRAILER!!!" to test for end-of-archive. */
if (namelength == 11 && memcmp((const char *)h, "TRAILER!!!",
if (namelength == 11 && strncmp((const char *)h, "TRAILER!!!",
11) == 0) {
/* TODO: Store file location of start of block. */
archive_clear_error(&a->archive);

View File

@ -1608,8 +1608,11 @@ parse_keyword(struct archive_read *a, struct mtree *mtree,
if (*val == '.') {
++val;
ns = (long)mtree_atol10(&val);
} else
ns = 0;
if (ns < 0)
ns = 0;
else if (ns > 999999999)
ns = 999999999;
}
if (m > my_time_t_max)
m = my_time_t_max;
else if (m < my_time_t_min)

View File

@ -134,8 +134,8 @@ static ssize_t _warc_rdlen(const char *buf, size_t bsz);
static time_t _warc_rdrtm(const char *buf, size_t bsz);
static time_t _warc_rdmtm(const char *buf, size_t bsz);
static const char *_warc_find_eoh(const char *buf, size_t bsz);
static const char *_warc_find_eol(const char *buf, size_t bsz);
int
archive_read_support_format_warc(struct archive *_a)
{
@ -198,8 +198,8 @@ _warc_bid(struct archive_read *a, int best_bid)
/* otherwise snarf the record's version number */
ver = _warc_rdver(hdr, nrd);
if (ver == 0U || ver > 10000U) {
/* oh oh oh, best not to wager ... */
if (ver < 1200U || ver > 10000U) {
/* we only support WARC 0.12 to 1.0 */
return -1;
}
@ -254,23 +254,32 @@ start_over:
&a->archive, ARCHIVE_ERRNO_MISC,
"Bad record header");
return (ARCHIVE_FATAL);
} else if ((ver = _warc_rdver(buf, eoh - buf)) > 10000U) {
/* nawww, I wish they promised backward compatibility
* anyhoo, in their infinite wisdom the 28500 guys might
* come up with something we can't possibly handle so
* best end things here */
}
ver = _warc_rdver(buf, eoh - buf);
/* we currently support WARC 0.12 to 1.0 */
if (ver == 0U) {
archive_set_error(
&a->archive, ARCHIVE_ERRNO_MISC,
"Unsupported record version");
"Invalid record version");
return (ARCHIVE_FATAL);
} else if ((cntlen = _warc_rdlen(buf, eoh - buf)) < 0) {
} else if (ver < 1200U || ver > 10000U) {
archive_set_error(
&a->archive, ARCHIVE_ERRNO_MISC,
"Unsupported record version: %u.%u",
ver / 10000, (ver % 10000) / 100);
return (ARCHIVE_FATAL);
}
cntlen = _warc_rdlen(buf, eoh - buf);
if (cntlen < 0) {
/* nightmare! the specs say content-length is mandatory
* so I don't feel overly bad stopping the reader here */
archive_set_error(
&a->archive, EINVAL,
"Bad content length");
return (ARCHIVE_FATAL);
} else if ((rtime = _warc_rdrtm(buf, eoh - buf)) == (time_t)-1) {
}
rtime = _warc_rdrtm(buf, eoh - buf);
if (rtime == (time_t)-1) {
/* record time is mandatory as per WARC/1.0,
* so just barf here, fast and loud */
archive_set_error(
@ -284,7 +293,7 @@ start_over:
if (ver != w->pver) {
/* stringify this entry's version */
archive_string_sprintf(&w->sver,
"WARC/%u.%u", ver / 10000, ver % 10000);
"WARC/%u.%u", ver / 10000, (ver % 10000) / 100);
/* remember the version */
w->pver = ver;
}
@ -577,51 +586,41 @@ out:
}
static unsigned int
_warc_rdver(const char buf[10], size_t bsz)
_warc_rdver(const char *buf, size_t bsz)
{
static const char magic[] = "WARC/";
unsigned int ver;
unsigned int ver = 0U;
unsigned int end = 0U;
(void)bsz; /* UNUSED */
if (memcmp(buf, magic, sizeof(magic) - 1U) != 0) {
/* nope */
return 99999U;
if (bsz < 12 || memcmp(buf, magic, sizeof(magic) - 1U) != 0) {
/* buffer too small or invalid magic */
return ver;
}
/* looks good so far, read the version number for a laugh */
buf += sizeof(magic) - 1U;
/* most common case gets a quick-check here */
if (memcmp(buf, "1.0\r\n", 5U) == 0) {
ver = 10000U;
} else {
switch (*buf) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
if (buf[1U] == '.') {
char *on;
/* set up major version */
ver = (buf[0U] - '0') * 10000U;
/* minor version, anyone? */
ver += (strtol(buf + 2U, &on, 10)) * 100U;
/* don't parse anything else */
if (on > buf + 2U) {
break;
}
}
/* FALLTHROUGH */
case '9':
default:
/* just make the version ridiculously high */
ver = 999999U;
break;
if (isdigit(buf[0U]) && (buf[1U] == '.') && isdigit(buf[2U])) {
/* we support a maximum of 2 digits in the minor version */
if (isdigit(buf[3U]))
end = 1U;
/* set up major version */
ver = (buf[0U] - '0') * 10000U;
/* set up minor version */
if (end == 1U) {
ver += (buf[2U] - '0') * 1000U;
ver += (buf[3U] - '0') * 100U;
} else
ver += (buf[2U] - '0') * 100U;
/*
* WARC below version 0.12 has a space-separated header
* WARC 0.12 and above terminates the version with a CRLF
*/
if (ver >= 1200U) {
if (memcmp(buf + 3U + end, "\r\n", 2U) != 0)
ver = 0U;
} else if (ver < 1200U) {
if (!isblank(*(buf + 3U + end)))
ver = 0U;
}
}
return ver;
@ -631,34 +630,27 @@ static unsigned int
_warc_rdtyp(const char *buf, size_t bsz)
{
static const char _key[] = "\r\nWARC-Type:";
const char *const eob = buf + bsz;
const char *val;
const char *val, *eol;
if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) {
/* no bother */
return WT_NONE;
}
/* overread whitespace */
val += sizeof(_key) - 1U;
while (val < eob && isspace((unsigned char)*val))
if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL) {
/* no end of line */
return WT_NONE;
}
/* overread whitespace */
while (val < eol && isblank((unsigned char)*val))
++val;
if (val + 8U > eob) {
;
} else if (memcmp(val, "resource", 8U) == 0) {
return WT_RSRC;
} else if (memcmp(val, "warcinfo", 8U) == 0) {
return WT_INFO;
} else if (memcmp(val, "metadata", 8U) == 0) {
return WT_META;
} else if (memcmp(val, "request", 7U) == 0) {
return WT_REQ;
} else if (memcmp(val, "response", 8U) == 0) {
return WT_RSP;
} else if (memcmp(val, "conversi", 8U) == 0) {
return WT_CONV;
} else if (memcmp(val, "continua", 8U) == 0) {
return WT_CONT;
if (val + 8U == eol) {
if (memcmp(val, "resource", 8U) == 0)
return WT_RSRC;
else if (memcmp(val, "response", 8U) == 0)
return WT_RSP;
}
return WT_NONE;
}
@ -667,10 +659,7 @@ static warc_string_t
_warc_rduri(const char *buf, size_t bsz)
{
static const char _key[] = "\r\nWARC-Target-URI:";
const char *const eob = buf + bsz;
const char *val;
const char *uri;
const char *eol;
const char *val, *uri, *eol, *p;
warc_string_t res = {0U, NULL};
if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) {
@ -679,25 +668,32 @@ _warc_rduri(const char *buf, size_t bsz)
}
/* overread whitespace */
val += sizeof(_key) - 1U;
while (val < eob && isspace((unsigned char)*val))
++val;
/* overread URL designators */
if ((uri = xmemmem(val, eob - val, "://", 3U)) == NULL) {
/* not touching that! */
return res;
} else if ((eol = memchr(uri, '\n', eob - uri)) == NULL) {
/* no end of line? :O */
if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL) {
/* no end of line */
return res;
}
/* massage uri to point to after :// */
while (val < eol && isblank((unsigned char)*val))
++val;
/* overread URL designators */
if ((uri = xmemmem(val, eol - val, "://", 3U)) == NULL) {
/* not touching that! */
return res;
}
/* spaces inside uri are not allowed, CRLF should follow */
for (p = val; p < eol; p++) {
if (isspace(*p))
return res;
}
/* there must be at least space for ftp */
if (uri < (val + 3U))
return res;
/* move uri to point to after :// */
uri += 3U;
/* also massage eol to point to the first whitespace
* after the last non-whitespace character before
* the end of the line */
while (eol > uri && isspace((unsigned char)eol[-1]))
--eol;
/* now then, inspect the URI */
if (memcmp(val, "file", 4U) == 0) {
@ -720,7 +716,7 @@ static ssize_t
_warc_rdlen(const char *buf, size_t bsz)
{
static const char _key[] = "\r\nContent-Length:";
const char *val;
const char *val, *eol;
char *on = NULL;
long int len;
@ -728,14 +724,24 @@ _warc_rdlen(const char *buf, size_t bsz)
/* no bother */
return -1;
}
/* strtol kindly overreads whitespace for us, so use that */
val += sizeof(_key) - 1U;
len = strtol(val, &on, 10);
if (on == NULL || !isspace((unsigned char)*on)) {
/* hm, can we trust that number? Best not. */
if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL) {
/* no end of line */
return -1;
}
/* skip leading whitespace */
while (val < eol && isblank(*val))
val++;
/* there must be at least one digit */
if (!isdigit(*val))
return -1;
len = strtol(val, &on, 10);
if (on != eol) {
/* line must end here */
return -1;
}
return (size_t)len;
}
@ -743,7 +749,7 @@ static time_t
_warc_rdrtm(const char *buf, size_t bsz)
{
static const char _key[] = "\r\nWARC-Date:";
const char *val;
const char *val, *eol;
char *on = NULL;
time_t res;
@ -751,13 +757,17 @@ _warc_rdrtm(const char *buf, size_t bsz)
/* no bother */
return (time_t)-1;
}
val += sizeof(_key) - 1U;
if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL ) {
/* no end of line */
return -1;
}
/* xstrpisotime() kindly overreads whitespace for us, so use that */
val += sizeof(_key) - 1U;
res = xstrpisotime(val, &on);
if (on == NULL || !isspace((unsigned char)*on)) {
/* hm, can we trust that number? Best not. */
return (time_t)-1;
if (on != eol) {
/* line must end here */
return -1;
}
return res;
}
@ -766,7 +776,7 @@ static time_t
_warc_rdmtm(const char *buf, size_t bsz)
{
static const char _key[] = "\r\nLast-Modified:";
const char *val;
const char *val, *eol;
char *on = NULL;
time_t res;
@ -774,13 +784,17 @@ _warc_rdmtm(const char *buf, size_t bsz)
/* no bother */
return (time_t)-1;
}
val += sizeof(_key) - 1U;
if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL ) {
/* no end of line */
return -1;
}
/* xstrpisotime() kindly overreads whitespace for us, so use that */
val += sizeof(_key) - 1U;
res = xstrpisotime(val, &on);
if (on == NULL || !isspace((unsigned char)*on)) {
/* hm, can we trust that number? Best not. */
return (time_t)-1;
if (on != eol) {
/* line must end here */
return -1;
}
return res;
}
@ -797,4 +811,12 @@ _warc_find_eoh(const char *buf, size_t bsz)
return hit;
}
static const char*
_warc_find_eol(const char *buf, size_t bsz)
{
static const char _marker[] = "\r\n";
const char *hit = xmemmem(buf, bsz, _marker, sizeof(_marker) - 1U);
return hit;
}
/* archive_read_support_format_warc.c ends here */

View File

@ -394,6 +394,7 @@ static void checksum_update(struct archive_read *, const void *,
size_t, const void *, size_t);
static int checksum_final(struct archive_read *, const void *,
size_t, const void *, size_t);
static void checksum_cleanup(struct archive_read *);
static int decompression_init(struct archive_read *, enum enctype);
static int decompress(struct archive_read *, const void **,
size_t *, const void *, size_t *);
@ -923,6 +924,7 @@ xar_cleanup(struct archive_read *a)
int r;
xar = (struct xar *)(a->format->data);
checksum_cleanup(a);
r = decompression_cleanup(a);
hdlink = xar->hdlink_list;
while (hdlink != NULL) {
@ -1719,6 +1721,16 @@ decompression_cleanup(struct archive_read *a)
return (r);
}
static void
checksum_cleanup(struct archive_read *a) {
struct xar *xar;
xar = (struct xar *)(a->format->data);
_checksum_final(&(xar->a_sumwrk), NULL, 0);
_checksum_final(&(xar->e_sumwrk), NULL, 0);
}
static void
xmlattr_cleanup(struct xmlattr_list *list)
{

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_cgd_3des.c,v 1.1 2016/11/11 07:39:58 alnsn Exp $ */
/* $NetBSD: t_cgd_3des.c,v 1.2 2017/01/13 21:30:39 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
* All rights reserved.
@ -48,7 +48,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
#define SECSIZE 512

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_cgd_aes.c,v 1.5 2016/12/11 00:23:44 alnsn Exp $ */
/* $NetBSD: t_cgd_aes.c,v 1.6 2017/01/13 21:30:39 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
* Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@ -49,7 +49,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
#define SECSIZE 512

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_cgd_blowfish.c,v 1.1 2016/11/10 23:44:36 alnsn Exp $ */
/* $NetBSD: t_cgd_blowfish.c,v 1.2 2017/01/13 21:30:39 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
* All rights reserved.
@ -48,7 +48,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
#define SECSIZE 512

View File

@ -0,0 +1,25 @@
#!/bin/ksh
export TZ=Etc/Universal
datesub() {
gdate "$@" '+ FILL(%_11s,%_4Y,%_m,%_d,%w,%_H,%_M,%_S), // %a %b %e %H:%M:%S %Z %Y'
}
(
datesub -d '1970/01/01 00:00:00'
datesub -d '1981/04/12 12:00:03'
datesub -d '2011/07/21 09:57:00'
datesub -d @2147483647
datesub -d @2147483648
datesub -d '2063/04/05 00:00:00'
for year in `seq 1970 1 2030`; do
datesub -d "${year}/01/01 00:00:00"
datesub -d "${year}/07/01 00:00:00"
done
for year in `seq 2000 25 2600`; do
datesub -d "$((${year} - 1))/12/31 23:59:59"
datesub -d "$((${year} + 0))/01/01 00:00:00"
datesub -d "$((${year} + 1))/01/01 00:00:00"
done
)|sort -u

View File

@ -0,0 +1,309 @@
/* $NetBSD: t_clock_subr.c,v 1.3 2017/01/13 21:30:39 christos Exp $ */
/*
* Copyright (c) 2016 Jonathan A. Kollasch
* 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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) 2016\
Jonathan A. Kollasch. All rights reserved.");
__RCSID("$NetBSD: t_clock_subr.c,v 1.3 2017/01/13 21:30:39 christos Exp $");
#include <sys/types.h>
#include <dev/clock_subr.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <atf-c.h>
#include "h_macros.h"
#define FILL(ti,ye,mo,da,wd,ho,mi,se) \
{ .time = (ti), .clock = { .dt_year = (ye), .dt_mon = (mo), .dt_day = (da), \
.dt_wday = (wd), .dt_hour = (ho), .dt_min = (mi), .dt_sec = (se), } }
static struct clock_test {
time_t time;
struct clock_ymdhms clock;
} const clock_tests[] = {
FILL( 0,1970, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1970
FILL( 15638400,1970, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1970
FILL( 31536000,1971, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1971
FILL( 47174400,1971, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1971
FILL( 63072000,1972, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1972
FILL( 78796800,1972, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1972
FILL( 94694400,1973, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1973
FILL( 110332800,1973, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1973
FILL( 126230400,1974, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1974
FILL( 141868800,1974, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1974
FILL( 157766400,1975, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1975
FILL( 173404800,1975, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1975
FILL( 189302400,1976, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1976
FILL( 205027200,1976, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1976
FILL( 220924800,1977, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1977
FILL( 236563200,1977, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1977
FILL( 252460800,1978, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1978
FILL( 268099200,1978, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1978
FILL( 283996800,1979, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1979
FILL( 299635200,1979, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1979
FILL( 315532800,1980, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1980
FILL( 331257600,1980, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1980
FILL( 347155200,1981, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1981
FILL( 355924803,1981, 4,12,0,12, 0, 3), // Sun Apr 12 12:00:03 UTC 1981
FILL( 362793600,1981, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1981
FILL( 378691200,1982, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1982
FILL( 394329600,1982, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1982
FILL( 410227200,1983, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1983
FILL( 425865600,1983, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1983
FILL( 441763200,1984, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1984
FILL( 457488000,1984, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1984
FILL( 473385600,1985, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1985
FILL( 489024000,1985, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1985
FILL( 504921600,1986, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1986
FILL( 520560000,1986, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1986
FILL( 536457600,1987, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1987
FILL( 552096000,1987, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1987
FILL( 567993600,1988, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1988
FILL( 583718400,1988, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1988
FILL( 599616000,1989, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1989
FILL( 615254400,1989, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1989
FILL( 631152000,1990, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1990
FILL( 646790400,1990, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1990
FILL( 662688000,1991, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1991
FILL( 678326400,1991, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1991
FILL( 694224000,1992, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1992
FILL( 709948800,1992, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1992
FILL( 725846400,1993, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1993
FILL( 741484800,1993, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1993
FILL( 757382400,1994, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1994
FILL( 773020800,1994, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1994
FILL( 788918400,1995, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1995
FILL( 804556800,1995, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1995
FILL( 820454400,1996, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1996
FILL( 836179200,1996, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1996
FILL( 852076800,1997, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1997
FILL( 867715200,1997, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1997
FILL( 883612800,1998, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1998
FILL( 899251200,1998, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1998
FILL( 915148800,1999, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1999
FILL( 930787200,1999, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1999
FILL( 946684799,1999,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 1999
FILL( 946684800,2000, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2000
FILL( 962409600,2000, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2000
FILL( 978307200,2001, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2001
FILL( 993945600,2001, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2001
FILL( 1009843200,2002, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2002
FILL( 1025481600,2002, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2002
FILL( 1041379200,2003, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2003
FILL( 1057017600,2003, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2003
FILL( 1072915200,2004, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2004
FILL( 1088640000,2004, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2004
FILL( 1104537600,2005, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2005
FILL( 1120176000,2005, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2005
FILL( 1136073600,2006, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2006
FILL( 1151712000,2006, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2006
FILL( 1167609600,2007, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2007
FILL( 1183248000,2007, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2007
FILL( 1199145600,2008, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2008
FILL( 1214870400,2008, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2008
FILL( 1230768000,2009, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2009
FILL( 1246406400,2009, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2009
FILL( 1262304000,2010, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2010
FILL( 1277942400,2010, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2010
FILL( 1293840000,2011, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2011
FILL( 1309478400,2011, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2011
FILL( 1311242220,2011, 7,21,4, 9,57, 0), // Thu Jul 21 09:57:00 UTC 2011
FILL( 1325376000,2012, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2012
FILL( 1341100800,2012, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2012
FILL( 1356998400,2013, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2013
FILL( 1372636800,2013, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2013
FILL( 1388534400,2014, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2014
FILL( 1404172800,2014, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2014
FILL( 1420070400,2015, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2015
FILL( 1435708800,2015, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2015
FILL( 1451606400,2016, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2016
FILL( 1467331200,2016, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2016
FILL( 1483228800,2017, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2017
FILL( 1498867200,2017, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2017
FILL( 1514764800,2018, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2018
FILL( 1530403200,2018, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2018
FILL( 1546300800,2019, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2019
FILL( 1561939200,2019, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2019
FILL( 1577836800,2020, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2020
FILL( 1593561600,2020, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2020
FILL( 1609459200,2021, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2021
FILL( 1625097600,2021, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2021
FILL( 1640995200,2022, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2022
FILL( 1656633600,2022, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2022
FILL( 1672531200,2023, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2023
FILL( 1688169600,2023, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2023
FILL( 1704067200,2024, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2024
FILL( 1719792000,2024, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2024
FILL( 1735689599,2024,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2024
FILL( 1735689600,2025, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2025
FILL( 1751328000,2025, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2025
FILL( 1767225600,2026, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2026
FILL( 1782864000,2026, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2026
FILL( 1798761600,2027, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2027
FILL( 1814400000,2027, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2027
FILL( 1830297600,2028, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2028
FILL( 1846022400,2028, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2028
FILL( 1861920000,2029, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2029
FILL( 1877558400,2029, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2029
FILL( 1893456000,2030, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2030
FILL( 1909094400,2030, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2030
FILL( 2147483647,2038, 1,19,2, 3,14, 7), // Tue Jan 19 03:14:07 UTC 2038
FILL( 2147483648,2038, 1,19,2, 3,14, 8), // Tue Jan 19 03:14:08 UTC 2038
FILL( 2524607999,2049,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2049
FILL( 2524608000,2050, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2050
FILL( 2556144000,2051, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2051
FILL( 2942956800,2063, 4, 5,4, 0, 0, 0), // Thu Apr 5 00:00:00 UTC 2063
FILL( 3313526399,2074,12,31,1,23,59,59), // Mon Dec 31 23:59:59 UTC 2074
FILL( 3313526400,2075, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2075
FILL( 3345062400,2076, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2076
FILL( 4102444799,2099,12,31,4,23,59,59), // Thu Dec 31 23:59:59 UTC 2099
FILL( 4102444800,2100, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2100
FILL( 4133980800,2101, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2101
FILL( 4891363199,2124,12,31,0,23,59,59), // Sun Dec 31 23:59:59 UTC 2124
FILL( 4891363200,2125, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2125
FILL( 4922899200,2126, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2126
FILL( 5680281599,2149,12,31,3,23,59,59), // Wed Dec 31 23:59:59 UTC 2149
FILL( 5680281600,2150, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2150
FILL( 5711817600,2151, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2151
FILL( 6469199999,2174,12,31,6,23,59,59), // Sat Dec 31 23:59:59 UTC 2174
FILL( 6469200000,2175, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2175
FILL( 6500736000,2176, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2176
FILL( 7258118399,2199,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2199
FILL( 7258118400,2200, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2200
FILL( 7289654400,2201, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2201
FILL( 8047036799,2224,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2224
FILL( 8047036800,2225, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2225
FILL( 8078572800,2226, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2226
FILL( 8835955199,2249,12,31,1,23,59,59), // Mon Dec 31 23:59:59 UTC 2249
FILL( 8835955200,2250, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2250
FILL( 8867491200,2251, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2251
FILL( 9624873599,2274,12,31,4,23,59,59), // Thu Dec 31 23:59:59 UTC 2274
FILL( 9624873600,2275, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2275
FILL( 9656409600,2276, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2276
FILL(10413791999,2299,12,31,0,23,59,59), // Sun Dec 31 23:59:59 UTC 2299
FILL(10413792000,2300, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2300
FILL(10445328000,2301, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2301
FILL(11202710399,2324,12,31,3,23,59,59), // Wed Dec 31 23:59:59 UTC 2324
FILL(11202710400,2325, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2325
FILL(11234246400,2326, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2326
FILL(11991628799,2349,12,31,6,23,59,59), // Sat Dec 31 23:59:59 UTC 2349
FILL(11991628800,2350, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2350
FILL(12023164800,2351, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2351
FILL(12780547199,2374,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2374
FILL(12780547200,2375, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2375
FILL(12812083200,2376, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2376
FILL(13569465599,2399,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2399
FILL(13569465600,2400, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2400
FILL(13601088000,2401, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2401
FILL(14358470399,2424,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2424
FILL(14358470400,2425, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2425
FILL(14390006400,2426, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2426
FILL(15147388799,2449,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2449
FILL(15147388800,2450, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2450
FILL(15178924800,2451, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2451
FILL(15936307199,2474,12,31,1,23,59,59), // Mon Dec 31 23:59:59 UTC 2474
FILL(15936307200,2475, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2475
FILL(15967843200,2476, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2476
FILL(16725225599,2499,12,31,4,23,59,59), // Thu Dec 31 23:59:59 UTC 2499
FILL(16725225600,2500, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2500
FILL(16756761600,2501, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2501
FILL(17514143999,2524,12,31,0,23,59,59), // Sun Dec 31 23:59:59 UTC 2524
FILL(17514144000,2525, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2525
FILL(17545680000,2526, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2526
FILL(18303062399,2549,12,31,3,23,59,59), // Wed Dec 31 23:59:59 UTC 2549
FILL(18303062400,2550, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2550
FILL(18334598400,2551, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2551
FILL(19091980799,2574,12,31,6,23,59,59), // Sat Dec 31 23:59:59 UTC 2574
FILL(19091980800,2575, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2575
FILL(19123516800,2576, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2576
FILL(19880899199,2599,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2599
FILL(19880899200,2600, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2600
FILL(19912435200,2601, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2601
};
#undef FILL
ATF_TC(ymdhms_to_secs);
ATF_TC_HEAD(ymdhms_to_secs, tc)
{
atf_tc_set_md_var(tc, "descr", "check clock_ymdhms_to_secs");
}
ATF_TC_BODY(ymdhms_to_secs, tc)
{
time_t secs;
size_t i;
for (i = 0; i < __arraycount(clock_tests); i++) {
secs = clock_ymdhms_to_secs(__UNCONST(&clock_tests[i].clock));
ATF_CHECK_EQ_MSG(clock_tests[i].time, secs, "%jd != %jd",
(intmax_t)clock_tests[i].time, (intmax_t)secs);
}
}
ATF_TC(secs_to_ymdhms);
ATF_TC_HEAD(secs_to_ymdhms, tc)
{
atf_tc_set_md_var(tc, "descr", "check clock_secs_to_ymdhms");
}
ATF_TC_BODY(secs_to_ymdhms, tc)
{
struct clock_ymdhms ymdhms;
size_t i;
#define CHECK_FIELD(f) \
ATF_CHECK_EQ_MSG(ymdhms.dt_##f, clock_tests[i].clock.dt_##f, \
"%jd != %jd for %jd", (intmax_t)ymdhms.dt_##f, \
(intmax_t)clock_tests[i].clock.dt_##f, \
(intmax_t)clock_tests[i].time)
for (i = 0; i < __arraycount(clock_tests); i++) {
clock_secs_to_ymdhms(clock_tests[i].time, &ymdhms);
CHECK_FIELD(year);
CHECK_FIELD(mon);
CHECK_FIELD(day);
CHECK_FIELD(wday);
CHECK_FIELD(hour);
CHECK_FIELD(min);
CHECK_FIELD(sec);
}
#undef CHECK_FIELD
}
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, ymdhms_to_secs);
ATF_TP_ADD_TC(tp, secs_to_ymdhms);
return atf_no_error();
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_cd.c,v 1.7 2014/04/25 00:24:39 pooka Exp $ */
/* $NetBSD: t_cd.c,v 1.8 2017/01/13 21:30:39 christos Exp $ */
/*
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@ -39,7 +39,7 @@
#include "scsitest.h"
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(noisyeject);
ATF_TC_HEAD(noisyeject, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_swwdog.c,v 1.6 2015/04/23 04:49:37 pgoyette Exp $ */
/* $NetBSD: t_swwdog.c,v 1.7 2017/01/13 21:30:39 christos Exp $ */
/*
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@ -43,7 +43,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
static volatile sig_atomic_t tcount;

View File

@ -1,4 +1,4 @@
/* $NetBSD: h_fsmacros.h,v 1.40 2015/08/29 19:19:43 dholland Exp $ */
/* $NetBSD: h_fsmacros.h,v 1.41 2017/01/13 21:30:39 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -40,7 +40,7 @@
#include <rump/rump.h>
#include "../../h_macros.h"
#include "h_macros.h"
#define FSPROTOS(_fs_) \
int _fs_##_fstest_newfs(const atf_tc_t *, void **, const char *, \

View File

@ -1,4 +1,4 @@
/* $NetBSD: h_quota2_tests.c,v 1.4 2012/09/30 21:26:57 bouyer Exp $ */
/* $NetBSD: h_quota2_tests.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */
/*
* rump server for advanced quota tests
@ -22,7 +22,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
int background = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_fifos.c,v 1.5 2010/11/07 17:51:17 jmmv Exp $ */
/* $NetBSD: t_fifos.c,v 1.6 2017/01/13 21:30:39 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -17,7 +17,7 @@
#include <ufs/ufs/ufsmount.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC_WITH_CLEANUP(fifos);
ATF_TC_HEAD(fifos, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_mount.c,v 1.13 2012/11/27 16:01:49 jakllsch Exp $ */
/* $NetBSD: t_mount.c,v 1.14 2017/01/13 21:30:39 christos Exp $ */
/*
* Basic tests for mounting
@ -25,7 +25,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(48Kimage);
ATF_TC_HEAD(48Kimage, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_quota2_1.c,v 1.4 2012/03/15 02:02:22 joerg Exp $ */
/* $NetBSD: t_quota2_1.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */
/*
* Basic tests for quota2
@ -18,7 +18,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
static void
do_quota(const atf_tc_t *tc, int n, const char *newfs_opts, int log)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_quota2_remount.c,v 1.4 2012/03/15 02:02:22 joerg Exp $ */
/* $NetBSD: t_quota2_remount.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */
/*
* Basic tests for quota2
@ -19,7 +19,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
static void
do_quota(const atf_tc_t *tc, int n, const char *newfs_opts, int log)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_snapshot.c,v 1.6 2013/02/06 09:05:01 hannken Exp $ */
/* $NetBSD: t_snapshot.c,v 1.7 2017/01/13 21:30:39 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -15,7 +15,7 @@
#include <string.h>
#include <unistd.h>
#include "../../h_macros.h"
#include "h_macros.h"
#define IMGNAME "ffs.img"
#define NEWFS "newfs -F -s 10000 " IMGNAME

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_snapshot_log.c,v 1.2 2013/02/06 09:05:01 hannken Exp $ */
/* $NetBSD: t_snapshot_log.c,v 1.3 2017/01/13 21:30:39 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -15,7 +15,7 @@
#include <string.h>
#include <unistd.h>
#include "../../h_macros.h"
#include "h_macros.h"
#define IMGNAME "ffs.img"
#define NEWFS "newfs -F -s 10000 " IMGNAME

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_snapshot_v2.c,v 1.2 2013/02/06 09:05:01 hannken Exp $ */
/* $NetBSD: t_snapshot_v2.c,v 1.3 2017/01/13 21:30:39 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -15,7 +15,7 @@
#include <string.h>
#include <unistd.h>
#include "../../h_macros.h"
#include "h_macros.h"
#define IMGNAME "ffs.img"
#define NEWFS "newfs -F -s 10000 -O 2 " IMGNAME

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_pathconvert.c,v 1.5 2011/02/25 20:54:18 martin Exp $ */
/* $NetBSD: t_pathconvert.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -18,7 +18,7 @@
#include <fs/hfs/hfs.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(colonslash);
ATF_TC_HEAD(colonslash, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_basic.c,v 1.3 2010/05/31 23:44:54 pooka Exp $ */
/* $NetBSD: t_basic.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -20,7 +20,7 @@
#include <miscfs/kernfs/kernfs.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(getdents);
ATF_TC_HEAD(getdents, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_pr.c,v 1.6 2011/02/22 18:41:05 pooka Exp $ */
/* $NetBSD: t_pr.c,v 1.7 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -17,7 +17,7 @@
#include <ufs/ufs/ufsmount.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(mknod);
ATF_TC_HEAD(mknod, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_snapshot.c,v 1.3 2014/06/10 13:15:18 martin Exp $ */
/* $NetBSD: t_snapshot.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -17,7 +17,7 @@
#include <string.h>
#include <unistd.h>
#include "../../h_macros.h"
#include "h_macros.h"
#define IMGNAME "msdosfs.img"
#define NEWFS "newfs_msdos -C 5M " IMGNAME

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_mountd.c,v 1.5 2012/02/24 13:53:46 joerg Exp $ */
/* $NetBSD: t_mountd.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
#include "../common/h_fsmacros.h"
ATF_TC(mountdhup);

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_basic.c,v 1.3 2010/06/09 08:37:16 pooka Exp $ */
/* $NetBSD: t_basic.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -18,7 +18,7 @@
#include <miscfs/nullfs/null.h>
#include <fs/tmpfs/tmpfs_args.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(basic);
ATF_TC_HEAD(basic, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_nullpts.c,v 1.5 2011/01/10 11:11:04 hannken Exp $ */
/* $NetBSD: t_nullpts.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -19,7 +19,7 @@
#include <fs/ptyfs/ptyfs.h>
#include <miscfs/nullfs/null.h>
#include "../../h_macros.h"
#include "h_macros.h"
static void
mountptyfs(const char *mp, int flags)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_ptyfs.c,v 1.1 2010/06/11 23:52:38 pooka Exp $ */
/* $NetBSD: t_ptyfs.c,v 1.2 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -17,7 +17,7 @@
#include <fs/ptyfs/ptyfs.h>
#include "../../h_macros.h"
#include "h_macros.h"
static void
mountptyfs(const char *mp, int flags)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_basic.c,v 1.13 2016/12/01 14:49:04 hannken Exp $ */
/* $NetBSD: t_basic.c,v 1.14 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -20,7 +20,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
#include "../common/h_fsmacros.h"
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_fuzz.c,v 1.5 2012/04/21 01:03:46 manu Exp $ */
/* $NetBSD: t_fuzz.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -56,7 +56,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
#define ITERATIONS 100

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_io.c,v 1.1 2010/11/12 17:33:28 pooka Exp $ */
/* $NetBSD: t_io.c,v 1.2 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -20,7 +20,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../../h_macros.h"
#include "h_macros.h"
#include "../common/h_fsmacros.h"
#define MAKEOPTS(...) \

View File

@ -106,15 +106,7 @@ pipe_body() {
test_mount
umask 022
# Begin FreeBSD
if true; then
atf_check -s eq:0 -o empty -e empty mkfifo pipe
else
# End FreeBSD
atf_check -s eq:0 -o empty -e empty mknod pipe p
# Begin FreeBSD
fi
# End FreeBSD
eval $(stat -s pipe)
[ ${st_mode} = 010644 ] || atf_fail "Invalid mode"
@ -132,15 +124,7 @@ pipe_kqueue_body() {
umask 022
atf_check -s eq:0 -o empty -e empty mkdir dir
# Begin FreeBSD
if true; then
echo 'mkfifo dir/pipe' | kqueue_monitor 1 dir
else
# End FreeBSD
echo 'mknod dir/pipe p' | kqueue_monitor 1 dir
# Begin FreeBSD
fi
# End FreeBSD
kqueue_check dir NOTE_WRITE
test_unmount

View File

@ -59,15 +59,7 @@ types_body() {
atf_check -s eq:0 -o empty -e empty ln -s reg lnk
atf_check -s eq:0 -o empty -e empty mknod blk b 0 0
atf_check -s eq:0 -o empty -e empty mknod chr c 0 0
# Begin FreeBSD
if true; then
atf_check -s eq:0 -o empty -e empty mkfifo fifo
else
# End FreeBSD
atf_check -s eq:0 -o empty -e empty mknod fifo p
# Begin FreeBSD
fi
# End FreeBSD
atf_check -s eq:0 -o empty -e empty \
$(atf_get_srcdir)/h_tools sockets sock

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_renamerace.c,v 1.13 2011/08/18 21:44:55 riastradh Exp $ */
/* $NetBSD: t_renamerace.c,v 1.14 2017/01/13 21:30:40 christos Exp $ */
/*
* Modified for rump and atf from a program supplied
@ -23,7 +23,7 @@
#include <fs/tmpfs/tmpfs_args.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(renamerace2);
ATF_TC_HEAD(renamerace2, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_basic.c,v 1.4 2010/07/19 15:35:39 pooka Exp $ */
/* $NetBSD: t_basic.c,v 1.5 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/param.h>
@ -20,7 +20,7 @@
#include <fs/tmpfs/tmpfs_args.h>
#include <miscfs/umapfs/umap.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(basic);
ATF_TC_HEAD(basic, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_pr.c,v 1.8 2011/08/10 06:27:02 hannken Exp $ */
/* $NetBSD: t_pr.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -17,7 +17,7 @@
#include <miscfs/union/union.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(multilayer);
ATF_TC_HEAD(multilayer, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_full.c,v 1.8 2013/03/16 05:45:37 jmmv Exp $ */
/* $NetBSD: t_full.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
#include "../../h_macros.h"
#include "h_macros.h"
/*
* Write this much over the image size. This is to force an NFS commit,

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_io.c,v 1.16 2015/04/04 12:34:44 riastradh Exp $ */
/* $NetBSD: t_io.c,v 1.17 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
#include "../../h_macros.h"
#include "h_macros.h"
#define TESTSTR "this is a string. collect enough and you'll have Em"
#define TESTSZ sizeof(TESTSTR)

View 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)");

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_renamerace.c,v 1.33 2016/05/04 08:30:22 dholland Exp $ */
/* $NetBSD: t_renamerace.c,v 1.34 2017/01/13 21:30:40 christos Exp $ */
/*
* Modified for rump and atf from a program supplied
@ -34,7 +34,7 @@
#define FSTEST_IMGSIZE (50000 * 512)
#include "../common/h_fsmacros.h"
#include "../../h_macros.h"
#include "h_macros.h"
static volatile int quittingtime;
pid_t wrkpid;

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_ro.c,v 1.5 2011/02/22 21:23:19 yamt Exp $ */
/* $NetBSD: t_ro.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
#include "../../h_macros.h"
#include "h_macros.h"
#define AFILE "testfile"
#define ADIR "testdir"

View 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();
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_union.c,v 1.8 2011/08/07 06:01:51 hannken Exp $ */
/* $NetBSD: t_union.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -17,7 +17,7 @@
#include <miscfs/union/union.h>
#include "../../h_macros.h"
#include "h_macros.h"
#include "../common/h_fsmacros.h"
#define MSTR "magic bus"

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_unpriv.c,v 1.12 2015/04/09 19:51:13 riastradh Exp $ */
/* $NetBSD: t_unpriv.c,v 1.13 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
#include "../../h_macros.h"
#include "h_macros.h"
#define USES_OWNER \
if (FSTYPE_MSDOS(tc)) \

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_vfsops.c,v 1.11 2011/04/04 19:16:58 hannken Exp $ */
/* $NetBSD: t_vfsops.c,v 1.12 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
#include "../../h_macros.h"
#include "h_macros.h"
static void
tmount(const atf_tc_t *tc, const char *path)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_vnops.c,v 1.58 2016/08/29 02:31:46 kre Exp $ */
/* $NetBSD: t_vnops.c,v 1.59 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
#include "../../h_macros.h"
#include "h_macros.h"
#define TESTFILE "afile"

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_socket.c,v 1.4 2015/02/27 08:30:30 martin Exp $ */
/* $NetBSD: t_socket.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@ -18,7 +18,7 @@
#include <unistd.h>
#include <util.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(cmsg_sendfd_bounds);
ATF_TC_HEAD(cmsg_sendfd_bounds, tc)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
/* $NetBSD: t_ptrace_wait3.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
/*-
* Copyright (c) 2016 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.
*/
#define TWAIT_WAIT3
#include "t_ptrace_wait.c"

View File

@ -0,0 +1,30 @@
/* $NetBSD: t_ptrace_wait4.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
/*-
* Copyright (c) 2016 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.
*/
#define TWAIT_WAIT4
#include "t_ptrace_wait.c"

View File

@ -0,0 +1,30 @@
/* $NetBSD: t_ptrace_wait6.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
/*-
* Copyright (c) 2016 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.
*/
#define TWAIT_WAIT6
#include "t_ptrace_wait.c"

View File

@ -0,0 +1,30 @@
/* $NetBSD: t_ptrace_waitid.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
/*-
* Copyright (c) 2016 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.
*/
#define TWAIT_WAITID
#include "t_ptrace_wait.c"

View File

@ -0,0 +1,30 @@
/* $NetBSD: t_ptrace_waitpid.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
/*-
* Copyright (c) 2016 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.
*/
#define TWAIT_WAITPID
#include "t_ptrace_wait.c"

View File

@ -0,0 +1,141 @@
/* $NetBSD: t_ptrace_wait.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2016 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>
__RCSID("$NetBSD: t_ptrace_wait.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/param.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/wait.h>
#include <machine/reg.h>
#include <err.h>
#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <atf-c.h>
#include "h_macros.h"
#include "../../t_ptrace_wait.h"
#if defined(HAVE_GPREGS)
ATF_TC(regs1);
ATF_TC_HEAD(regs1, tc)
{
atf_tc_set_md_var(tc, "descr",
"Call PT_GETREGS and iterate over General Purpose registers");
}
ATF_TC_BODY(regs1, tc)
{
const int exitval = 5;
const int sigval = SIGSTOP;
pid_t child, wpid;
#if defined(TWAIT_HAVE_STATUS)
int status;
#endif
struct reg r;
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);
printf("Call GETREGS for the child process\n");
ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1);
printf("EAX=%#" PRIxREGISTER "\n", r.r_eax);
printf("EBX=%#" PRIxREGISTER "\n", r.r_ebx);
printf("ECX=%#" PRIxREGISTER "\n", r.r_ecx);
printf("EDX=%#" PRIxREGISTER "\n", r.r_edx);
printf("ESP=%#" PRIxREGISTER "\n", r.r_esp);
printf("EBP=%#" PRIxREGISTER "\n", r.r_ebp);
printf("ESI=%#" PRIxREGISTER "\n", r.r_esi);
printf("EDI=%#" PRIxREGISTER "\n", r.r_edi);
printf("EIP=%#" PRIxREGISTER "\n", r.r_eip);
printf("EFLAGS=%#" PRIxREGISTER "\n", r.r_eflags);
printf("CS=%#" PRIxREGISTER "\n", r.r_cs);
printf("SS=%#" PRIxREGISTER "\n", r.r_ss);
printf("DS=%#" PRIxREGISTER "\n", r.r_ds);
printf("ES=%#" PRIxREGISTER "\n", r.r_es);
printf("FS=%#" PRIxREGISTER "\n", r.r_fs);
printf("GS=%#" PRIxREGISTER "\n", r.r_gs);
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));
}
#endif
ATF_TP_ADD_TCS(tp)
{
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs1);
return atf_no_error();
}

View File

@ -0,0 +1,30 @@
/* $NetBSD: t_ptrace_wait3.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
/*-
* Copyright (c) 2016 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.
*/
#define TWAIT_WAIT3
#include "t_ptrace_wait.c"

View File

@ -0,0 +1,30 @@
/* $NetBSD: t_ptrace_wait4.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
/*-
* Copyright (c) 2016 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.
*/
#define TWAIT_WAIT4
#include "t_ptrace_wait.c"

View File

@ -0,0 +1,30 @@
/* $NetBSD: t_ptrace_wait6.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
/*-
* Copyright (c) 2016 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.
*/
#define TWAIT_WAIT6
#include "t_ptrace_wait.c"

View File

@ -0,0 +1,30 @@
/* $NetBSD: t_ptrace_waitid.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
/*-
* Copyright (c) 2016 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.
*/
#define TWAIT_WAITID
#include "t_ptrace_wait.c"

View File

@ -0,0 +1,30 @@
/* $NetBSD: t_ptrace_waitpid.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
/*-
* Copyright (c) 2016 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.
*/
#define TWAIT_WAITPID
#include "t_ptrace_wait.c"

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */
/* $NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
__RCSID("$NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/stat.h>
@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
#include <atf-c.h>
#include "../../../h_macros.h"
#include "h_macros.h"
#define FIFONAME "fifo"

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_file.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */
/* $NetBSD: t_file.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_file.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
__RCSID("$NetBSD: t_file.c,v 1.4 2017/01/13 21:30:41 christos Exp $");
#include <sys/param.h>
#include <sys/event.h>
@ -50,7 +50,7 @@ __RCSID("$NetBSD: t_file.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
#include <atf-c.h>
#include "../../../h_macros.h"
#include "h_macros.h"
#define FILENAME "file"
#define NLINES 5

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_file2.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */
/* $NetBSD: t_file2.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_file2.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
__RCSID("$NetBSD: t_file2.c,v 1.4 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
@ -41,7 +41,7 @@ __RCSID("$NetBSD: t_file2.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
#include <atf-c.h>
#include "../../../h_macros.h"
#include "h_macros.h"
ATF_TC(file2);
ATF_TC_HEAD(file2, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */
/* $NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
__RCSID("$NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
@ -41,7 +41,7 @@ __RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
#include <atf-c.h>
#include "../../../h_macros.h"
#include "h_macros.h"
ATF_TC(pipe);
ATF_TC_HEAD(pipe, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */
/* $NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
__RCSID("$NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/wait.h>
@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
#include <atf-c.h>
#include "../../../h_macros.h"
#include "h_macros.h"
static void
h_check(bool check_master)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_ioctl.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */
/* $NetBSD: t_ioctl.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_ioctl.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
__RCSID("$NetBSD: t_ioctl.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/ioctl.h>
@ -42,7 +42,7 @@ __RCSID("$NetBSD: t_ioctl.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
#include <atf-c.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(kfilter_byfilter);
ATF_TC_HEAD(kfilter_byfilter, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_proc1.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */
/* $NetBSD: t_proc1.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_proc1.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
__RCSID("$NetBSD: t_proc1.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
/*
* this also used to trigger problem fixed in
@ -51,7 +51,7 @@ __RCSID("$NetBSD: t_proc1.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
#include <atf-c.h>
#include "../../h_macros.h"
#include "h_macros.h"
static int
child(void)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */
/* $NetBSD: t_proc2.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -32,11 +32,8 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
__RCSID("$NetBSD: t_proc2.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include <sys/event.h>
#include <sys/time.h>
#include <sys/types.h>
@ -50,7 +47,7 @@ __RCSID("$NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
#include <atf-c.h>
#include "../../h_macros.h"
#include "h_macros.h"
static void
child_two(void)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */
/* $NetBSD: t_proc3.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@ -30,11 +30,8 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
__RCSID("$NetBSD: t_proc3.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include <sys/event.h>
#include <sys/time.h>
#include <sys/types.h>
@ -48,7 +45,7 @@ __RCSID("$NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
#include <atf-c.h>
#include "../../h_macros.h"
#include "h_macros.h"
ATF_TC(proc3);
ATF_TC_HEAD(proc3, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $ */
/* $NetBSD: t_sig.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@ -32,11 +32,8 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $");
__RCSID("$NetBSD: t_sig.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include <sys/event.h>
#include <sys/ioctl.h>
#include <sys/param.h>
@ -51,7 +48,7 @@ __RCSID("$NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $");
#include <atf-c.h>
#include "../../h_macros.h"
#include "h_macros.h"
#define NSIGNALS 5

View File

@ -1,6 +1,3 @@
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include <sys/event.h>
#include <sys/stat.h>
#include <sys/time.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */
/* $NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
__RCSID("$NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/stat.h>
@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
#include <atf-c.h>
#include "../../../h_macros.h"
#include "h_macros.h"
#define FIFONAME "fifo"

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */
/* $NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
__RCSID("$NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/wait.h>
@ -44,7 +44,7 @@ __RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
#include <atf-c.h>
#include "../../../h_macros.h"
#include "h_macros.h"
ATF_TC(pipe1);
ATF_TC_HEAD(pipe1, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:58 jmmv Exp $ */
/* $NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:58 jmmv Exp $");
__RCSID("$NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/wait.h>
@ -47,7 +47,7 @@ __RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:58 jmmv Exp $");
#include <atf-c.h>
#include "../../../h_macros.h"
#include "h_macros.h"
static void
h_check(bool check_master)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_extent.c,v 1.4 2012/01/27 18:53:10 para Exp $ */
/* $NetBSD: t_extent.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_extent.c,v 1.4 2012/01/27 18:53:10 para Exp $");
__RCSID("$NetBSD: t_extent.c,v 1.5 2017/01/13 21:30:41 christos Exp $");
#include <sys/types.h>
#include <sys/queue.h>
@ -41,7 +41,7 @@ __RCSID("$NetBSD: t_extent.c,v 1.4 2012/01/27 18:53:10 para Exp $");
#include <atf-c.h>
#include "../h_macros.h"
#include "h_macros.h"
static int ret;
static struct extent *ex;

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_filedesc.c,v 1.5 2012/03/18 09:46:50 jruoho Exp $ */
/* $NetBSD: t_filedesc.c,v 1.6 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_filedesc.c,v 1.5 2012/03/18 09:46:50 jruoho Exp $");
__RCSID("$NetBSD: t_filedesc.c,v 1.6 2017/01/13 21:30:41 christos Exp $");
#include <sys/types.h>
@ -40,7 +40,7 @@ __RCSID("$NetBSD: t_filedesc.c,v 1.5 2012/03/18 09:46:50 jruoho Exp $");
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../h_macros.h"
#include "h_macros.h"
ATF_TC(getfilerace);
ATF_TC_HEAD(getfilerace, tc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_lock.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */
/* $NetBSD: t_lock.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_lock.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
__RCSID("$NetBSD: t_lock.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/time.h>
@ -38,7 +38,7 @@ __RCSID("$NetBSD: t_lock.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
#include <atf-c.h>
#include "../h_macros.h"
#include "h_macros.h"
__cpu_simple_lock_t lk;
volatile int handled = 0;

View File

@ -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

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $ */
/* $NetBSD: t_ptrace.c,v 1.18 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $");
__RCSID("$NetBSD: t_ptrace.c,v 1.18 2017/01/13 21:30:41 christos Exp $");
#include <sys/param.h>
#include <sys/types.h>
@ -40,7 +40,7 @@ __RCSID("$NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $");
#include <atf-c.h>
#include "../h_macros.h"
#include "h_macros.h"
/*
* A child process cannot call atf functions and expect them to magically

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $Id: t_pty.c,v 1.1 2011/09/24 15:53:01 christos Exp $ */
/* $Id: t_pty.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*
* Allocates a pty(4) device, and sends the specified number of packets of the
@ -9,7 +9,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_pty.c,v 1.1 2011/09/24 15:53:01 christos Exp $");
__RCSID("$NetBSD: t_pty.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <errno.h>
#include <err.h>
@ -35,7 +35,7 @@ static __dead void usage(const char *);
static void parse_args(int, char **);
#else
#include <atf-c.h>
#include "../h_macros.h"
#include "h_macros.h"
#endif
static int pty_open(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_rnd.c,v 1.9 2016/05/22 04:34:44 riastradh Exp $ */
/* $NetBSD: t_rnd.c,v 1.10 2017/01/13 21:30:41 christos Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_rnd.c,v 1.9 2016/05/22 04:34:44 riastradh Exp $");
__RCSID("$NetBSD: t_rnd.c,v 1.10 2017/01/13 21:30:41 christos Exp $");
#include <sys/types.h>
#include <sys/fcntl.h>
@ -39,7 +39,7 @@ __RCSID("$NetBSD: t_rnd.c,v 1.9 2016/05/22 04:34:44 riastradh Exp $");
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include "../h_macros.h"
#include "h_macros.h"
ATF_TC(RNDADDDATA);
ATF_TC_HEAD(RNDADDDATA, tc)

View File

@ -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)

View File

@ -42,18 +42,10 @@ dict()
elif [ -f /usr/dict/words ]; then
echo /usr/dict/words
else
echo ""
atf_fail "no dictionary found"
fi
}
# Begin FreeBSD
dict()
{
echo /usr/share/dict/words
}
# End FreeBSD
SEVEN_SEVEN="abcdefg|abcdefg|abcdefg|abcdefg|abcdefg|abcdefg|abcdefg"
atf_test_case small_btree

View File

@ -0,0 +1,90 @@
/* $NetBSD: t_exect.c,v 1.6 2016/12/12 10:34:55 joerg Exp $ */
/*-
* Copyright (c) 2014 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 <atf-c.h>
#include <errno.h>
#include <signal.h>
#include <stddef.h>
#include <stdio.h>
#include <unistd.h>
ATF_TC(t_exect_null);
ATF_TC_HEAD(t_exect_null, tc)
{
atf_tc_set_md_var(tc, "descr",
"Tests an empty exect(2) executing");
}
static volatile sig_atomic_t caught = 0;
static void
sigtrap_handler(int sig, siginfo_t *info, void *ctx)
{
ATF_REQUIRE_EQ(sig, SIGTRAP);
ATF_REQUIRE_EQ(info->si_code, TRAP_TRACE);
++caught;
}
ATF_TC_BODY(t_exect_null, tc)
{
struct sigaction act;
/*
* Currently exect(3) is misdesigned -- see PR port-amd64/51700 and it
* needs to be redone from scratch.
*
* This test affects amd64 releng machines causing tests to hang or
* fail. As there is little point to test interface that is still not,
* designed and implemented and is breaking tests - skip it
* unconditionally for all ports.
*/
/* Prevent static analysis from requiring t_exec_null to be __dead. */
if (!caught)
atf_tc_skip("exect(3) misdesigned and hangs - PR port-amd64/51700");
ATF_REQUIRE(sigemptyset(&act.sa_mask) == 0);
act.sa_sigaction = sigtrap_handler;
act.sa_flags = SA_SIGINFO;
ATF_REQUIRE(sigaction(SIGTRAP, &act, 0) == 0);
ATF_REQUIRE_ERRNO(EFAULT, exect(NULL, NULL, NULL) == -1);
ATF_REQUIRE_EQ_MSG(caught, 1, "expected caught (1) != received (%d)",
(int)caught);
}
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, t_exect_null);
return atf_no_error();
}

View File

@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/param.h>
#include <atf-c.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -119,6 +119,11 @@ ATF_TC_BODY(floatunditf, tc)
#else
size_t i;
#if defined(__FreeBSD__) && defined(__i386__)
atf_tc_expect_fail("the floating point error on FreeBSD/i386 doesn't "
"match the expected floating point error on NetBSD");
#endif
for (i = 0; i < __arraycount(testcases); ++i)
ATF_CHECK_MSG(
testcases[i].ld == (long double)testcases[i].u64,

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin 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.3 2013/01/02 11:28:48 martin Exp $");
__RCSID("$NetBSD: t_glob.c,v 1.5 2017/01/14 20:47:41 christos Exp $");
#include <atf-c.h>
@ -46,13 +46,7 @@ __RCSID("$NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $");
#include <string.h>
#include <errno.h>
#ifdef __FreeBSD__
#include "h_macros.h"
#define __gl_stat_t struct stat
#define _S_IFDIR S_IFDIR
#else
#include "../../../h_macros.h"
#endif
#ifdef DEBUG
@ -91,7 +85,7 @@ static struct gl_dir d[] = {
{ "a/b", b, __arraycount(b), 0 },
};
#ifndef __FreeBSD__
#ifdef GLOB_STAR
static const char *glob_star[] = {
"a/1", "a/3", "a/4", "a/b", "a/b/w", "a/b/x", "a/b/y", "a/b/z",
};
@ -158,7 +152,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;
}
@ -225,7 +219,7 @@ run(const char *p, int flags, const char **res, size_t len)
}
#ifndef __FreeBSD__
#ifdef GLOB_STAR
ATF_TC(glob_star);
ATF_TC_HEAD(glob_star, tc)
{
@ -274,7 +268,7 @@ ATF_TC_BODY(glob_nocheck, tc)
ATF_TP_ADD_TCS(tp)
{
#ifndef __FreeBSD__
#ifdef GLOB_STAR
ATF_TP_ADD_TC(tp, glob_star);
#endif
ATF_TP_ADD_TC(tp, glob_star_not);

View File

@ -34,11 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __FreeBSD__
#include <libutil.h>
#else
#include <util.h>
#endif
const struct hnopts {
size_t ho_len;

View File

@ -26,10 +26,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef __FreeBSD__
/* kqueue(2) on FreeBSD requires sys/types.h for uintptr_t; NetBSD doesn't. */
#include <sys/types.h>
#endif
#include <sys/cdefs.h>
#include <sys/event.h>
#include <sys/signal.h>

View File

@ -35,13 +35,8 @@
#include <unistd.h>
#include <string.h>
#include <md5.h>
#ifdef __NetBSD__
#include <sha1.h>
#endif
#ifdef __FreeBSD__
#include <sha.h>
#endif
int mflag, rflag, sflag, tflag;
@ -107,32 +102,17 @@ regress(void)
MD5Final(out, &ctx);
outlen = 16;
} else {
#ifdef __FreeBSD__
SHA_CTX ctx;
SHA1_Init(&ctx);
SHA1_Update(&ctx, buf, len);
#else
SHA1_CTX ctx;
SHA1Init(&ctx);
SHA1Update(&ctx, buf, len);
#endif
while (!last &&
fgets((char *)buf, sizeof(buf), stdin) != NULL) {
len = strlen((char *)buf);
CHOMP(buf, len, last);
#ifdef __FreeBSD__
SHA1_Update(&ctx, buf, len);
#else
SHA1Update(&ctx, buf, len);
#endif
}
#ifdef __FreeBSD__
SHA1_Final(out, &ctx);
#else
SHA1Final(out, &ctx);
#endif
outlen = 20;
}
hexdump(out, outlen);

View File

@ -0,0 +1,127 @@
/* $NetBSD: t_hmac.c,v 1.1 2016/07/02 14:52:09 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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>
__RCSID("$NetBSD: t_hmac.c,v 1.1 2016/07/02 14:52:09 christos Exp $");
#include <atf-c.h>
#include <string.h>
#include <stdlib.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
static void
test(void)
{
uint8_t tmp1[EVP_MAX_MD_SIZE];
uint8_t tmp2[EVP_MAX_MD_SIZE];
uint8_t key[256];
uint8_t data[4096];
unsigned int tmp1len;
size_t tmp2len;
int stop;
void *e1;
const void *evps[] = {
EVP_md2(),
EVP_md4(),
EVP_md5(),
EVP_ripemd160(),
EVP_sha1(),
EVP_sha224(),
EVP_sha256(),
EVP_sha384(),
EVP_sha512(),
};
const char *names[] = {
"md2",
"md4",
"md5",
"rmd160",
"sha1",
"sha224",
"sha256",
"sha384",
"sha512",
};
for (size_t k = 0; k < sizeof(key); k++)
key[k] = k;
for (size_t d = 0; d < sizeof(data); d++)
data[d] = d % 256;
for (size_t t = 0; t < __arraycount(names); t++)
for (size_t i = 1; i < sizeof(key); i += 9)
for (size_t j = 3; j < sizeof(data); j += 111) {
stop = 0;
#ifdef DEBUG
printf("%s: keysize = %zu datasize = %zu\n", names[t],
i, j);
#endif
memset(tmp1, 0, sizeof(tmp1));
memset(tmp2, 0, sizeof(tmp2));
e1 = HMAC(evps[t], key, i, data, j, tmp1, &tmp1len);
ATF_REQUIRE(e1 != NULL);
tmp2len = hmac(names[t], key, i, data, j, tmp2,
sizeof(tmp2));
ATF_REQUIRE_MSG(tmp1len == tmp2len, "hash %s len %u "
"!= %zu", names[t], tmp1len, tmp2len);
for (size_t k = 0; k < tmp2len; k++)
if (tmp1[k] != tmp2[k]) {
#ifdef DEBUG
printf("%zu %.2x %.2x\n",
k, tmp1[k], tmp2[k]);
#endif
stop = 1;
break;
}
ATF_REQUIRE_MSG(!stop, "hash %s failed for "
"keylen=%zu, datalen=%zu", names[t], i, j);
}
}
ATF_TC(t_hmac);
ATF_TC_HEAD(t_hmac, tc)
{
atf_tc_set_md_var(tc, "descr",
"Test hmac functions for consistent results");
}
ATF_TC_BODY(t_hmac, tc)
{
test();
}
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, t_hmac);
return atf_no_error();
}

View File

@ -36,23 +36,9 @@ __RCSID("$NetBSD: t_sha2.c,v 1.3 2012/09/26 22:23:30 joerg Exp $");
#include <atf-c.h>
#include <sys/types.h>
#ifdef __NetBSD__
#include <sha2.h>
#endif
#include <string.h>
#ifdef __FreeBSD__
#include <openssl/sha.h>
typedef SHA512_CTX SHA384_CTX;
/* From /usr/src/crypto/openssh/openbsd-compat/sha2.h */
#define SHA256_DIGEST_LENGTH 32
#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
#define SHA384_DIGEST_LENGTH 48
#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
#define SHA512_DIGEST_LENGTH 64
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
#endif
ATF_TC(t_sha256);
ATF_TC(t_sha384);
ATF_TC(t_sha512);

View File

@ -57,11 +57,9 @@ ATF_TC_BODY(bad_big5_wprintf, tc)
atf_tc_skip("does not fail as expected (may be implementation "
"specific issue with the test)");
#endif
/* XXX implementation detail knowledge (wchar_t encoding) */
wchar_t ibuf[] = { 0xcf10, 0 };
setlocale(LC_CTYPE, "zh_TW.Big5");
ATF_REQUIRE_ERRNO(EILSEQ, wprintf(L"%ls\n", ibuf) < 0);
ATF_REQUIRE(ferror(stdout));
}
@ -78,12 +76,10 @@ ATF_TC_BODY(bad_big5_swprintf, tc)
atf_tc_skip("does not fail as expected (may be implementation "
"specific issue with the test)");
#endif
/* XXX implementation detail knowledge (wchar_t encoding) */
wchar_t ibuf[] = { 0xcf10, 0 };
wchar_t obuf[20];
setlocale(LC_CTYPE, "zh_TW.Big5");
ATF_REQUIRE_ERRNO(EILSEQ,
swprintf(obuf, sizeof(obuf), L"%ls\n", ibuf) < 0);
}

Some files were not shown because too many files have changed in this diff Show More