test_build.sh: Allow to override Make and Meson commands
Add a few variables that can be set in the environment. Set sane
defaults, but allow them to be empty. This way the calling envi-
ronment can decide which tests will be performed.
To expand multiple, quoted arguments correctly from the passed
$(MAKEARGS) and $(MESONARGS), we run the actual commands through
`eval'.
Change-Id: Iad8d6c7084998eda7b1f01bb6962cc3c2e90d537
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/140
diff --git a/test_build.sh b/test_build.sh
index fbd3431..245430c 100755
--- a/test_build.sh
+++ b/test_build.sh
@@ -22,10 +22,14 @@
"${prog}" -p dummy:emulate=M25P10.RES,image="${TEMP_DIR}/image" -c M25P10 -v "${TEMP_DIR}/empty"
}
-${MAKECMD:-make} clean
-${MAKECMD:-make} -j${CPUS:-$(nproc)} CC="${CC:-ccache cc}" CONFIG_EVERYTHING=yes
-test_prog ./flashprog
+if [ "${MAKECMD=make}" ]; then
+ ${MAKECMD} clean
+ eval ${MAKECMD} -j${CPUS:-$(nproc)} CC="\"${CC:-ccache cc}\"" ${MAKEARGS-CONFIG_EVERYTHING=yes}
+ test_prog ./flashprog
+fi
-${MESONCMD:-meson} setup --buildtype release "${TEMP_DIR}/build"
-ninja ${CPUS:+-j${CPUS}} -C "${TEMP_DIR}/build"
-test_prog "${TEMP_DIR}/build/flashprog"
+if [ "${MESONCMD=meson}" ]; then
+ eval ${MESONCMD} setup ${MESONARGS--D programmer=all --buildtype release} "${TEMP_DIR}/build"
+ ninja ${CPUS:+-j${CPUS}} -C "${TEMP_DIR}/build"
+ test_prog "${TEMP_DIR}/build/flashprog"
+fi