tools/testing/selftests/net/rds/rds_run.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/rds/rds_run.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/rds/rds_run.sh
Extension
.sh
Size
8752 bytes
Lines
320
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

set -e
set -u

unset KBUILD_OUTPUT

current_dir="$(realpath "$(dirname "$0")")"
build_dir="$current_dir"

build_include="$current_dir/include.sh"
if test -f "$build_include"; then
	# this include will define "$mk_build_dir" as the location the test was
	# built.  We will need this if the tests are installed in a location
	# other than the kernel source

	source "$build_include"
	build_dir="$mk_build_dir"
fi

# Source settings for timeout value (also used by ksft runner)
source "$current_dir"/settings

# This test requires kernel source and the *.gcda data therein
# Locate the top level of the kernel source, and the net/rds
# subfolder with the appropriate *.gcno object files
ksrc_dir="$(realpath "$build_dir"/../../../../../)"
kconfig="$ksrc_dir/.config"
obj_dir="$ksrc_dir/net/rds"

GCOV_CMD=gcov

#check to see if the host has the required packages to generate a gcov report
check_gcov_env()
{
	if ! which "$GCOV_CMD" > /dev/null 2>&1; then
		echo "# Warning: Could not find gcov. "
		GENERATE_GCOV_REPORT=0
		return
	fi

	# the gcov version must match the gcc version
	GCC_VER=$(gcc -dumpfullversion)
	GCOV_VER=$($GCOV_CMD -v | grep gcov | awk '{print $3}'| awk 'BEGIN {FS="-"}{print $1}')
	if [ "$GCOV_VER" != "$GCC_VER" ]; then
		#attempt to find a matching gcov version
		GCOV_CMD=gcov-$(gcc -dumpversion)

		if ! which "$GCOV_CMD" > /dev/null 2>&1; then
			echo "# Warning: Could not find an appropriate gcov installation. \
				gcov version must match gcc version"
			GENERATE_GCOV_REPORT=0
			return
		fi

		#recheck version number of found gcov executable
		GCOV_VER=$($GCOV_CMD -v | grep gcov | awk '{print $3}'| \
			awk 'BEGIN {FS="-"}{print $1}')
		if [ "$GCOV_VER" != "$GCC_VER" ]; then
			echo "# Warning: Could not find an appropriate gcov installation. \
				gcov version must match gcc version"
			GENERATE_GCOV_REPORT=0
		else
			echo "# Warning: Mismatched gcc and gcov detected.  Using $GCOV_CMD"
		fi
	fi
}

# Check to see if the kconfig has the required configs to generate a coverage report

Annotation

Implementation Notes