Remove atf-ified tests: servent protoent md5sha

This commit is contained in:
pgoyette 2011-01-02 22:10:23 +00:00
parent b159198e21
commit 83238dfab4
12 changed files with 3 additions and 321 deletions

View File

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.70 2011/01/02 03:59:34 pgoyette Exp $
# $NetBSD: Makefile,v 1.71 2011/01/02 22:10:23 pgoyette Exp $
SUBDIR+= atexit citrus db divrem getaddrinfo int_fmtio locale md5sha \
nsdispatch regex rpc servent sys time
SUBDIR+= atexit citrus db divrem getaddrinfo int_fmtio locale \
nsdispatch regex rpc sys time
.include <bsd.own.mk>
.include <bsd.sys.mk>

View File

@ -1,17 +0,0 @@
# $NetBSD: Makefile,v 1.4 2003/09/30 04:20:24 mycroft Exp $
NOMAN= # defined
LDSTATIC= -static
PROG= test
WARNS= 1
# MD5 tests from RFC1321
# SHA1 tests from FIPS-180-1
regress:
./test -r < ${.CURDIR}/md5test-in | diff ${.CURDIR}/md5test-out -
./test -rs < ${.CURDIR}/sha1test-in | diff ${.CURDIR}/sha1test-out -
jot -s "" -b "a" -n 1000000 | ./test -rs | diff ${.CURDIR}/sha1test2-out -
.include <bsd.prog.mk>

View File

@ -1,7 +0,0 @@
a
abc
message digest
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
12345678901234567890123456789012345678901234567890123456789012345678901234567890

View File

@ -1,7 +0,0 @@
d41d8cd98f00b204e9800998ecf8427e
0cc175b9c0f1b6a831c399e269772661
900150983cd24fb0d6963f7d28e17f72
f96b697d7cb7938d525a2f31aaf161d0
c3fcd3d76192e4007dfb496cca67e13b
d174ab98d277d9f5a5611c2c9f419d9f
57edf4a22be3c955ac49da2e2107b67a

View File

@ -1,2 +0,0 @@
abc
abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq

View File

@ -1,2 +0,0 @@
a9993e364706816aba3e25717850c26c9cd0d89d
84983e441c3bd26ebaae4aa1f95129e5e54670f1

View File

@ -1 +0,0 @@
34aa973cd4c4daa4f61eeb2bdbad27316534016f

View File

