File: ensure-prerequisite-interface.patch

package info (click to toggle)
ipset 7.24-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,376 kB
  • sloc: ansic: 32,867; sh: 5,855; makefile: 246; awk: 3
file content (24 lines) | stat: -rw-r--r-- 780 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Description: Ensure that the prerequisite interface exist in system under test
 The regression tests rely on the interface eth0 which may unavailable
 in the system under test, eg. KVM Virtual Machine.
 Therefore, add the script to check and add the dummy interface if necessary
Author: Neutron Soutmun <neo.neutron@gmail.com>
Forwarded: not-needed 
Last-Update: 2021-01-17

--- a/tests/runtest.sh
+++ b/tests/runtest.sh
@@ -76,6 +76,13 @@
 # Make sure the scripts are executable
 chmod a+x check_* *.sh
 
+# Make sure the prerequisite interface exist
+if ! ip link show dev eth0 >/dev/null 2>&1; then
+  ip link add eth0 type dummy
+  ip addr add dev eth0 10.255.255.0/24
+  ip link set dev eth0 up
+fi
+
 failcount=0
 for types in $tests; do
     $ipset -X test >/dev/null 2>&1