diff --git a/.gitignore b/.gitignore index ab5dd84..6fc98a2 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ configure.local regress/testdata regress/*.pem regress/reg.conf +regress/fill-file +regress/iri_test +regress/*.o diff --git a/regress/Makefile b/regress/Makefile index 67948a4..863e5e4 100644 --- a/regress/Makefile +++ b/regress/Makefile @@ -8,6 +8,9 @@ all: iri_test runtime iri_test: iri_test.o ../iri.o ../utf8.o ${CC} iri_test.o ../iri.o ../utf8.o -o iri_test ${LDFLAGS} +fill-file: fill-file.o + ${CC} fill-file.o -o fill-file + key.pem: cert.pem # XXX: key size is NOT GOOD. This is only for testing. Smaller keys @@ -24,9 +27,9 @@ clean: rm -f *.o iri_test cert.pem key.pem rm -rf testdata -testdata: +testdata: fill-file mkdir testdata - ./genbigfile testdata/bigfile + ./fill-file testdata/bigfile ./sha testdata/bigfile testdata/bigfile.sha printf "# hello world\n" > testdata/index.gmi ./sha testdata/index.gmi testdata/index.gmi.sha diff --git a/regress/fill-file.c b/regress/fill-file.c new file mode 100644 index 0000000..0cf4384 --- /dev/null +++ b/regress/fill-file.c @@ -0,0 +1,29 @@ +#include + +/* I need a big file made up of ascii characters. dd if=/dev/zero is + * thus not an option, truncate is not portable. This is some order + * of magnitude faster than the equivalent sh script */ + +int +main(int argc, char **argv) +{ + FILE *out; + int i, j; + + if (argc != 2) { + fprintf(stderr, "USAGE: %s \n", *argv); + return 1; + } + + if ((out = fopen(argv[1], "w")) == NULL) { + fprintf(stderr, "cannot open file: %s\n", argv[1]); + return 1; + } + + for (i = 0; i < 1024; ++i) + for (j = 0; j < 1024; ++j) + fprintf(out, "a\n"); + + fclose(out); + return 0; +}