tools/testing/selftests/net/forwarding/lib_sh_test.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/forwarding/lib_sh_test.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/lib_sh_test.sh
Extension
.sh
Size
3744 bytes
Lines
216
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

# This tests the operation of lib.sh itself.

ALL_TESTS="
	test_ret
	test_exit_status
"
NUM_NETIFS=0
source lib.sh

# Simulated checks.

do_test()
{
	local msg=$1; shift

	"$@"
	check_err $? "$msg"
}

tpass()
{
	do_test "tpass" true
}

tfail()
{
	do_test "tfail" false
}

tfail2()
{
	do_test "tfail2" false
}

txfail()
{
	FAIL_TO_XFAIL=yes do_test "txfail" false
}

# Simulated tests.

pass()
{
	RET=0
	do_test "true" true
	log_test "true"
}

fail()
{
	RET=0
	do_test "false" false
	log_test "false"
}

xfail()
{
	RET=0
	FAIL_TO_XFAIL=yes do_test "xfalse" false
	log_test "xfalse"
}

skip()
{
	RET=0
	log_test_skip "skip"
}

Annotation

Implementation Notes