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.
This commit is contained in:
Yann E. MORIN" 2007-07-09 20:58:46 +00:00
parent ba2827e22d
commit 4707ea0357

View File

@ -14,20 +14,30 @@ help-samples::
help-build::
@echo ' regtest - Regtest-build all samples'
@echo ' regtest-local - Regtest-build all local samples'
@echo ' regtest-global - Regtest-build all global samples'
# How we do build one sample
PHONY += $(CT_SAMPLES)
$(CT_SAMPLES):
@$(MAKE) -f $(CT_MAKEFILE) $(patsubst %,%_copy_config,$(@)) oldconfig
@$(CT_NG) $(patsubst %,copy_config_%,$(@)) oldconfig
$(patsubst %,%_copy_config,$(CT_SAMPLES)):
@if [ -f $(CT_TOP_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config ]; then \
cp "$(CT_TOP_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
$(patsubst %,copy_config_%,$(CT_SAMPLES)):
@if [ -f $(CT_TOP_DIR)/samples/$(patsubst copy_config_%,%,$(@))/crosstool.config ]; then \
cp "$(CT_TOP_DIR)/samples/$(patsubst copy_config_%,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
else \
cp "$(CT_LIB_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
cp "$(CT_LIB_DIR)/samples/$(patsubst copy_config_%,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
fi
# And now for building all samples one after the other
PHONY += regtest regtest_local regtest_global
regtest: regtest-local regtest-global
regtest-local: $(patsubst %,regtest_%,$(CT_TOP_SAMPLES))
regtest-global: $(patsubst %,regtest_%,$(CT_LIB_SAMPLES))
# One regtest per sample
# We could use a simple rule like: 'regtest: $(CT_SAMPLES)', but that doesn't
# work because we want to save the samples as well.
# Also, we don't want to see anylog at all, save for the elapsed time, and we
@ -36,28 +46,26 @@ $(patsubst %,%_copy_config,$(CT_SAMPLES)):
# Finaly, we can't use 'make sample-name' as we need to provide default values
# if the options set has changed, but oldconfig does not like when stdin is
# not a terminal (eg. it is a pipe).
PHONY += regtest
regtest:
@for samp in $(CT_SAMPLES); do \
echo -e "\rBuilding sample \"$${samp}\"" && \
$(CT_NG) $${samp}_copy_config && \
yes "" |$(CT_NG) defoldconfig >/dev/null 2>&1 && \
sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config && \
sed -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config && \
sed -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config && \
sed -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config && \
sed -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config && \
sed -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config && \
yes "" |$(CT_NG) defoldconfig >/dev/null 2>&1 && \
$(CT_NG) build && \
echo -e "\rSuccessfully built sample \"$${samp}\"" && \
echo -e "\rMaking tarball for sample \"$${samp}\"" && \
$(CT_NG) tarball && \
echo -e "\rSuccessfully built tarball for sample \"$${samp}\"" ; \
echo -e "\rCleaning sample \"$${samp}\"" ; \
$(CT_NG) distclean ; \
echo -e "\r" ; \
done
$(patsubst %,regtest_%,$(CT_SAMPLES)):
@samp=$(patsubst regtest_%,%,$@) ; \
echo -e "\rBuilding sample \"$${samp}\"" && \
$(CT_NG) copy_config_$${samp} && \
yes "" |$(CT_NG) defoldconfig >/dev/null 2>&1 && \
sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config && \
sed -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config && \
sed -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config && \
sed -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config && \
sed -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config && \
sed -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config && \
yes "" |$(CT_NG) defoldconfig >/dev/null 2>&1 && \
$(CT_NG) build && \
echo -e "\rSuccessfully built sample \"$${samp}\"" && \
echo -e "\rMaking tarball for sample \"$${samp}\"" && \
$(CT_NG) tarball && \
echo -e "\rSuccessfully built tarball for sample \"$${samp}\"" ; \
echo -e "\rCleaning sample \"$${samp}\"" ; \
$(CT_NG) distclean ; \
echo -e "\r"
saveconfig:
@$(CT_LIB_DIR)/scripts/saveSample.sh