Fix OSDK for Rust 2024
This commit is contained in:
parent
6d2679852f
commit
ab26968458
|
|
@ -198,6 +198,7 @@ dependencies = [
|
|||
"quote",
|
||||
"regex",
|
||||
"rev_buf_reader",
|
||||
"rustc_version",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"shlex",
|
||||
|
|
@ -205,6 +206,7 @@ dependencies = [
|
|||
"tempfile",
|
||||
"toml",
|
||||
"which",
|
||||
"whoami",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -620,6 +622,17 @@ dependencies = [
|
|||
"rle-decode-fast",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-bzimage-builder"
|
||||
version = "0.16.1"
|
||||
|
|
@ -787,9 +800,9 @@ checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
|
|||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.5.12"
|
||||
version = "0.5.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af"
|
||||
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
]
|
||||
|
|
@ -847,6 +860,15 @@ version = "1.0.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
||||
dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.44"
|
||||
|
|
@ -891,6 +913,12 @@ version = "1.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.219"
|
||||
|
|
@ -1070,6 +1098,12 @@ dependencies = [
|
|||
"wit-bindgen-rt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasite"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.100"
|
||||
|
|
@ -1128,6 +1162,16 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.77"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-time"
|
||||
version = "1.1.0"
|
||||
|
|
@ -1149,6 +1193,17 @@ dependencies = [
|
|||
"winsafe",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "whoami"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d"
|
||||
dependencies = [
|
||||
"libredox",
|
||||
"wasite",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.61.0"
|
||||
|
|
|
|||
|
|
@ -93,20 +93,20 @@ impl Bundle {
|
|||
|
||||
let _dir_guard = DirGuard::change_dir(&path);
|
||||
|
||||
if let Some(aster_bin) = &manifest.aster_bin {
|
||||
if !aster_bin.validate() {
|
||||
return None;
|
||||
}
|
||||
if let Some(aster_bin) = &manifest.aster_bin
|
||||
&& !aster_bin.validate()
|
||||
{
|
||||
return None;
|
||||
}
|
||||
if let Some(vm_image) = &manifest.vm_image {
|
||||
if !vm_image.validate() {
|
||||
return None;
|
||||
}
|
||||
if let Some(vm_image) = &manifest.vm_image
|
||||
&& !vm_image.validate()
|
||||
{
|
||||
return None;
|
||||
}
|
||||
if let Some(initramfs) = &manifest.initramfs {
|
||||
if !initramfs.validate() {
|
||||
return None;
|
||||
}
|
||||
if let Some(initramfs) = &manifest.initramfs
|
||||
&& !initramfs.validate()
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(Self {
|
||||
|
|
@ -359,17 +359,17 @@ impl Bundle {
|
|||
// Setting a QEMU log is required for source line stack trace because piping the output
|
||||
// is less desirable when running QEMU with serial redirected to standard I/O.
|
||||
let qemu_log_path = config.work_dir.join("qemu.log");
|
||||
if let Ok(file) = std::fs::File::open(&qemu_log_path) {
|
||||
if let Some(aster_bin) = &self.manifest.aster_bin {
|
||||
crate::util::trace_panic_from_log(file, self.path.join(aster_bin.path()));
|
||||
}
|
||||
if let Ok(file) = std::fs::File::open(&qemu_log_path)
|
||||
&& let Some(aster_bin) = &self.manifest.aster_bin
|
||||
{
|
||||
crate::util::trace_panic_from_log(file, self.path.join(aster_bin.path()));
|
||||
}
|
||||
|
||||
// Find the coverage data information in "qemu.log", and dump it if found.
|
||||
if let Some(qemu_monitor_stream) = qemu_monitor_stream {
|
||||
if let Ok(file) = std::fs::File::open(&qemu_log_path) {
|
||||
crate::util::dump_coverage_from_qemu(file, qemu_monitor_stream);
|
||||
}
|
||||
if let Some(qemu_monitor_stream) = qemu_monitor_stream
|
||||
&& let Ok(file) = std::fs::File::open(&qemu_log_path)
|
||||
{
|
||||
crate::util::dump_coverage_from_qemu(file, qemu_monitor_stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -282,8 +282,8 @@ impl DebugProfileOutArgs {
|
|||
/// the default format is flame graph.
|
||||
pub fn format(&self) -> ProfileFormat {
|
||||
self.format.unwrap_or_else(|| {
|
||||
if self.output.is_some() {
|
||||
match self.output.as_ref().unwrap().extension() {
|
||||
if let Some(output) = &self.output {
|
||||
match output.extension() {
|
||||
Some(ext) if ext == "folded" => ProfileFormat::Folded,
|
||||
Some(ext) if ext == "json" => ProfileFormat::Json,
|
||||
Some(ext) if ext == "svg" => ProfileFormat::FlameGraph,
|
||||
|
|
|
|||
|
|
@ -150,11 +150,11 @@ pub fn do_cached_build(
|
|||
);
|
||||
|
||||
// Check the existing bundle's reusability
|
||||
if let Some(existing_bundle) = get_reusable_existing_bundle(&bundle_path, config, action) {
|
||||
if aster_elf.modified_time() < &existing_bundle.last_modified_time() {
|
||||
info!("Reusing existing bundle: aster_elf is unchanged");
|
||||
return existing_bundle;
|
||||
}
|
||||
if let Some(existing_bundle) = get_reusable_existing_bundle(&bundle_path, config, action)
|
||||
&& aster_elf.modified_time() < &existing_bundle.last_modified_time()
|
||||
{
|
||||
info!("Reusing existing bundle: aster_elf is unchanged");
|
||||
return existing_bundle;
|
||||
}
|
||||
|
||||
// Build a new bundle
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use super::scheme::Scheme;
|
|||
|
||||
use crate::{error::Errno, error_msg, util::get_cargo_metadata};
|
||||
|
||||
#[expect(dead_code)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct OsdkMeta {
|
||||
#[serde(rename(serialize = "type", deserialize = "type"))]
|
||||
|
|
|
|||
|
|
@ -126,30 +126,30 @@ fn canonicalize_and_eval(action_scheme: &mut ActionScheme, workdir: &PathBuf) {
|
|||
canonicalize(initramfs);
|
||||
}
|
||||
|
||||
if let Some(ref mut qemu) = action_scheme.qemu {
|
||||
if let Some(ref mut qemu_path) = qemu.path {
|
||||
canonicalize(qemu_path);
|
||||
}
|
||||
if let Some(ref mut qemu) = action_scheme.qemu
|
||||
&& let Some(ref mut qemu_path) = qemu.path
|
||||
{
|
||||
canonicalize(qemu_path);
|
||||
}
|
||||
|
||||
if let Some(ref mut grub) = action_scheme.grub {
|
||||
if let Some(ref mut grub_mkrescue_path) = grub.grub_mkrescue {
|
||||
canonicalize(grub_mkrescue_path);
|
||||
}
|
||||
if let Some(ref mut grub) = action_scheme.grub
|
||||
&& let Some(ref mut grub_mkrescue_path) = grub.grub_mkrescue
|
||||
{
|
||||
canonicalize(grub_mkrescue_path);
|
||||
}
|
||||
}
|
||||
|
||||
// Do evaluations on the need to be evaluated string field, namely,
|
||||
// QEMU arguments.
|
||||
|
||||
if let Some(ref mut qemu) = action_scheme.qemu {
|
||||
if let Some(ref mut args) = qemu.args {
|
||||
*args = match eval(workdir, args) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
error_msg!("Failed to evaluate qemu args: {:#?}", e);
|
||||
process::exit(Errno::ParseMetadata as _);
|
||||
}
|
||||
if let Some(ref mut qemu) = action_scheme.qemu
|
||||
&& let Some(ref mut args) = qemu.args
|
||||
{
|
||||
*args = match eval(workdir, args) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
error_msg!("Failed to evaluate qemu args: {:#?}", e);
|
||||
process::exit(Errno::ParseMetadata as _);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,12 +52,12 @@ pub struct Scheme {
|
|||
|
||||
macro_rules! inherit_optional {
|
||||
($from:ident, $to:ident, .$field:ident) => {
|
||||
if $to.$field.is_none() {
|
||||
$to.$field = $from.$field.clone();
|
||||
} else {
|
||||
if let Some($field) = &$from.$field {
|
||||
$to.$field.as_mut().unwrap().inherit($field);
|
||||
if let Some(ref mut to_field) = $to.$field {
|
||||
if let Some(from_field) = &$from.$field {
|
||||
to_field.inherit(from_field);
|
||||
}
|
||||
} else {
|
||||
$to.$field = $from.$field.clone();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,14 +23,16 @@ pub fn split_to_kv_array(args: &str) -> Vec<String> {
|
|||
let mut joined = Vec::<String>::new();
|
||||
let mut last_has_value = false;
|
||||
for elem in target {
|
||||
if !elem.starts_with('-') && !last_has_value {
|
||||
if let Some(last) = joined.last_mut() {
|
||||
last.push(' ');
|
||||
last.push_str(&elem);
|
||||
last_has_value = true;
|
||||
continue;
|
||||
}
|
||||
if !elem.starts_with('-')
|
||||
&& !last_has_value
|
||||
&& let Some(last) = joined.last_mut()
|
||||
{
|
||||
last.push(' ');
|
||||
last.push_str(&elem);
|
||||
last_has_value = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
joined.push(elem);
|
||||
last_has_value = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,21 +293,19 @@ pub fn trace_panic_from_log(qemu_log: File, bin_path: PathBuf) {
|
|||
println!("[OSDK] The kernel seems panicked. Parsing stack trace for source lines:");
|
||||
trace_exists = true;
|
||||
}
|
||||
if trace_exists {
|
||||
if let Some(cap) = pc_matcher.captures(&line) {
|
||||
let pc = cap.get(1).unwrap().as_str();
|
||||
let mut stdin = addr2line_proc.stdin.as_ref().unwrap();
|
||||
stdin.write_all(pc.as_bytes()).unwrap();
|
||||
stdin.write_all(b"\n").unwrap();
|
||||
let mut function = String::new();
|
||||
let mut line = String::new();
|
||||
let mut stdout = BufReader::new(addr2line_proc.stdout.as_mut().unwrap());
|
||||
stdout.read_line(&mut function).unwrap();
|
||||
stdout.read_line(&mut line).unwrap();
|
||||
stack_num += 1;
|
||||
println!("({: >3}) {}", stack_num, function.trim());
|
||||
println!(" at {}", line.trim());
|
||||
}
|
||||
if trace_exists && let Some(cap) = pc_matcher.captures(&line) {
|
||||
let pc = cap.get(1).unwrap().as_str();
|
||||
let mut stdin = addr2line_proc.stdin.as_ref().unwrap();
|
||||
stdin.write_all(pc.as_bytes()).unwrap();
|
||||
stdin.write_all(b"\n").unwrap();
|
||||
let mut function = String::new();
|
||||
let mut line = String::new();
|
||||
let mut stdout = BufReader::new(addr2line_proc.stdout.as_mut().unwrap());
|
||||
stdout.read_line(&mut function).unwrap();
|
||||
stdout.read_line(&mut line).unwrap();
|
||||
stack_num += 1;
|
||||
println!("({: >3}) {}", stack_num, function.trim());
|
||||
println!(" at {}", line.trim());
|
||||
}
|
||||
}
|
||||
addr2line_proc.kill().unwrap();
|
||||
|
|
|
|||
Loading…
Reference in New Issue