xref: /linux/tools/objtool/tests/run-tests.sh (revision c009fabc865200029173eb40db62f407225043d4)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3#
4# Run the objtool klp tests.  Each test-*.sh prints one TAP result line.
5#
6# The harness checks the environment once up front and fails the run if the
7# suite cannot execute, rather than letting every test skip and exit 0.
8
9set -u
10
11cd "$(dirname "$0")" || exit 1
12
13tests=( test-*.sh )
14[ "${tests[0]}" = "test-*.sh" ] && { echo "1..0 # SKIP no tests found"; exit 0; }
15
16# Sourcing the harness runs its preflight, and exports what it found so the
17# tests inherit it rather than working it out again.
18. ./lib.sh
19
20echo "1..${#tests[@]}"
21
22rc=0
23for t in "${tests[@]}"; do
24	./"$t" || rc=1
25done
26
27exit $rc
28