xref: /linux/tools/testing/selftests/net/rds/config.sh (revision aec2f682d47c54ef434b2d440992626d80b1ebdc)
1#! /bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4set -e
5set -u
6set -x
7
8unset KBUILD_OUTPUT
9CONF_FILE=""
10FLAGS=()
11
12GENERATE_GCOV_REPORT=0
13while getopts "gc:" opt; do
14  case ${opt} in
15    g)
16      GENERATE_GCOV_REPORT=1
17      ;;
18    c)
19      CONF_FILE=$OPTARG
20      ;;
21    :)
22      echo "USAGE: config.sh [-g] [-c config]"
23      exit 1
24      ;;
25    ?)
26      echo "Invalid option: -${OPTARG}."
27      exit 1
28      ;;
29  esac
30done
31
32if [[ "$CONF_FILE" != "" ]]; then
33	FLAGS=(--file "$CONF_FILE")
34fi
35
36# no modules
37scripts/config "${FLAGS[@]}" --disable CONFIG_MODULES
38
39# enable RDS
40scripts/config "${FLAGS[@]}" --enable CONFIG_RDS
41scripts/config "${FLAGS[@]}" --enable CONFIG_RDS_TCP
42
43if [ "$GENERATE_GCOV_REPORT" -eq 1 ]; then
44	# instrument RDS and only RDS
45	scripts/config "${FLAGS[@]}" --enable CONFIG_GCOV_KERNEL
46	scripts/config "${FLAGS[@]}" --disable GCOV_PROFILE_ALL
47	scripts/config "${FLAGS[@]}" --enable GCOV_PROFILE_RDS
48else
49	scripts/config "${FLAGS[@]}" --disable CONFIG_GCOV_KERNEL
50	scripts/config "${FLAGS[@]}" --disable GCOV_PROFILE_ALL
51	scripts/config "${FLAGS[@]}" --disable GCOV_PROFILE_RDS
52fi
53
54# need network namespaces to run tests with veth network interfaces
55scripts/config "${FLAGS[@]}" --enable CONFIG_NET_NS
56scripts/config "${FLAGS[@]}" --enable CONFIG_VETH
57
58# simulate packet loss
59scripts/config "${FLAGS[@]}" --enable CONFIG_NET_SCH_NETEM
60
61