From a1bdc438f3e17b0c30f3a53b0bc5e38ebb7bb936 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 7 Dec 2023 10:59:10 +0100 Subject: just-mrrc: support file options for the launcher functionality When just-mr acts as a launcher, for most subcommand options the "just args" entry in the rc files provides a convenient way to set them. However, some options take a file as argument; for those it can be desirable to set them without assuming a fixed file-system layout and instead refer to logical roots, in particular the work space. for the ones that refer to files, it is often desirable to have a potential reference to the work space. Add this functionality. --- test/end-to-end/just-mr/defaults.sh | 72 +++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'test') diff --git a/test/end-to-end/just-mr/defaults.sh b/test/end-to-end/just-mr/defaults.sh index 57b020f6..12ed5c5f 100644 --- a/test/end-to-end/just-mr/defaults.sh +++ b/test/end-to-end/just-mr/defaults.sh @@ -36,6 +36,10 @@ cat > "${SAMPLE_RC}" <&1 test $(jq '. == [ {"foo": "bar", "baz": "baz"}, {"foo": "override"}, {"x": "y"}] ' "${PARSE_DIR}/defines") = true +## -c + +# honored from rc-file if present +touch sample-config.json +"${JUST_MR}" --local-build-root "${LBR}" --just "${PARSE}" \ + --rc "${SAMPLE_RC}" build "${PARSE_DIR}" 2>&1 +[ -f "${PARSE_DIR}/config" ] + +# not honored for non-analysing subcommands +"${JUST_MR}" --local-build-root "${LBR}" --just "${PARSE}" \ + --rc "${SAMPLE_RC}" install-cas "${PARSE_DIR}" 2>&1 +[ -f "${PARSE_DIR}/config" ] && exit 1 || : + +# not considered an error if not present +rm -f sample-config.json +"${JUST_MR}" --local-build-root "${LBR}" --just "${PARSE}" \ + --rc "${SAMPLE_RC}" build "${PARSE_DIR}" 2>&1 +[ -f "${PARSE_DIR}/config" ] && exit 1 || : + +# not considered, if key not present in rc +cat > tmprc.json <<'EOF' +{"just files": {"unrelated": 123}} +EOF +"${JUST_MR}" --local-build-root "${LBR}" --just "${PARSE}" \ + --rc tmprc.json build "${PARSE_DIR}" 2>&1 +[ -f "${PARSE_DIR}/config" ] && exit 1 || : + +## --endpoint-configuration + +# honored from rc-file if present +touch endpoint.json +"${JUST_MR}" --local-build-root "${LBR}" --just "${PARSE}" \ + --rc "${SAMPLE_RC}" build "${PARSE_DIR}" 2>&1 +[ -f "${PARSE_DIR}/endpoint" ] + +# not honored for non-endpoint-specific subcommands +"${JUST_MR}" --local-build-root "${LBR}" --just "${PARSE}" \ + --rc "${SAMPLE_RC}" install-cas "${PARSE_DIR}" 2>&1 +[ -f "${PARSE_DIR}/endpoint" ] && exit 1 || : + +# not considered an error if not present +rm -f endpoint.json +"${JUST_MR}" --local-build-root "${LBR}" --just "${PARSE}" \ + --rc "${SAMPLE_RC}" build "${PARSE_DIR}" 2>&1 +[ -f "${PARSE_DIR}/endpoint" ] && exit 1 || : + +# not considered, if key not present in rc +cat > tmprc.json <<'EOF' +{"just files": {"unrelated": 123}} +EOF +"${JUST_MR}" --local-build-root "${LBR}" --just "${PARSE}" \ + --rc tmprc.json build "${PARSE_DIR}" 2>&1 +[ -f "${PARSE_DIR}/endpoint" ] && exit 1 || : + echo OK -- cgit v1.2.3