Remove the rest of the libc/string tests - they've moved to atf

This commit is contained in:
pgoyette 2010-12-26 13:38:08 +00:00
parent 3ca5a7db69
commit bc33547390
12 changed files with 2 additions and 415 deletions

View File

@ -1,9 +1,9 @@
# $NetBSD: Makefile,v 1.62 2010/12/25 01:20:11 pgoyette Exp $
# $NetBSD: Makefile,v 1.63 2010/12/26 13:38:08 pgoyette Exp $
SUBDIR+= _setjmp atexit citrus clone context convfp db \
divrem gen gdtoa getaddrinfo hsearch inet int_fmtio locale md5sha \
nsdispatch pty randomid regex rpc servent setjmp sigsetjmp \
stdlib string strptime sys time
stdlib strptime sys time
.include <bsd.own.mk>
.include <bsd.sys.mk>

View File

@ -1,5 +0,0 @@
# $NetBSD: Makefile,v 1.10 2010/12/25 21:13:37 pgoyette Exp $
SUBDIR+= memmem swab wcsncpy memcpy stresep
.include <bsd.subdir.mk>

View File

@ -1,10 +0,0 @@
# $NetBSD: Makefile,v 1.1 2005/12/06 08:14:48 ross Exp $
PROG= memcpy_test
NOMAN=
WARNS?= 4
regress: ${PROG}
./${PROG}
.include <bsd.prog.mk>

View File

@ -1,66 +0,0 @@
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <md5.h>
#define ALIGNMENTS 16
#define LENGTHS 4
#define BLOCKTYPES 4
MD5_CTX mc[1];
typedef unsigned char testBlock_t[ALIGNMENTS * LENGTHS];
testBlock_t bss1, bss2;
unsigned char *start[BLOCKTYPES] = {
bss1, bss2
};
char result[100];
const char goodResult[] = "7b405d24bc03195474c70ddae9e1f8fb";
void runTest(unsigned char *, unsigned char *);
int
main(int ac, char **av)
{
int i, j;
testBlock_t auto1, auto2;
start[2] = auto1;
start[3] = auto2;
srandom(0L);
MD5Init(mc);
for (i = 0; i < BLOCKTYPES; ++i)
for (j = 0; j < BLOCKTYPES; ++j)
if (i != j)
runTest(start[i], start[j]);
MD5End(mc, result);
return strcmp(result, goodResult);
}
void runTest(unsigned char *b1, unsigned char *b2)
{
int i, j, k, m;
size_t n;
for (i = 0; i < ALIGNMENTS; ++i) {
for (j = 0; j < ALIGNMENTS; ++j) {
k = sizeof(testBlock_t) - (i > j ? i : j);
for (m = 0; m < k; ++m) {
for (n = 0; n < sizeof(testBlock_t); ++n) {
b1[n] = (unsigned char)random();
b2[n] = (unsigned char)random();
}
memcpy(b1 + i, b2 + j, m);
MD5Update(mc, b1, sizeof(testBlock_t));
MD5Update(mc, b2, sizeof(testBlock_t));
}
}
}
}

View File

@ -1,11 +0,0 @@
# $NetBSD: Makefile,v 1.1 2005/03/13 15:40:32 perry Exp $
NOMAN= # defined
PROG= memmem_test
WARNS?= 3
regress: ${PROG}
./${PROG}
.include <bsd.prog.mk>

View File

