diff --git a/Makefile.am b/Makefile.am index 0a78fb7..9bf748a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -71,20 +71,21 @@ uninstall-hook: rm -f $(DESTDIR)$(mandir)/man1/`echo "bzcmp" | sed 's,^.*/,,;$(transform)'`.1 check-local: bzip2 - @cat $(srcdir)/words1 - ./bzip2 -1 <$(srcdir)/sample1.ref >sample1.rb2 - ./bzip2 -2 <$(srcdir)/sample2.ref >sample2.rb2 - ./bzip2 -3 <$(srcdir)/sample3.ref >sample3.rb2 - ./bzip2 -d <$(srcdir)/sample1.bz2 >sample1.tst - ./bzip2 -d <$(srcdir)/sample2.bz2 >sample2.tst - ./bzip2 -ds <$(srcdir)/sample3.bz2 >sample3.tst - cmp $(srcdir)/sample1.bz2 sample1.rb2 - cmp $(srcdir)/sample2.bz2 sample2.rb2 - cmp $(srcdir)/sample3.bz2 sample3.rb2 - cmp sample1.tst $(srcdir)/sample1.ref - cmp sample2.tst $(srcdir)/sample2.ref - cmp sample3.tst $(srcdir)/sample3.ref - @cat $(srcdir)/words3 + @cat $(top_srcdir)/tests/words1 + @mkdir $(top_builddir)/tests/ + ./bzip2 -1 <$(top_srcdir)/tests/sample1.ref >$(top_builddir)/tests/sample1.rb2 + ./bzip2 -2 <$(top_srcdir)/tests/sample2.ref >$(top_builddir)/tests/sample2.rb2 + ./bzip2 -3 <$(top_srcdir)/tests/sample3.ref >$(top_builddir)/tests/sample3.rb2 + ./bzip2 -d <$(top_srcdir)/tests/sample1.bz2 >$(top_builddir)/tests/sample1.tst + ./bzip2 -d <$(top_srcdir)/tests/sample2.bz2 >$(top_builddir)/tests/sample2.tst + ./bzip2 -ds <$(top_srcdir)/tests/sample3.bz2 >$(top_builddir)/tests/sample3.tst + cmp $(top_srcdir)/tests/sample1.bz2 $(top_builddir)/tests/sample1.rb2 + cmp $(top_srcdir)/tests/sample2.bz2 $(top_builddir)/tests/sample2.rb2 + cmp $(top_srcdir)/tests/sample3.bz2 $(top_builddir)/tests/sample3.rb2 + cmp $(top_builddir)/tests/sample1.tst $(top_srcdir)/tests/sample1.ref + cmp $(top_builddir)/tests/sample2.tst $(top_srcdir)/tests/sample2.ref + cmp $(top_builddir)/tests/sample3.tst $(top_srcdir)/tests/sample3.ref + @cat $(top_srcdir)/tests/words3 manual: $(srcdir)/manual.html $(srcdir)/manual.ps $(srcdir)/manual.pdf @@ -100,8 +101,8 @@ manual.html: $(MANUAL_SRCS) EXTRA_DIST = \ $(bin_SCRIPTS) \ $(man_MANS) \ - README.autotools \ README.XML.STUFF \ + README.autotools \ bz-common.xsl \ bz-fo.xsl \ bz-html.xsl \ @@ -123,16 +124,17 @@ EXTRA_DIST = \ meson.build \ meson_options.txt \ mk251.c \ - sample1.bz2 \ - sample1.ref \ - sample2.bz2 \ - sample2.ref \ - sample3.bz2 \ - sample3.ref \ spewG.c \ + tests/meson.build + tests/sample1.bz2 \ + tests/sample1.ref \ + tests/sample2.bz2 \ + tests/sample2.ref \ + tests/sample3.bz2 \ + tests/sample3.ref \ + tests/words0 \ + tests/words1 \ + tests/words2 \ + tests/words3 \ unzcrash.c \ - words0 \ - words1 \ - words2 \ - words3 \ xmlproc.sh diff --git a/makefile.msc b/makefile.msc index 799a18a..e58b016 100644 --- a/makefile.msc +++ b/makefile.msc @@ -25,24 +25,24 @@ lib: $(OBJS) test: bzip2 type words1 - .\\bzip2 -1 < sample1.ref > sample1.rb2 - .\\bzip2 -2 < sample2.ref > sample2.rb2 - .\\bzip2 -3 < sample3.ref > sample3.rb2 - .\\bzip2 -d < sample1.bz2 > sample1.tst - .\\bzip2 -d < sample2.bz2 > sample2.tst - .\\bzip2 -ds < sample3.bz2 > sample3.tst + .\\bzip2 -1 < tests\sample1.ref > sample1.rb2 + .\\bzip2 -2 < tests\sample2.ref > sample2.rb2 + .\\bzip2 -3 < tests\sample3.ref > sample3.rb2 + .\\bzip2 -d < tests\sample1.bz2 > sample1.tst + .\\bzip2 -d < tests\sample2.bz2 > sample2.tst + .\\bzip2 -ds < tests\sample3.bz2 > sample3.tst @echo All six of the fc's should find no differences. @echo If fc finds an error on sample3.bz2, this could be @echo because WinZip's 'TAR file smart CR/LF conversion' @echo is too clever for its own good. Disable this option. @echo The correct size for sample3.ref is 120,244. If it @echo is 150,251, WinZip has messed it up. - fc sample1.bz2 sample1.rb2 - fc sample2.bz2 sample2.rb2 - fc sample3.bz2 sample3.rb2 - fc sample1.tst sample1.ref - fc sample2.tst sample2.ref - fc sample3.tst sample3.ref + fc tests\sample1.bz2 sample1.rb2 + fc tests\sample2.bz2 sample2.rb2 + fc tests\sample3.bz2 sample3.rb2 + fc tests\sample1.tst sample1.ref + fc tests\sample2.tst sample2.ref + fc tests\sample3.tst sample3.ref @@ -51,12 +51,12 @@ clean: del libbz2.lib del bzip2.exe del bzip2recover.exe - del sample1.rb2 - del sample2.rb2 - del sample3.rb2 - del sample1.tst - del sample2.tst - del sample3.tst + del tests\sample1.rb2 + del tests\sample2.rb2 + del tests\sample3.rb2 + del tests\sample1.tst + del tests\sample2.tst + del tests\sample3.tst .c.obj: $(CC) $(CFLAGS) -c $*.c -o $*.obj diff --git a/meson.build b/meson.build index 8adc1d8..4ef543a 100644 --- a/meson.build +++ b/meson.build @@ -104,26 +104,4 @@ if docs and prog_sh.found() endforeach endif -# Unit tests -prog_python = import('python').find_installation('python3') -# Tuple in the form (args, input, expected) -foreach t : [['-1', 'sample1.ref', 'sample1.bz2'], - ['-2', 'sample2.ref', 'sample2.bz2'], - ['-3', 'sample3.ref', 'sample3.bz2']] - test( - t[1], - prog_python, - args : [files('runtest.py'), '--mode', 'compress', bzip2, t[0], files(t[1]), files(t[2])], - ) -endforeach - -# Tuple in the form (args, input) -foreach t : [['-1', 'sample1.ref'], - ['-2', 'sample2.ref'], - ['-3', 'sample3.ref']] - test( - t[1], - prog_python, - args : [files('runtest.py'), '--mode', 'decompress', bzip2, t[0], files(t[1])], - ) -endforeach \ No newline at end of file +subdir('tests') \ No newline at end of file diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..2cb8941 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,23 @@ +prog_python = import('python').find_installation('python3') + +# Tuple in the form (args, input, expected) +foreach t : [['-1', 'sample1.ref', 'sample1.bz2'], + ['-2', 'sample2.ref', 'sample2.bz2'], + ['-3', 'sample3.ref', 'sample3.bz2']] + test( + t[1], + prog_python, + args : [files('runtest.py'), '--mode', 'compress', bzip2, t[0], files(t[1]), files(t[2])], + ) +endforeach + +# Tuple in the form (args, input) +foreach t : [['-1', 'sample1.ref'], + ['-2', 'sample2.ref'], + ['-3', 'sample3.ref']] + test( + t[1], + prog_python, + args : [files('runtest.py'), '--mode', 'decompress', bzip2, t[0], files(t[1])], + ) +endforeach \ No newline at end of file diff --git a/runtest.py b/tests/runtest.py similarity index 100% rename from runtest.py rename to tests/runtest.py diff --git a/sample1.bz2 b/tests/sample1.bz2 similarity index 100% rename from sample1.bz2 rename to tests/sample1.bz2 diff --git a/sample1.ref b/tests/sample1.ref similarity index 100% rename from sample1.ref rename to tests/sample1.ref diff --git a/sample2.bz2 b/tests/sample2.bz2 similarity index 100% rename from sample2.bz2 rename to tests/sample2.bz2 diff --git a/sample2.ref b/tests/sample2.ref similarity index 100% rename from sample2.ref rename to tests/sample2.ref diff --git a/sample3.bz2 b/tests/sample3.bz2 similarity index 100% rename from sample3.bz2 rename to tests/sample3.bz2 diff --git a/sample3.ref b/tests/sample3.ref similarity index 100% rename from sample3.ref rename to tests/sample3.ref diff --git a/words0 b/tests/words0 similarity index 100% rename from words0 rename to tests/words0 diff --git a/words1 b/tests/words1 similarity index 100% rename from words1 rename to tests/words1 diff --git a/words2 b/tests/words2 similarity index 100% rename from words2 rename to tests/words2 diff --git a/words3 b/tests/words3 similarity index 100% rename from words3 rename to tests/words3