From 2035faf3f8aa95b888d9416c3cc7328c0ea18beb Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Wed, 7 Nov 2018 01:08:50 +0000 Subject: This commit was manufactured by cvs2git to create tag 'bluhm_20181106'. --- .../lib/libc/malloc/malloc_general/Makefile | 27 ----- .../libc/malloc/malloc_general/malloc_general.c | 125 --------------------- 2 files changed, 152 deletions(-) delete mode 100644 src/regress/lib/libc/malloc/malloc_general/Makefile delete mode 100644 src/regress/lib/libc/malloc/malloc_general/malloc_general.c (limited to 'src/regress/lib/libc/malloc/malloc_general') diff --git a/src/regress/lib/libc/malloc/malloc_general/Makefile b/src/regress/lib/libc/malloc/malloc_general/Makefile deleted file mode 100644 index a0ee823bbe..0000000000 --- a/src/regress/lib/libc/malloc/malloc_general/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# $OpenBSD: Makefile,v 1.3 2017/01/24 16:03:28 otto Exp $ - -REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 -PROG= malloc_general - -.include - -t1: malloc_general - ${.OBJDIR}/malloc_general "" - -t2: malloc_general - ${.OBJDIR}//malloc_general C - -t3: malloc_general - ${.OBJDIR}//malloc_general J - -t4: malloc_general - ${.OBJDIR}//malloc_general F - -t5: malloc_general - ${.OBJDIR}//malloc_general G - -t6: malloc_general - ${.OBJDIR}//malloc_general S - -t7: malloc_general - ${.OBJDIR}//malloc_general FGJ diff --git a/src/regress/lib/libc/malloc/malloc_general/malloc_general.c b/src/regress/lib/libc/malloc/malloc_general/malloc_general.c deleted file mode 100644 index 51bfb03a34..0000000000 --- a/src/regress/lib/libc/malloc/malloc_general/malloc_general.c +++ /dev/null @@ -1,125 +0,0 @@ -/* $OpenBSD */ -/* - * Copyright (c) 2017 Otto Moerbeek - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - -/* $define VERBOSE */ - -#define N 1000 - -size_t -size(void) -{ - int p = arc4random_uniform(13) + 3; - return arc4random_uniform(1 << p); -} - -struct { void *p; size_t sz; } a[N]; - -extern char *malloc_options; - -void -fill(u_char *p, size_t sz) -{ - size_t i; - - for (i = 0; i < sz; i++) - p[i] = i % 256; -} - -void -check(u_char *p, size_t sz) -{ - size_t i; - - for (i = 0; i < sz; i++) - if (p[i] != i % 256) - errx(1, "check"); -} - -int -main(int argc, char *argv[]) -{ - int count, p, i; - void * q; - size_t sz; - - if (argc == 1) - errx(1, "usage: malloc_options"); - - malloc_options = argv[1]; - - for (count = 0; count < 800000; count++) { - if (count % 10000 == 0) { - printf("."); - fflush(stdout); - } - p = arc4random_uniform(2); - i = arc4random_uniform(N); - switch (p) { - case 0: - if (a[i].p) { -#ifdef VERBOSE - printf("F %p\n", a[i].p); -#endif - if (a[i].p) - check(a[i].p, a[i].sz); - free(a[i].p); - a[i].p = NULL; - } - sz = size(); -#ifdef VERBOSE - printf("M %zu=", sz); -#endif - a[i].p = malloc(sz); - a[i].sz = sz; -#ifdef VERBOSE - printf("%p\n", a[i].p); -#endif - if (a[i].p) - fill(a[i].p, sz); - break; - case 1: - sz = size(); -#ifdef VERBOSE - printf("R %p %zu=", a[i].p, sz); -#endif - q = realloc(a[i].p, sz); -#ifdef VERBOSE - printf("%p\n", q); -#endif - if (a[i].p && q) - check(q, a[i].sz < sz ? a[i].sz : sz); - if (q) { - a[i].p = q; - a[i].sz = sz; - fill(a[i].p, sz); - } - break; - } - } - for (i = 0; i < N; i++) { - if (a[i].p) - check(a[i].p, a[i].sz); - free(a[i].p); - } - printf("\n"); - return 0; -} -- cgit v1.2.3-55-g6feb