]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/commitdiff
Run tests with ninja
authorMichal Sojka <michal.sojka@cvut.cz>
Fri, 14 Sep 2018 09:01:00 +0000 (11:01 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Fri, 14 Sep 2018 09:32:45 +0000 (11:32 +0200)
To run them faster and to have nice progress report.

.travis.yml
Makefile

index 2f8008bdabeb09b478f1b027d4bcce5c89229f87..d0bbc57ef9ecaf2e24727223f005fd76cb7ec8a4 100644 (file)
@@ -38,7 +38,9 @@ matrix:
       script: make CC=clang-3.8 CXX=clang++-3.8 $(grep -v openmp .kcf_builds)
     - compiler: clang
       name: clang & test
-      script: make all test BUILDS="$(echo $(grep -v cufft .kcf_builds))"
+      script:
+        - make all build.ninja BUILDS="$(echo $(grep -v cufft .kcf_builds))"
+        - ninja test
       after_script: find vot2016 -name output.txt -print0 | xargs -0 rm -f
       addons:
         apt: { sources: *common_sources, packages: [*common_packages, unzip] }
index 824e24447502198714bf9d0ff942a41370b2b99a..31494143a5165c820142784aa4083f58e8e5b846 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -96,11 +96,19 @@ vot2016.zip:
 ninja: build.ninja
        ninja
 
-# Ninja generator - to have faster parallel builds
+# Ninja generator - to have faster parallel builds and tests
 .PHONY: build.ninja
 build.ninja:
-       $(file >$@,$(ninja-rule))
-       $(foreach build,$(BUILDS),$(file >>$@,$(call ninja-build,$(build),$(CMAKE_OTPS_$(build)))))
+       @: $(file >$@,$(ninja-rule))
+       $(foreach build,$(BUILDS),\
+               $(file >>$@,$(call ninja-build,$(build),$(CMAKE_OTPS_$(build)))))
+       $(foreach build,$(BUILDS),$(foreach seq,$(TESTSEQ),$(foreach f,$(TESTFLAGS),\
+               $(file >>$@,$(call ninja-testcase,$(build),$(seq),$(f))))))
+       $(file >>$@,build test: print_results $(foreach build,$(BUILDS),$(foreach seq,$(TESTSEQ),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f))))))
+       $(foreach build,$(BUILDS),$(file >>$@,build test-$(build): print_results $(foreach seq,$(TESTSEQ),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f))))))
+       $(foreach seq,$(TESTSEQ),$(file >>$@,build test-$(seq): print_results $(foreach build,$(BUILDS),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f))))))
+       $(foreach seq,$(TESTSEQ),$(file >>$@,build vot2016/$(seq): make))
+
 
 define ninja-rule
 rule cmake
@@ -110,10 +118,28 @@ rule ninja
   # Absolute path in -C allows Emacs to properly jump to error message locations
   command = ninja -C `realpath $$$$(dirname $$out)`
   description = Ninja $$out
+rule test_seq
+  command = build-$$build/kcf_vot $$flags $$seq > $$out
+rule print_results
+  description = Print results
+  command = $(call print-test-results,$$in)
+rule make
+  command = make $$out
 endef
 
 define ninja-build
 build build-$(1)/build.ninja: cmake
   opts = $(2)
 build build-$(1)/kcf_vot: ninja build-$(1)/build.ninja build.ninja
+default build-$(1)/kcf_vot
+endef
+
+ninja-test = build-$(1)/kcf_vot-$(2)-$(3).log
+
+# Usage: ninja-testcase <build> <seq> <flags>
+define ninja-testcase
+build build-$(1)/kcf_vot-$(2)-$(3).log: test_seq build-$(1)/kcf_vot $(filter-out %/output.txt,$(wildcard vot2016/$(2)/*)) || vot2016/$(2)
+  build = $(1)
+  seq = vot2016/$(2)
+  flags = $(if $(3:fit128=),,--fit=128)
 endef