summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/rds/config.sh
blob: 29a79314dd60f578c233fd20dd9c57f43110702c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0

set -e
set -u
set -x

unset KBUILD_OUTPUT
CONF_FILE=""
FLAGS=()

GENERATE_GCOV_REPORT=0
while getopts "gc:" opt; do
  case ${opt} in
    g)
      GENERATE_GCOV_REPORT=1
      ;;
    c)
      CONF_FILE=$OPTARG
      ;;
    :)
      echo "USAGE: config.sh [-g] [-c config]"
      exit 1
      ;;
    ?)
      echo "Invalid option: -${OPTARG}."
      exit 1
      ;;
  esac
done

if [[ "$CONF_FILE" != "" ]]; then
	FLAGS=(--file "$CONF_FILE")
fi

# no modules
scripts/config "${FLAGS[@]}" --disable CONFIG_MODULES

# enable RDS
scripts/config "${FLAGS[@]}" --enable CONFIG_RDS
scripts/config "${FLAGS[@]}" --enable CONFIG_RDS_TCP

if [ "$GENERATE_GCOV_REPORT" -eq 1 ]; then
	# instrument RDS and only RDS
	scripts/config "${FLAGS[@]}" --enable CONFIG_GCOV_KERNEL
	scripts/config "${FLAGS[@]}" --disable GCOV_PROFILE_ALL
	scripts/config "${FLAGS[@]}" --enable GCOV_PROFILE_RDS
else
	scripts/config "${FLAGS[@]}" --disable CONFIG_GCOV_KERNEL
	scripts/config "${FLAGS[@]}" --disable GCOV_PROFILE_ALL
	scripts/config "${FLAGS[@]}" --disable GCOV_PROFILE_RDS
fi

# need network namespaces to run tests with veth network interfaces
scripts/config "${FLAGS[@]}" --enable CONFIG_NET_NS
scripts/config "${FLAGS[@]}" --enable CONFIG_VETH

# simulate packet loss
scripts/config "${FLAGS[@]}" --enable CONFIG_NET_SCH_NETEM