#!/bin/bash # MobileGL - scripts/ci/control_smoke_test.sh # Copyright (c) 2025-2026 MobileGL-Dev # Licensed under the GNU Lesser General Public License v3.0: # https://www.gnu.org/licenses/gpl-3.0.txt # https://www.gnu.org/licenses/lgpl-3.0.txt # SPDX-License-Identifier: LGPL-3.0-only # End of Source File Header # A smoke test for the CI negative controls themselves. # # A negative control is a gate, and a workflow `run:` block only executes on a runner, so this # file runs the real control script - the same file .github/workflows/test.yml invokes, not a copy # of it - against a stubbed ctest, and checks that it passes exactly when it should. # # The case that matters is the first one. A stubbed ctest reports a non-empty selection and then # fails with UNRELATED_CONTROL_FAILURE: a reason that has nothing to do with the knob the control # turns. The control must report FAILED on it, and PASSED only on its scenarios' own diagnostic. # # usage: control_smoke_test.sh set -u HERE="$(cd "$(dirname "$0")" && pwd)" WORK="$(mktemp -d)" || exit 1 trap 'rm -rf "${WORK}"' EXIT STUB_DIR="${WORK}/stub" mkdir -p "${STUB_DIR}" cp "${HERE}/testdata/stub_ctest.sh" "${STUB_DIR}/ctest" chmod +x "${STUB_DIR}/ctest" passes=0 failures=0 # expect