2 Комити

Аутор SHA1 Порука Датум
  Yann Weber 6b4d840b4d First version of scripts пре 4 недеља
  Yann Weber 3470e453d2 First version of scripts пре 4 недеља
4 измењених фајлова са 41 додато и 23 уклоњено
  1. 1
    1
      Makefile
  2. 5
    0
      config.mk.inc
  3. 5
    1
      scripts/test_libvirt.expect
  4. 30
    21
      scripts/testlib.expect

+ 1
- 1
Makefile Прегледај датотеку

@@ -141,7 +141,7 @@ $(BZIMAGE_TEST): can_upgrade is_root
141 141
 	cp "$(BZIMAGE)" "$@"
142 142
 
143 143
 _virsh_test: $(BZIMAGE_TEST) can_upgrade is_root
144
-	@$(VIRSH_TEST_SCRIPT) "$(TEST_VM_HOSTNAME)" "$(VERSION)" "$(TEST_VM_NAME)" || {\
144
+	@$(VIRSH_TEST_SCRIPT) "$(TEST_VM_HOSTNAME)" "$(VERSION)" "$(TEST_VM_NAME)" "$(TEST_VM_IFNAME)" "$(TEST_VM_IPV4)" "$(TEST_VM_IPV6)" || {\
145 145
 		echo "$(CRED)Kernel $(VERSION) [Error]$(CRAZ): Check /tmp/test_vz5_expect.log" >&2;\
146 146
 		false;\
147 147
 	} && echo "$(CGRN)Kernel $(VERSION) [OK]$(CRAZ): console logs in /tmp/test_vz5_expect.log" >&2;

+ 5
- 0
config.mk.inc Прегледај датотеку

@@ -9,3 +9,8 @@ TEST_VM_HOSTNAME=test
9 9
 BZIMAGE_TEST=/srv/tftpd/boot/bzImageTest
10 10
 # virsh test vm name
11 11
 TEST_VM_NAME=test
12
+# test vm ifname
13
+TEST_VM_IFNAME=enp1s0
14
+# test vm ips
15
+TEST_VM_IPV4=10.0.2.42
16
+TEST_VM_IPV6=fe80::42

+ 5
- 1
scripts/test_libvirt.expect Прегледај датотеку

@@ -6,6 +6,9 @@ namespace eval VZ5 {
6 6
 	variable KVER "[lindex $argv 1]"
7 7
 }
8 8
 variable VMNAME "[lindex $argv 2]"
9
+variable VM_IFNAME "[lindex $argv 3]"
10
+variable VM_IPV4 "[lindex $argv 4]"
11
+variable VM_IPV6 "[lindex $argv 5]"
9 12
 
10 13
 set where [file dirname [info script]]
11 14
 source [file join $where testlib.expect]
@@ -37,7 +40,8 @@ test_base
37 40
 test_kernel_version $::VZ5::KVER
38 41
 test_swap
39 42
 test_ssh
40
-test_vz5_netconfig
43
+test_netconfig_ipv4 "$VM_IFNAME" "$VM_IPV4"
44
+test_netconfig_ipv6 "$VM_IFNAME" "$VM_IPV6"
41 45
 test_ping
42 46
 test_vda_rw
43 47
 test_apt

+ 30
- 21
scripts/testlib.expect Прегледај датотеку

@@ -51,20 +51,24 @@ proc login {} {
51 51
 	if { [exp_pid] == 0 } { destroy }
52 52
 	set timeout 15
53 53
 	expect "Console: " { termconfig } timeout destroy
54
-	expect {
55
-		"$::VZ5::HOSTNAME login:" {}
56
-		"FAIL" {
57
-			expect "\r"
58
-			expect "\r" {
59
-				sleep 2;
60
-				expect "login:" {
61
-					send "root\r";
62
-					vm_stty;
63
-					debug_interact;
54
+	if {[catch {
55
+		expect {
56
+			"$::VZ5::HOSTNAME login:" {}
57
+			"FAIL" {
58
+				expect "\r"
59
+				expect "\r" {
60
+					sleep 2;
61
+					expect "login:" {
62
+						send "root\r";
63
+						vm_stty;
64
+						debug_interact;
65
+					} timeout destroy
64 66
 				} timeout destroy
65
-			} timeout destroy
67
+			}
68
+			timeout destroy
66 69
 		}
67
-		timeout destroy
70
+	} err]} {
71
+		destroy
68 72
 	}
69 73
 	set timeout 5
70 74
 	if {[catch {send "root\r"} err]} {
@@ -132,15 +136,20 @@ proc test_ssh {} {
132 136
 
133 137
 }
134 138
 
135
-# Check for vz5 network address configuration
136
-proc test_vz5_netconfig {} {
137
-	set timeout 3
138
-	expect {
139
-		"[prompt]" { send "ip a\r" }
140
-		"2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP>" {} timeout abort
141
-		"inet 192.168.242." {} timeout abort
142
-		"inet6 2001:41d0:203:10ae:1312::" {} timeout abort
143
-	}
139
+# Check that given ifname has given IP (prefix, 10.0.2. will match 10.0.2.42)
140
+proc test_netconfig_ipv4 {ifname ip_prefix} {
141
+	set timeout 2
142
+	expect "[prompt]" { send "ip addr show $ifname\r" } timeout abort
143
+	expect ": $ifname: <BROADCAST,MULTICAST,UP,LOWER_UP>" {} timeout abort
144
+	expect "inet $ip_prefix" {} timeout abort
145
+}
146
+
147
+# Check that given ifname has given Ip (prefix, fe80:: will match fe80::1312)
148
+proc test_netconfig_ipv6 {ifname ip6_prefix} {
149
+	set timeout 5
150
+	expect "[prompt]" { send "ip a show $ifname\r" } timeout abort
151
+	expect ": $ifname: <BROADCAST,MULTICAST,UP,LOWER_UP>" {} timeout abort
152
+	expect "inet6 $ip6_prefix" {} timeout abort
144 153
 }
145 154
 
146 155
 # Testing that apt runs

Loading…
Откажи
Сачувај