@ -1,167 +0,0 @@
/* $NetBSD: test.c,v 1.6 2008/04/28 20:23:05 martin Exp $ */
/*-
* Copyright (c) 2000 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.
*/
/*
* Combined MD5/SHA1 time and regression test.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <md5.h>
#include <sha1.h>
int mflag, rflag, sflag, tflag;
static void
usage(void)
{
(void)fprintf(stderr,
"Usage:\t%s -r[ms] < test-file\n"
"\t%s -t[ms]\n",
getprogname(), getprogname());
exit(1);
/* NOTREACHED */
}
static void
hexdump (unsigned char *buf, int len)
{
int i;
for (i=0; i<len; i++) {
printf("%02x", buf[i]);
}
printf("\n");
}
static void
timetest(void)
{
printf("sorry, not yet\n");
}
#define CHOMP(buf, len, last) \
if ((len > 0) && \
(buf[len-1] == '\n')) { \
buf[len-1] = '\0'; \
len--; \
last = 1; \
}
static void
regress(void)
{
unsigned char buf[1024];
unsigned char out[20];
int len, outlen, last;
while (fgets((char *)buf, sizeof(buf), stdin) != NULL) {
last = 0;
len = strlen((char *)buf);
CHOMP(buf, len, last);
if (mflag) {
MD5_CTX ctx;
MD5Init(&ctx);
MD5Update(&ctx, buf, len);
while (!last &&
fgets((char *)buf, sizeof(buf), stdin) != NULL) {
len = strlen((char *)buf);
CHOMP(buf, len, last);
MD5Update(&ctx, buf, len);
}
MD5Final(out, &ctx);
outlen = 16;
} else {
SHA1_CTX ctx;
SHA1Init(&ctx);
SHA1Update(&ctx, buf, len);
while (!last &&
fgets((char *)buf, sizeof(buf), stdin) != NULL) {
len = strlen((char *)buf);
CHOMP(buf, len, last);
SHA1Update(&ctx, buf, len);
}
SHA1Final(out, &ctx);
outlen = 20;
}
hexdump(out, outlen);
}
}
int
main(int argc, char **argv)
{
int ch;
while ((ch = getopt(argc, argv, "mrst")) != -1)
switch (ch) {
case 'm':
mflag = 1;
break;
case 'r':
rflag = 1;
break;
case 's':
sflag = 1;
break;
case 't':
tflag = 1;
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;
if (argc > 0)
usage();
if (!(mflag || sflag))
mflag = 1;
if ((mflag ^ sflag) != 1)
usage();
if ((tflag ^ rflag) != 1)
usage();
if (tflag)
timetest();
if (rflag)
regress();
exit(0);
}

View File

@ -1,10 +0,0 @@
# $NetBSD: Makefile,v 1.3 2004/03/02 14:27:25 drochner Exp $
NOMAN= # defined
PROG= protoent
regress: ${PROG}
${.CURDIR}/../servent/compare /etc/protocols ${.OBJDIR}/${PROG}
.include <bsd.prog.mk>

View File

@ -1,23 +0,0 @@
#include <netdb.h>
#include <stdint.h>
#include <netinet/in.h>
int
main(int argc, char *argv[])
{
struct protoent_data pvd;
struct protoent *pvp, pv;
char **pp;
(void)memset(&pvd, 0, sizeof(pvd));
setprotoent_r(0, &pvd);
while ((pvp = getprotoent_r(&pv, &pvd)) != NULL) {
printf("name=%s, port=%d, aliases=",
pvp->p_name, pvp->p_proto);
for (pp = pvp->p_aliases; *pp; pp++)
printf("%s ", *pp);
printf("\n");
}
endprotoent_r(&pvd);
return 0;
}

View File

@ -1,10 +0,0 @@
# $NetBSD: Makefile,v 1.4 2004/03/02 14:27:25 drochner Exp $
NOMAN= # defined
PROG= servent
regress: ${PROG}
${.CURDIR}/compare /etc/services ${.OBJDIR}/${PROG}
.include <bsd.prog.mk>

View File

@ -1,72 +0,0 @@
#include <netdb.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <stdio.h>
static void
pserv(const struct servent *svp)
{
char **pp;
printf("name=%s, port=%d, proto=%s, aliases=",
svp->s_name, ntohs((uint16_t)svp->s_port), svp->s_proto);
for (pp = svp->s_aliases; *pp; pp++)
printf("%s ", *pp);
printf("\n");
}
static void
usage(void)
{
(void)fprintf(stderr, "Usage: %s\n"
"\t%s -p <port> [-P <proto>]\n"
"\t%s -n <name> [-P <proto>]\n", getprogname(), getprogname(),
getprogname());
exit(1);
}
int
main(int argc, char *argv[])
{
struct servent *svp;
const char *port = NULL, *proto = NULL, *name = NULL;
int c;
while ((c = getopt(argc, argv, "p:n:P:")) != -1) {
switch (c) {
case 'n':
name = optarg;
break;
case 'p':
port = optarg;
break;
case 'P':
proto = optarg;
break;
default:
usage();
}
}
if (port && name)
usage();
if (port) {
if ((svp = getservbyport(htons(atoi(port)), proto)) != NULL)
pserv(svp);
return 0;
}
if (name) {
if ((svp = getservbyname(name, proto)) != NULL)
pserv(svp);
return 0;
}
setservent(0);
while ((svp = getservent()) != NULL)
pserv(svp);
endservent();
return 0;
}