From eb67c7b3f0f63a34a9e1ef440535d15ceba0f4dd Mon Sep 17 00:00:00 2001 From: Guido Draheim Date: Sat, 15 Sep 2018 03:42:22 +0200 Subject: [PATCH] and add 'make checks' --- Makefile | 2 ++ test/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++-- test/test.zip | Bin 1361 -> 1361 bytes 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d0ac4ca..bc6a674 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,8 @@ zzip unzzip unzzip-mix unzzip-mem unzzip-big zzdir zzcat zzcatsdl zzxorcat zzxor cd build && $(MAKE) $@ VERBOSE=1 sfx zzipself zzipsetstub doc htm man htmpages manpages site dbk pdf: cd build && $(MAKE) $@ VERBOSE=1 +tests checks check: + cd build && $(MAKE) $@ VERBOSE=1 builds: config build local static: conf build local diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2fb7d76..4950256 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,12 +21,16 @@ option(MSVC_STATIC_RUNTIME "Build with static runtime libs (/MT)" ON) # Zlib library needed find_package ( ZLIB REQUIRED ) # pkg_search_module ( ZZIP zzip ) -# find_package ( PythonInterp 2.6 REQUIRED ) -# find_package ( UnixCommands REQUIRED ) # bash cp mv rm gzip tar +find_package ( PythonInterp 2.6 REQUIRED ) +find_package ( UnixCommands REQUIRED ) # bash cp mv rm gzip tar find_program ( MKZIP zip) set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX}) set(README ${CMAKE_SOURCE_DIR}/README) +set(PY2 ${PYTHON_EXECUTABLE}) +set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) +set(topdir ${CMAKE_SOURCE_DIR}) + # targets ######################################################## add_executable(zzipself zzipself.c) add_executable(zzipsetstub zzipsetstub.c) @@ -51,5 +55,30 @@ add_custom_command(OUTPUT zzipshowme${EXEEXT} add_custom_target(sfx ALL DEPENDS zzipshowme${EXEEXT}) endif() +add_custom_target(tests + COMMAND ${PY2} ${srcdir}/zziptests.py --exeext=${EXEEXT} --topsrcdir=${topdir} -v + DEPENDS ../bins/zzcat ../bins/zzdir ../bins/zziptest ../bins/zzxorcat) +add_custom_command(OUTPUT ../bins/zzcat COMMMAND cd ../bins && $(MAKE) zzcat) +add_custom_command(OUTPUT ../bins/zzdir COMMMAND cd ../bins && $(MAKE) zzdir) +add_custom_command(OUTPUT ../bins/zziptest COMMMAND cd ../bins && $(MAKE) zziptest) +add_custom_command(OUTPUT ../bins/zzxorcat COMMMAND cd ../bins && $(MAKE) zzxorcat) + +add_custom_command(OUTPUT test0.zip + COMMAND ${BASH} -c "test -d tmp || mkdir tmp" + COMMAND ${CP} ${README} tmp/README + COMMAND ${BASH} -c "cd tmp && ${MKZIP} ../test0.zip README" + COMMAND ${CP} test0.zip ${srcdir}/test.zip + COMMAND ${MV} test0.zip test.zip + BYPRODUCTS test.zip + VERBATIM) +add_custom_target(checks + COMMAND ${BASH} -c "../bins/zzcat test/README > test.out" + COMMAND ${BASH} -c "if diff test.out ${README} >/dev/null \ + ; then rm test.out ; echo check OK; true \ + ; else rm test.out ; echo check FAIL ; false; fi" + DEPENDS ../bins/zzcat test0.zip + VERBATIM) +add_custom_target(check DEPENDS checks tests) + # install ######################################################## # - nothing - diff --git a/test/test.zip b/test/test.zip index 952d4758244030241ffbbccd9cdf391450f76b9c..d7532b993c020053ed598c6c0ebe71625002304a 100644 GIT binary patch delta 114 zcmcb}b&-oVz?+#xgn@y9gTYc(e9*0WO>QVz`(-5u+eTW3o}r` wKTGu9bJ4~Lqk{@m_b@llrt~{c(byBR51df50HKjG=zZx0H%@_6#xJL delta 114 zcmcb}b&-oVz?+#xgn@y9gW-6$+C*L%QC5$M(I8w}!Og(P@`9Ox0Z44L+sncXR51A; qi=@@IMxc6zAXi5hU)RtORt9Da