From e04e0aa09d849dac141c69a27d676e53438eefc0 Mon Sep 17 00:00:00 2001 From: Peter Portante Date: Mon, 2 May 2022 07:21:10 -0400 Subject: [PATCH] Backport testing of source tree builds This is a simple backport of commit #9e9dec8a4 [1]. [1] https://github.com/distributed-system-analysis/pbench/commit/9e9dec8a4f6945be2e8cb71b93deba295a0a89fa --- exec-unittests | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/exec-unittests b/exec-unittests index 542ac8c4ba..1bb77d900e 100755 --- a/exec-unittests +++ b/exec-unittests @@ -82,6 +82,37 @@ function para_run_legacy { # Export functions for use with `parallel` below. export -f para_run_legacy run_legacy _time +function verify_make_source_tree { + # The agent and server-side sub-trees have individual ways to create the + # source tree for a tar ball. This function executes that step for the + # given sub-tree. + # + # Arguments: + # _major -- Name of the sub-tree to execute the "make install" + # + # Returns the exit status of the "make install" execution, or the exit + # status dependent command steps (e.g. make, cd, etc.). + local _major=${1} + local _rc + + if [[ ! -d ${_toxenvdir}/src ]]; then + mkdir ${_toxenvdir}/src || return ${?} + fi + local _dir=${_toxenvdir}/src/${_major} + rm -rf ${_dir} + mkdir ${_dir} || return ${?} + + printf -- "\n\n\nVerifying %s source tree build\n\n" "${_major^}" + (cd ${_major} && make DESTDIR=${_dir} install) + _rc=${?} + if [[ ${_rc} -ne 0 ]]; then + printf -- "\n%s source tree build failed with '%s'\n\n" "${_major^}" "${_rc}" + else + printf -- "\n%s source tree build succeeded\n\n" "${_major^}" + fi + return ${_rc} +} + rc=0 if [[ -n "${COV_REPORT_XML}" ]]; then @@ -128,6 +159,9 @@ trap "rm -f ${_para_jobs_file}" EXIT INT TERM let count=0 for _major in ${major_list}; do + # Verify the Agent or Server Makefile functions correctly. + verify_make_source_tree ${_major} || rc=1 + if [[ "${_major}" == "agent" ]]; then # The parallel program is really cool. The usage of `parallel` is # internal and automated; only test code depends on this tool, and we, @@ -151,7 +185,7 @@ for _major in ${major_list}; do run_legacy ${_major} bin ${posargs} || rc=1 fi else - printf -- "Logic bomb! Unrecognized major test sub-set, '%s'\n" "${_major}" >&2 + printf -- "Error - unrecognized major test sub-set, '%s'\n" "${_major}" >&2 rc=1 fi done