summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-07-01 16:00:17 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-07-01 16:01:04 +0200
commit9a0d9de7b5acb449548462d6821175747c941526 (patch)
tree1296e6484b15c3477c787a13d7f70c162c702751 /tests
parent8f4068a52481a316a358eefb1cc27ab7133c4d66 (diff)
downloadalpine-conf-9a0d9de7b5acb449548462d6821175747c941526.zip
libalpine.sh: add tests for available_ifaces
Diffstat (limited to 'tests')
-rwxr-xr-xtests/libalpine_test42
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/libalpine_test b/tests/libalpine_test
index 6611cac..993104e 100755
--- a/tests/libalpine_test
+++ b/tests/libalpine_test
@@ -2,7 +2,10 @@
. $(atf_get_srcdir)/test_env.sh
init_tests \
- libalpine_isin
+ libalpine_isin \
+ libalpine_available_ifaces \
+ libalpine_available_ifaces_bond \
+ libalpine_available_ifaces_bridge
libalpine=$(atf_get_srcdir)/../libalpine.sh
@@ -13,3 +16,40 @@ libalpine_isin_body() {
isin "with space" foo "with space" "other space" || atf_fail 'isin "with space" foo "with space" "other space'
}
+libalpine_available_ifaces_body() {
+ init_env
+ mkdir -p sys/class/net/lo sys/class/net/eth0
+ echo 1 >sys/class/net/lo/ifindex
+ echo 2 >sys/class/net/eth0/ifindex
+ atf_check \
+ -o match:"lo eth0" \
+ sh -c ". $libalpine; available_ifaces"
+}
+
+libalpine_available_ifaces_bond_body() {
+ init_env
+ mkdir -p sys/class/net/lo \
+ sys/class/net/eth0/master/bonding \
+ sys/class/net/bond0
+ echo 1 >sys/class/net/lo/ifindex
+ echo 2 >sys/class/net/eth0/ifindex
+ echo 3 >sys/class/net/bond0/ifindex
+
+ atf_check \
+ -o match:"lo bond0" \
+ sh -c ". $libalpine; available_ifaces"
+}
+
+libalpine_available_ifaces_bridge_body() {
+ init_env
+ mkdir -p sys/class/net/lo \
+ sys/class/net/eth0/brport \
+ sys/class/net/br0
+ echo 1 >sys/class/net/lo/ifindex
+ echo 2 >sys/class/net/eth0/ifindex
+ echo 3 >sys/class/net/br0/ifindex
+
+ atf_check \
+ -o match:"lo br0" \
+ sh -c ". $libalpine; available_ifaces"
+}