Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
google
GitHub Repository: google/crosvm
Path: blob/main/e2e_tests/tests/backcompat.rs
5394 views
1
// Copyright 2022 The ChromiumOS Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
use fixture::vm::Config;
6
use fixture::vm::TestVm;
7
8
// Tests for possible backwards compatibility issues.
9
//
10
// There is no backwards compatibility policy yet, these are just "change detector" tests. If you
11
// break a test, make sure the change is intended and then ask in go/crosvm-chat to see if anyone
12
// objects to updating the golden file.
13
14
// Many changes to PCI devices can cause issues, e.g. some users depend on crosvm always choosing
15
// the same PCI slots for particular devices.
16
#[test]
17
fn backcompat_test() {
18
let mut vm = TestVm::new(Config::new()).unwrap();
19
backcompat_test_simple_lspci(&mut vm);
20
}
21
22
#[test]
23
fn backcompat_test_disable_sandbox() {
24
let mut vm = TestVm::new(Config::new().disable_sandbox()).unwrap();
25
backcompat_test_simple_lspci(&mut vm);
26
}
27
28
fn backcompat_test_simple_lspci(vm: &mut TestVm) {
29
let expected = include_str!("goldens/backcompat_test_simple_lspci.txt").trim();
30
let result = vm
31
.exec_in_guest("lspci -n")
32
.unwrap()
33
.stdout
34
.trim()
35
.replace('\r', "");
36
assert_eq!(
37
expected,
38
result,
39
"PCI Devices changed:\n<<< Expected <<<\n{expected}\n<<<<<<<<<<<<<<<<\n>>> Got >>>\n{result}\n>>>>>>>>>>>>>>>>\n"
40
);
41
}
42
43