Skip to content

mk/run-tests.sh requires bash, though the build no longer does #199

Description

@geisten

The build no longer needs bash. The test runner still does, and fails confusingly when it is absent.

Background

mk/detect-target.sh used to carry a #!/usr/bin/env bash shebang while using no bash feature; on an image without bash it produced an empty TARGET and the build died on mk/target-.mk. That is fixed — it is #!/bin/sh now.

mk/run-tests.sh is the remaining bash dependency, and this one is real: it uses [[ ]], declare -a and array expansion.

Where

mk/run-tests.sh — lines using [[ -z "$BIN_DIR" ]], declare -a CANDIDATES, for b in "${CANDIDATES[@]}".

Reproduce

On any image without bash (Alpine's build-base does not pull it in):

docker run --rm -v "$PWD:/src" -w /src alpine:3.21 sh -c \
  'apk add --no-cache build-base linux-headers && make GEMM_PROVIDER=native test-unit'

Two acceptable outcomes

Either is fine — pick one and say which in the PR:

  1. Port it to POSIX sh. The arrays hold a short list of filename globs; a space-free set -- / "$@" list or a newline-separated variable covers it.
  2. Keep bash, declare it. Add bash to the documented test prerequisites and make the failure explicit (command -v bash check with a message), so it does not look like a build bug.

Done when

The command above either runs the unit tests or fails with a message that names bash as the missing prerequisite. make test-unit on macOS and glibc Linux is unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions