• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) 2024-2025 Cyril Hrubis <chrubis@suse.cz>
4#
5# This is a minimal test environment for a shell scripts executed from C by
6# tst_run_shell() function. Shell tests must use the tst_loader.sh instead!
7#
8
9tst_script_name=$(basename $0)
10
11# bash does not expand aliases in non-iteractive mode, enable it
12if [ -n "$BASH_VERSION" ]; then
13	shopt -s expand_aliases
14fi
15
16# dash does not support line numbers even though this is mandated by POSIX
17if [ -z "$LINENO" ]; then
18	LINENO=-1
19fi
20
21if [ -z "$LTP_IPC_PATH" ]; then
22	echo "This script has to be executed from a LTP loader!"
23	exit 1
24fi
25
26tst_brk_()
27{
28	tst_res_ "$@"
29
30	case "$3" in
31		"TBROK") exit 2;;
32		*) exit 0;;
33	esac
34}
35
36alias tst_res="tst_res_ $tst_script_name \$LINENO"
37alias tst_brk="tst_brk_ $tst_script_name \$LINENO"
38