MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / test_tap_configure

Function test_tap_configure

net_util/src/tap.rs:728–740  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

726
727 #[test]
728 fn test_tap_configure() {
729 // This should be the first thing to be called inside the function, so everything else
730 // is torn down by the time the mutex is automatically released. Also, we should
731 // explicitly bind the MutexGuard to a variable via let, the make sure it lives until
732 // the end of the function.
733 let tap_ip_guard = TAP_IP_LOCK.lock().unwrap();
734
735 let tap = Tap::new(1).unwrap();
736 let ip_addr = IpAddr::V4((*tap_ip_guard).parse().unwrap());
737 let netmask = IpAddr::V4(SUBNET_MASK.parse().unwrap());
738
739 tap.set_ip_addr(ip_addr, Some(netmask)).unwrap();
740 }
741
742 #[test]
743 fn test_tap_configure_ipv6() {

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
set_ip_addrMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected