mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 12:09:31 +00:00
The tests require root privileges and have been silently failing in CI because of that. We will need a mechanism to run tests as root to enable these. See b/256221093 BUG=b:244623459 TEST=presubmit Change-Id: If812c219f44221275eabb2892891fd05b432d2fb Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3990012 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Auto-Submit: Dennis Kempin <denniskempin@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
40 lines
1,021 B
Rust
40 lines
1,021 B
Rust
// Copyright 2022 The ChromiumOS Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#![cfg(unix)]
|
|
|
|
use std::net;
|
|
|
|
use net_util::sys::unix::Tap;
|
|
use net_util::MacAddress;
|
|
use net_util::TapTCommon;
|
|
|
|
#[test]
|
|
#[ignore = "Requires root privileges"]
|
|
fn tap_create() {
|
|
Tap::new(true, false).unwrap();
|
|
}
|
|
|
|
#[test]
|
|
#[ignore = "Requires root privileges"]
|
|
fn tap_configure() {
|
|
let tap = Tap::new(true, false).unwrap();
|
|
let ip_addr: net::Ipv4Addr = "100.115.92.5".parse().unwrap();
|
|
let netmask: net::Ipv4Addr = "255.255.255.252".parse().unwrap();
|
|
let mac_addr: MacAddress = "a2:06:b9:3d:68:4d".parse().unwrap();
|
|
|
|
tap.set_ip_addr(ip_addr).unwrap();
|
|
tap.set_netmask(netmask).unwrap();
|
|
tap.set_mac_address(mac_addr).unwrap();
|
|
tap.set_vnet_hdr_size(16).unwrap();
|
|
tap.set_offload(0).unwrap();
|
|
}
|
|
|
|
#[test]
|
|
#[ignore = "Requires root privileges"]
|
|
fn tap_enable() {
|
|
let tap = Tap::new(true, false).unwrap();
|
|
|
|
tap.enable().unwrap();
|
|
}
|