diff options
Diffstat (limited to 'ent')
-rw-r--r-- | ent/Makefile.am | 7 | ||||
-rw-r--r-- | ent/Makefile.in | 41 | ||||
-rw-r--r-- | ent/examine_chi_square.R | 13 | ||||
-rwxr-xr-x | ent/examine_chi_square.sh | 15 | ||||
-rwxr-xr-x | ent/test.sh | 18 |
5 files changed, 71 insertions, 23 deletions
diff --git a/ent/Makefile.am b/ent/Makefile.am index 265504c..ba11747 100644 --- a/ent/Makefile.am +++ b/ent/Makefile.am @@ -10,13 +10,14 @@ entest_LDADD = -lm entest_SOURCES = entest.c iso8859.c randtest.c chisq.c iso8859.h randtest.h -CLEANFILES = sample +CLEANFILES = sample *log +clean-local: + rm -rf chi_square MAINTAINERCLEANFILES = Makefile.in if ENABLE_ENT_TEST check-local: ./entest -t ${srcdir}/entitle.gif - ../src/haveged -n 16384k -v 1 $* - ./entest -vf sample + ./test.sh endif diff --git a/ent/Makefile.in b/ent/Makefile.in index 49931f5..e0d890b 100644 --- a/ent/Makefile.in +++ b/ent/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -163,8 +163,6 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -179,6 +177,8 @@ CC = @CC@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DLLTOOL = @DLLTOOL@ @@ -188,13 +188,13 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GREP = @GREP@ HAVEGE_LT_VERSION = @HAVEGE_LT_VERSION@ -HA_DISTRO = @HA_DISTRO@ HA_LDFLAGS = @HA_LDFLAGS@ -HA_UNITD = @HA_UNITD@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -274,6 +274,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -285,7 +286,7 @@ top_srcdir = @top_srcdir@ AM_CFLAGS = -Wall entest_LDADD = -lm entest_SOURCES = entest.c iso8859.c randtest.c chisq.c iso8859.h randtest.h -CLEANFILES = sample +CLEANFILES = sample *log MAINTAINERCLEANFILES = Makefile.in all: all-am @@ -406,7 +407,6 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am @@ -481,7 +481,7 @@ maintainer-clean-generic: -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am -clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ +clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ mostlyclean-am distclean: distclean-am @@ -551,26 +551,27 @@ uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ - clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ - ctags ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ + clean-checkPROGRAMS clean-generic clean-libtool clean-local \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile +clean-local: + rm -rf chi_square @ENABLE_ENT_TEST_TRUE@check-local: @ENABLE_ENT_TEST_TRUE@ ./entest -t ${srcdir}/entitle.gif -@ENABLE_ENT_TEST_TRUE@ ../src/haveged -n 16384k -v 1 $* -@ENABLE_ENT_TEST_TRUE@ ./entest -vf sample +@ENABLE_ENT_TEST_TRUE@ ./test.sh # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/ent/examine_chi_square.R b/ent/examine_chi_square.R new file mode 100644 index 0000000..43771fd --- /dev/null +++ b/ent/examine_chi_square.R @@ -0,0 +1,13 @@ +d <- read.table('chi.txt', header = FALSE, sep = "", dec = ".") +summary(d) +h <- hist(d[,1],breaks=20) +chisq.test(h$counts) +h$counts=h$counts/sum(h$counts) +x11() +plot(h, col = "gray") +curve(100/length(h$counts)*dunif(x,0,100),add=TRUE, col="red") +x11() +ks.test(d[,1], "punif", 0, 100) +plot(ecdf(d[,1])) +curve(punif(x, 0, 100), add=TRUE, col="red") +#locator(1) diff --git a/ent/examine_chi_square.sh b/ent/examine_chi_square.sh new file mode 100755 index 0000000..ef56470 --- /dev/null +++ b/ent/examine_chi_square.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +#for i in $(seq -w 1000); do +# ./entest -vf <(head -c 16M /dev/random) > "${i}_linux.log" +#done + +mkdir chi_square +pushd chi_square || exit 1 +for i in $(seq -w 1000); do + ../entest -vf <(../../src/haveged -n 16384k -f -) > "${i}_haveged.log" +done + +grep -Poh "Chi-Square: .*\(\K[0-9.]+" ./*haveged.log > ./chi.txt +R --vanilla <../examine_chi_square.R > examine_chi_square.summary +popd || exit 1 diff --git a/ent/test.sh b/ent/test.sh new file mode 100755 index 0000000..59f8a82 --- /dev/null +++ b/ent/test.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +runs=10 +for i in $(seq -w "$runs"); do + ./entest -vf <(../src/haveged -n 16384k -f -) > "${i}_entest.log" +done + +fails=$(grep Fail ./*_entest.log | wc -l) + +if (( fails > 2 )); then + echo "Total $fails in $runs" + grep Fail ./*_entest.log + echo "Marking the whole test as failed" + exit 255 +else + echo "Test passed!" +fi + |