diff --git a/bin/tests/Makefile.in b/bin/tests/Makefile.in index 1fc2347e73..1ea6194653 100644 --- a/bin/tests/Makefile.in +++ b/bin/tests/Makefile.in @@ -13,7 +13,7 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.98 2000/08/01 01:12:30 tale Exp $ +# $Id: Makefile.in,v 1.99 2000/08/08 21:47:49 bwelling Exp $ srcdir = @srcdir@ VPATH = @srcdir@ @@ -42,7 +42,7 @@ LIBS = @LIBS@ SUBDIRS = db dst master mem names net rbt sockaddr tasks timers system # Alphabetically -TARGETS = +TARGETS = genrandom XTARGETS = adb_test \ byaddr_test \ @@ -133,6 +133,9 @@ SRCS = adb_test.c \ all_tests: ${XTARGETS} +genrandom: genrandom.@O@ + ${LIBTOOL} ${CC} ${CFLAGS} -o $@ genrandom.@O@ + adb_test: adb_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} ${LIBTOOL} ${CC} ${CFLAGS} -o $@ adb_test.@O@ \ ${DNSLIBS} ${ISCLIBS} ${LIBS} diff --git a/bin/tests/dst/Makefile.in b/bin/tests/dst/Makefile.in index 79b967ed5b..26a92eabbc 100644 --- a/bin/tests/dst/Makefile.in +++ b/bin/tests/dst/Makefile.in @@ -13,7 +13,7 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.23 2000/08/01 01:13:39 tale Exp $ +# $Id: Makefile.in,v 1.24 2000/08/08 21:47:51 bwelling Exp $ srcdir = @srcdir@ VPATH = @srcdir@ @@ -51,6 +51,7 @@ t_dst: t_dst.@O@ ${DEPLIBS} ${TLIB} ${LIBTOOL} ${CC} -o $@ t_dst.@O@ ${TLIB} ${LIBS} test: t_dst + ../genrandom 50 randomfile -@ ./t_dst -b @srcdir@ -q 1800 -a clean distclean:: diff --git a/bin/tests/dst/randomfile b/bin/tests/dst/randomfile deleted file mode 100644 index 69cb167a69..0000000000 Binary files a/bin/tests/dst/randomfile and /dev/null differ diff --git a/bin/tests/genrandom.c b/bin/tests/genrandom.c new file mode 100644 index 0000000000..9d6ab14e67 --- /dev/null +++ b/bin/tests/genrandom.c @@ -0,0 +1,67 @@ +#include +#include +#include + +int +main(int argc, char **argv) { + unsigned int bytes; + unsigned int k; + char *endp; + FILE *urandom, *fp; + + if (argc != 3) { + printf("usage: genrandom k file\n"); + exit(1); + } + k = strtoul(argv[1], &endp, 10); + if (*endp != 0) { + printf("usage: genrandom k file\n"); + exit(1); + } + bytes = k << 10; + + fp = fopen(argv[2], "w"); + if (fp == NULL) { + printf("failed to open %s\n", argv[2]); + exit(1); + } + + urandom = fopen("/dev/urandom", "r"); + if (urandom != NULL) { + unsigned char data[1024]; + while (bytes > 0) { + size_t n, toread; + toread = sizeof(data); + if (toread > bytes) + toread = bytes; + n = fread(data, 1, toread, urandom); + if (n <= 0) { + printf("error reading /dev/urandom\n"); + exit(1); + } + if (fwrite(data, 1, n, fp) != n) { + printf("error writing to file\n"); + exit(1); + } + bytes -= n; + } + fclose(urandom); + } else { + unsigned int seed = (unsigned int) time(NULL); + srand(seed); + while (bytes > 0) { + int x = rand(); + if (fwrite(&x, 1, sizeof(int), fp) != sizeof(int)) { + printf("error writing to file\n"); + exit(1); + } + bytes -= sizeof(int); + } + } + fclose(fp); + + exit(0); + + + +} diff --git a/bin/tests/system/dnssec/random.data b/bin/tests/system/dnssec/random.data deleted file mode 100644 index a8130d952d..0000000000 Binary files a/bin/tests/system/dnssec/random.data and /dev/null differ diff --git a/bin/tests/system/dnssec/setup.sh b/bin/tests/system/dnssec/setup.sh index 3a527ff14d..15b59071b5 100644 --- a/bin/tests/system/dnssec/setup.sh +++ b/bin/tests/system/dnssec/setup.sh @@ -15,7 +15,9 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: setup.sh,v 1.8 2000/08/01 01:14:32 tale Exp $ +# $Id: setup.sh,v 1.9 2000/08/08 21:47:55 bwelling Exp $ + +../../genrandom 400 random.data cd ns1 && sh sign.sh