1
0
mirror of https://gitlab.com/bzip2/bzip2.git synced 2025-08-12 11:42:44 +03:00

Move tests into a tests/ directory

I've updated autotools, meson, and the makefile.msc, though I haven't
verified tat the nmake file works.
This commit is contained in:
Dylan Baker
2019-06-06 08:55:40 -07:00
parent 736902410a
commit f6f3326c69
15 changed files with 69 additions and 66 deletions

View File

@@ -71,20 +71,21 @@ uninstall-hook:
rm -f $(DESTDIR)$(mandir)/man1/`echo "bzcmp" | sed 's,^.*/,,;$(transform)'`.1 rm -f $(DESTDIR)$(mandir)/man1/`echo "bzcmp" | sed 's,^.*/,,;$(transform)'`.1
check-local: bzip2 check-local: bzip2
@cat $(srcdir)/words1 @cat $(top_srcdir)/tests/words1
./bzip2 -1 <$(srcdir)/sample1.ref >sample1.rb2 @mkdir $(top_builddir)/tests/
./bzip2 -2 <$(srcdir)/sample2.ref >sample2.rb2 ./bzip2 -1 <$(top_srcdir)/tests/sample1.ref >$(top_builddir)/tests/sample1.rb2
./bzip2 -3 <$(srcdir)/sample3.ref >sample3.rb2 ./bzip2 -2 <$(top_srcdir)/tests/sample2.ref >$(top_builddir)/tests/sample2.rb2
./bzip2 -d <$(srcdir)/sample1.bz2 >sample1.tst ./bzip2 -3 <$(top_srcdir)/tests/sample3.ref >$(top_builddir)/tests/sample3.rb2
./bzip2 -d <$(srcdir)/sample2.bz2 >sample2.tst ./bzip2 -d <$(top_srcdir)/tests/sample1.bz2 >$(top_builddir)/tests/sample1.tst
./bzip2 -ds <$(srcdir)/sample3.bz2 >sample3.tst ./bzip2 -d <$(top_srcdir)/tests/sample2.bz2 >$(top_builddir)/tests/sample2.tst
cmp $(srcdir)/sample1.bz2 sample1.rb2 ./bzip2 -ds <$(top_srcdir)/tests/sample3.bz2 >$(top_builddir)/tests/sample3.tst
cmp $(srcdir)/sample2.bz2 sample2.rb2 cmp $(top_srcdir)/tests/sample1.bz2 $(top_builddir)/tests/sample1.rb2
cmp $(srcdir)/sample3.bz2 sample3.rb2 cmp $(top_srcdir)/tests/sample2.bz2 $(top_builddir)/tests/sample2.rb2
cmp sample1.tst $(srcdir)/sample1.ref cmp $(top_srcdir)/tests/sample3.bz2 $(top_builddir)/tests/sample3.rb2
cmp sample2.tst $(srcdir)/sample2.ref cmp $(top_builddir)/tests/sample1.tst $(top_srcdir)/tests/sample1.ref
cmp sample3.tst $(srcdir)/sample3.ref cmp $(top_builddir)/tests/sample2.tst $(top_srcdir)/tests/sample2.ref
@cat $(srcdir)/words3 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 manual: $(srcdir)/manual.html $(srcdir)/manual.ps $(srcdir)/manual.pdf
@@ -100,8 +101,8 @@ manual.html: $(MANUAL_SRCS)
EXTRA_DIST = \ EXTRA_DIST = \
$(bin_SCRIPTS) \ $(bin_SCRIPTS) \
$(man_MANS) \ $(man_MANS) \
README.autotools \
README.XML.STUFF \ README.XML.STUFF \
README.autotools \
bz-common.xsl \ bz-common.xsl \
bz-fo.xsl \ bz-fo.xsl \
bz-html.xsl \ bz-html.xsl \
@@ -123,16 +124,17 @@ EXTRA_DIST = \
meson.build \ meson.build \
meson_options.txt \ meson_options.txt \
mk251.c \ mk251.c \
sample1.bz2 \
sample1.ref \
sample2.bz2 \
sample2.ref \
sample3.bz2 \
sample3.ref \
spewG.c \ 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 \ unzcrash.c \
words0 \
words1 \
words2 \
words3 \
xmlproc.sh xmlproc.sh

View File

@@ -25,24 +25,24 @@ lib: $(OBJS)
test: bzip2 test: bzip2
type words1 type words1
.\\bzip2 -1 < sample1.ref > sample1.rb2 .\\bzip2 -1 < tests\sample1.ref > sample1.rb2
.\\bzip2 -2 < sample2.ref > sample2.rb2 .\\bzip2 -2 < tests\sample2.ref > sample2.rb2
.\\bzip2 -3 < sample3.ref > sample3.rb2 .\\bzip2 -3 < tests\sample3.ref > sample3.rb2
.\\bzip2 -d < sample1.bz2 > sample1.tst .\\bzip2 -d < tests\sample1.bz2 > sample1.tst
.\\bzip2 -d < sample2.bz2 > sample2.tst .\\bzip2 -d < tests\sample2.bz2 > sample2.tst
.\\bzip2 -ds < sample3.bz2 > sample3.tst .\\bzip2 -ds < tests\sample3.bz2 > sample3.tst
@echo All six of the fc's should find no differences. @echo All six of the fc's should find no differences.
@echo If fc finds an error on sample3.bz2, this could be @echo If fc finds an error on sample3.bz2, this could be
@echo because WinZip's 'TAR file smart CR/LF conversion' @echo because WinZip's 'TAR file smart CR/LF conversion'
@echo is too clever for its own good. Disable this option. @echo is too clever for its own good. Disable this option.
@echo The correct size for sample3.ref is 120,244. If it @echo The correct size for sample3.ref is 120,244. If it
@echo is 150,251, WinZip has messed it up. @echo is 150,251, WinZip has messed it up.
fc sample1.bz2 sample1.rb2 fc tests\sample1.bz2 sample1.rb2
fc sample2.bz2 sample2.rb2 fc tests\sample2.bz2 sample2.rb2
fc sample3.bz2 sample3.rb2 fc tests\sample3.bz2 sample3.rb2
fc sample1.tst sample1.ref fc tests\sample1.tst sample1.ref
fc sample2.tst sample2.ref fc tests\sample2.tst sample2.ref
fc sample3.tst sample3.ref fc tests\sample3.tst sample3.ref
@@ -51,12 +51,12 @@ clean:
del libbz2.lib del libbz2.lib
del bzip2.exe del bzip2.exe
del bzip2recover.exe del bzip2recover.exe
del sample1.rb2 del tests\sample1.rb2
del sample2.rb2 del tests\sample2.rb2
del sample3.rb2 del tests\sample3.rb2
del sample1.tst del tests\sample1.tst
del sample2.tst del tests\sample2.tst
del sample3.tst del tests\sample3.tst
.c.obj: .c.obj:
$(CC) $(CFLAGS) -c $*.c -o $*.obj $(CC) $(CFLAGS) -c $*.c -o $*.obj

View File

@@ -104,26 +104,4 @@ if docs and prog_sh.found()
endforeach endforeach
endif endif
# Unit tests subdir('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

23
tests/meson.build Normal file
View File

@@ -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