()
| 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() { |
nothing calls this directly
no test coverage detected