|
| 1 | +// Copyright 2025 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +use std::env; |
| 16 | +use std::path::Path; |
| 17 | + |
| 18 | +use crate::loader::linux::load; |
| 19 | +use crate::mem::mapped::{ArcMemPages, RamBus}; |
| 20 | +use crate::mem::{MemRegionEntry, MemRegionType}; |
| 21 | + |
| 22 | +#[test] |
| 23 | +fn test_load() { |
| 24 | + let pages = ArcMemPages::from_anonymous(30 << 20, None, None).unwrap(); |
| 25 | + let ram = RamBus::new(); |
| 26 | + ram.add(0, pages).unwrap(); |
| 27 | + |
| 28 | + let entries = [( |
| 29 | + 0, |
| 30 | + MemRegionEntry { |
| 31 | + size: 30 << 20, |
| 32 | + type_: MemRegionType::Ram, |
| 33 | + }, |
| 34 | + )]; |
| 35 | + let dir = env::var_os("CARGO_MANIFEST_DIR").unwrap(); |
| 36 | + let path = Path::new(&dir).join("../resources/vmlinuz-x86_64-6.17.y"); |
| 37 | + load(&ram, &entries, &path, None, None).unwrap(); |
| 38 | +} |
0 commit comments