@ -1,84 +0,0 @@
/* $NetBSD: memmem_test.c,v 1.2 2008/04/28 20:23:05 martin Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Perry E. Metzger of Metzger, Dowdeswell & Co. LLC.
*
* 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
char p0[] = "";
int lp0 = 0;
char p1[] = "0123";
int lp1 = 4;
char p2[] = "456";
int lp2 = 3;
char p3[] = "789";
int lp3 = 3;
char p4[] = "abc";
int lp4 = 3;
char p5[] = "0";
int lp5 = 1;
char p6[] = "9";
int lp6 = 1;
char p7[] = "654";
int lp7 = 3;
char b0[] = "";
int lb0 = 0;
char b1[] = "0";
int lb1 = 1;
char b2[] = "0123456789";
int lb2 = 10;
#define expect(b) if (!(b)) { \
fprintf(stderr, "failed on line %d\n", __LINE__); \
exit(1); \
}
int
main(int argc, char **argv)
{
expect(memmem(b2, lb2, p0, lp0) == b2);
expect(memmem(b0, lb0, p0, lp0) == b0);
expect(memmem(b0, lb0, p1, lp1) == NULL);
expect(memmem(b1, lb1, p1, lp1) == NULL);
expect(memmem(b2, lb2, p1, lp1) == b2);
expect(memmem(b2, lb2, p2, lp2) == (b2 + 4));
expect(memmem(b2, lb2, p3, lp3) == (b2 + 7));
expect(memmem(b2, lb2, p5, lp5) == b2);
expect(memmem(b2, lb2, p6, lp6) == (b2 + 9));
expect(memmem(b2, lb2, p4, lp4) == NULL);
expect(memmem(b2, lb2, p7, lp7) == NULL);
exit(0);
}

View File

@ -1,11 +0,0 @@
# $NetBSD: Makefile,v 1.1 2006/08/12 23:51:12 christos Exp $
NOMAN= # defined
PROG= stresep_test
WARNS?= 3
regress: ${PROG}
./${PROG}
.include <bsd.prog.mk>

View File

@ -1,54 +0,0 @@
/* $NetBSD: stresep_test.c,v 1.3 2008/04/28 20:23:05 martin Exp $ */
/*-
* Copyright (c) 2005 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#define expect(a) if ((p = stresep(&q, " ", '\\')) == NULL || strcmp(p, a)) { \
fprintf(stderr, "failed on line %d: %s != %s\n", \
__LINE__, p, a); \
return 1; \
}
int
main(int argc, char **argv)
{
char brk[] = "foo\\ \\ bar baz bar\\ foo\\ bar\\ \\ foo \\ \\ \\ baz bar\\ \\ ";
char *p, *q = brk;
expect("foo bar");
expect("baz");
expect("bar foo ");
expect("bar foo");
expect(" baz");
expect("bar ");
return 0;
}

View File

@ -1,10 +0,0 @@
# $NetBSD: Makefile,v 1.1 2005/03/13 15:33:45 perry Exp $
NOMAN= # defined
PROG= swabcheck
regress: ${PROG}
./${PROG}
.include <bsd.prog.mk>

View File

@ -1,85 +0,0 @@
/* $NetBSD: swabcheck.c,v 1.2 2008/04/28 20:23:05 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code was 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h>
#define MAXCHK 100
static void
build(char *a, char *b, size_t n) {
size_t i;
n >>= 1;
for (i = 0; i < n; i += 2) {
b[i+1] = a[i] = (char)i;
b[i] = a[i+1] = (char)(i+1);
}
for (n <<= 1; n < MAXCHK; n++)
a[n] = b[n] = (char)~0;
}
static void
dump(f, b, l)
const char *f;
char *b;
size_t l;
{
printf("%s ", f);
while (l--)
printf("%.2x ", (unsigned char)*b++);
printf("\n");
}
int
main(int argc, char *argv[])
{
char a[MAXCHK], b[MAXCHK], r[MAXCHK];
size_t i;
for (i = 0; i < MAXCHK; i += 2) {
build(a, b, i);
(void)memset(r, ~0, MAXCHK);
swab(a, r, i);
if (memcmp(b, r, MAXCHK) != 0) {
warnx("pattern mismatch at %lu bytes",
(unsigned long)i);
dump("expect:", b, MAXCHK);
dump("result:", r, MAXCHK);
return 1;
}
}
return 0;
}

View File

@ -1,11 +0,0 @@
# $NetBSD: Makefile,v 1.1 2005/10/13 21:15:49 tnozaki Exp $
NOMAN= #defined
PROG= wcsncpy_test
WARNS?= 3
regress: ${PROG}
./${PROG}
.include <bsd.prog.mk>

View File

@ -1,66 +0,0 @@
/* $NetBSD: wcsncpy_test.c,v 1.1 2005/10/13 21:15:49 tnozaki Exp $ */
/*-
* Copyright (c)2005 Citrus Project,
* 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 AUTHOR 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 AUTHOR 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 <string.h>
#include <wchar.h>
int
main(void)
{
#define CASESIZE 32
wchar_t buf[CASESIZE + 1];
const wchar_t *str[] = {
L"0",
L"01",
L"012",
L"0123",
L"01234",
L"012345",
L"0123456",
L"01234567",
L"012345678",
L"0123456789",
NULL
}, **p;
int i;
for (p = str; *p; ++p) {
wmemset(buf, (wchar_t)0xdeadbeef, CASESIZE + 1);
wcsncpy(buf, *p, CASESIZE);
if (wcscmp(buf, *p))
return (1);
for (i = wcslen(*p); i < CASESIZE; ++i) {
if (buf[i] != L'\0')
return (2);
}
if (buf[CASESIZE] != (wchar_t)0xdeadbeef)
return (3);
}
return (0);
}