Revamp the regtest action:
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Jul 09 20:58:46 2007 +0000 (2007-07-09)
changeset 23013f12e53b1b7
parent 229 9c5809b7fd23
child 231 d5f64f25163a
Revamp the regtest action:
- enable one regtest per sample,
- enable regtest for either local or global samples, or both,
- document this in the help-build text.
samples/Makefile
     1.1 --- a/samples/Makefile	Mon Jul 09 20:55:32 2007 +0000
     1.2 +++ b/samples/Makefile	Mon Jul 09 20:58:46 2007 +0000
     1.3 @@ -14,20 +14,30 @@
     1.4  
     1.5  help-build::
     1.6  	@echo  '  regtest        - Regtest-build all samples'
     1.7 +	@echo  '  regtest-local  - Regtest-build all local samples'
     1.8 +	@echo  '  regtest-global - Regtest-build all global samples'
     1.9  
    1.10  # How we do build one sample
    1.11  PHONY += $(CT_SAMPLES)
    1.12  $(CT_SAMPLES):
    1.13 -	@$(MAKE) -f $(CT_MAKEFILE) $(patsubst %,%_copy_config,$(@)) oldconfig
    1.14 +	@$(CT_NG) $(patsubst %,copy_config_%,$(@)) oldconfig
    1.15  
    1.16 -$(patsubst %,%_copy_config,$(CT_SAMPLES)):
    1.17 -	@if [ -f $(CT_TOP_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config ]; then                    \
    1.18 -	      cp "$(CT_TOP_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
    1.19 +$(patsubst %,copy_config_%,$(CT_SAMPLES)):
    1.20 +	@if [ -f $(CT_TOP_DIR)/samples/$(patsubst copy_config_%,%,$(@))/crosstool.config ]; then                    \
    1.21 +	      cp "$(CT_TOP_DIR)/samples/$(patsubst copy_config_%,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
    1.22  	 else                                                                                                       \
    1.23 -	      cp "$(CT_LIB_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
    1.24 +	      cp "$(CT_LIB_DIR)/samples/$(patsubst copy_config_%,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
    1.25  	 fi
    1.26  
    1.27  # And now for building all samples one after the other
    1.28 +PHONY += regtest regtest_local regtest_global
    1.29 +regtest: regtest-local regtest-global
    1.30 +
    1.31 +regtest-local: $(patsubst %,regtest_%,$(CT_TOP_SAMPLES))
    1.32 +
    1.33 +regtest-global: $(patsubst %,regtest_%,$(CT_LIB_SAMPLES))
    1.34 +
    1.35 +# One regtest per sample
    1.36  # We could use a simple rule like: 'regtest: $(CT_SAMPLES)', but that doesn't
    1.37  # work because we want to save the samples as well.
    1.38  # Also, we don't want to see anylog at all, save for the elapsed time, and we
    1.39 @@ -36,28 +46,26 @@
    1.40  # Finaly, we can't use 'make sample-name' as we need to provide default values
    1.41  # if the options set has changed, but oldconfig does not like when stdin is
    1.42  # not a terminal (eg. it is a pipe).
    1.43 -PHONY += regtest
    1.44 -regtest:
    1.45 -	@for samp in $(CT_SAMPLES); do                                                                          \
    1.46 -	     echo -e "\rBuilding sample \"$${samp}\""                                                       &&  \
    1.47 -	     $(CT_NG) $${samp}_copy_config                                                                  &&  \
    1.48 -	     yes "" |$(CT_NG) defoldconfig >/dev/null 2>&1                                                  &&  \
    1.49 -	     sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config  &&  \
    1.50 -	     sed -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config         &&  \
    1.51 -	     sed -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config                                          &&  \
    1.52 -	     sed -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config                                 &&  \
    1.53 -	     sed -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config                                        &&  \
    1.54 -	     sed -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config                                   &&  \
    1.55 -	     yes "" |$(CT_NG) defoldconfig >/dev/null 2>&1                                                  &&  \
    1.56 -	     $(CT_NG) build                                                                                 &&  \
    1.57 -	     echo -e "\rSuccessfully built sample \"$${samp}\""                                             &&  \
    1.58 -	     echo -e "\rMaking tarball for sample \"$${samp}\""                                             &&  \
    1.59 -	     $(CT_NG) tarball                                                                               &&  \
    1.60 -	     echo -e "\rSuccessfully built tarball for sample \"$${samp}\""                                 ;   \
    1.61 -	     echo -e "\rCleaning sample \"$${samp}\""                                                       ;   \
    1.62 -	     $(CT_NG) distclean                                                                             ;   \
    1.63 -	     echo -e "\r"                                                                                   ;   \
    1.64 -	 done
    1.65 +$(patsubst %,regtest_%,$(CT_SAMPLES)):
    1.66 +	@samp=$(patsubst regtest_%,%,$@)                                                                ;   \
    1.67 +	 echo -e "\rBuilding sample \"$${samp}\""                                                       &&  \
    1.68 +	 $(CT_NG) copy_config_$${samp}                                                                  &&  \
    1.69 +	 yes "" |$(CT_NG) defoldconfig >/dev/null 2>&1                                                  &&  \
    1.70 +	 sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config  &&  \
    1.71 +	 sed -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config         &&  \
    1.72 +	 sed -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config                                          &&  \
    1.73 +	 sed -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config                                 &&  \
    1.74 +	 sed -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config                                        &&  \
    1.75 +	 sed -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config                                   &&  \
    1.76 +	 yes "" |$(CT_NG) defoldconfig >/dev/null 2>&1                                                  &&  \
    1.77 +	 $(CT_NG) build                                                                                 &&  \
    1.78 +	 echo -e "\rSuccessfully built sample \"$${samp}\""                                             &&  \
    1.79 +	 echo -e "\rMaking tarball for sample \"$${samp}\""                                             &&  \
    1.80 +	 $(CT_NG) tarball                                                                               &&  \
    1.81 +	 echo -e "\rSuccessfully built tarball for sample \"$${samp}\""                                 ;   \
    1.82 +	 echo -e "\rCleaning sample \"$${samp}\""                                                       ;   \
    1.83 +	 $(CT_NG) distclean                                                                             ;   \
    1.84 +	 echo -e "\r"
    1.85  
    1.86  saveconfig:
    1.87  	@$(CT_LIB_DIR)/scripts/saveSample.sh