[BC BREAK] check target supplier customization

This allows customizing from the command-line what suppliers should be
checked.  This motivation for this is both to run as part of a distributed
pipeline (where each supplier may be built individually), and for during
development of a single supplier.

BC BREAK: Note that this will now check for `package' in the test path for
UI tests.  To keep the old directory around, a symlink of `packages' to `ui'
would suffice.

* build-aux/Makefile (SUPPLIERS, suppliers_strip): New variables.
  (check-am): BC-BREAK: Build and check only requested suppliers.
* build-aux/progtest-runner: BC-BREAK: First argument is now test directory
    and all remaining arguments specify the supplier XML files to check.
master
Mike Gerwitz 2018-12-18 21:42:54 -05:00
parent 32e3b16ec9
commit 73f6b77771
2 changed files with 19 additions and 16 deletions

View File

@ -40,6 +40,10 @@ src_c1map := $(wildcard $(path_c1map)/*.xml)
src_common := $(shell find $(path_common) -name '*.xml')
xmlo_common := $(patsubst %.xml, %.xmlo, $(src_common))
# Intended to be (optionally) overridden from the command line
SUPPLIERS=$(src_suppliers) $(path_ui)/package.xml
suppliers_strip=$(patsubst %.xml, %.strip.js, $(SUPPLIERS))
dest_summary_html := $(patsubst \
$(path_suppliers)/%.xml, \
$(path_suppliers)/%.html, \
@ -281,10 +285,13 @@ intralov-root: summary-html
ln -fL $(path_dsl)/scripts/*.js "$(path_intralov_root)/rater/scripts/"
ln -fL $(path_suppliers)/*.{html,js} "$(path_intralov_root)/suppliers"
# Suppliers to check may be overridden using SUPPLIERS. Multiple suppliers
# should be space-delimited. Note that the UI is considered to be a special
# type of supplier (ui/package.xml) and is included by default in the value
# of SUPPLIERS.
check-am: $(suppliers_strip)
$(path_dsl)/build-aux/progtest-runner $(path_tests) $(SUPPLIERS)
test: check
check-am: strip
@$(path_dsl)/build-aux/progtest-runner $(path_suppliers) $(path_tests)
@$(path_dsl)/build-aux/progtest-runner ui/package.xml $(path_tests)/ui
kill-tamed: tamed-die
tamed-die:

View File

@ -15,27 +15,23 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is intended to be called directly by make; it's API is
# subject to change. Please use `make check` as appropriate.
##
declare path_suppliers="${1?Missing supplier path}"
declare path_tests="${2?Missing supplier test path}"
declare -i result=0
declare suppliers
# if a file was provided, use it as the sole supplier; otherwise,
# treat it as a directory of suppliers
if [ -f "$path_suppliers" ]; then
suppliers=( "$path_suppliers" )
path_suppliers=$( dirname "$path_suppliers" )
else
suppliers=( "$path_suppliers"/*.xml )
fi
# The first argument indicates the test directory.
declare -r path_tests=${1?Missing test path}
shift
# run tests for each supplier individually
for supplier in "${suppliers[@]}"; do
# All remaining arguments are taken to be a list of suppliers to test.
for supplier in "$@"; do
base=$( basename "$supplier" .xml )
path_suppliers=$( dirname "$supplier" )
tests=$( find -L "$path_tests"/"$base"/ -name '*.yml' )
echo