From: Guido Draheim Date: Sat, 15 Sep 2018 01:42:22 +0000 (+0200) Subject: and add 'make checks' X-Git-Tag: v0.13.72~103 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb67c7b3f0f63a34a9e1ef440535d15ceba0f4dd;p=zziplib and add 'make checks' --- 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 952d475..d7532b9 100644 Binary files a/test/test.zip and b/test/test.zip differ