MCPcopy Create free account
hub / github.com/argumentcomputer/ix / rs_kernel_check_ixon

Function rs_kernel_check_ixon

crates/ffi/src/kernel.rs:588–702  ·  view source on GitHub ↗
(
  env_path: LeanString<LeanBorrowed<'_>>,
  names: LeanArray<LeanBorrowed<'_>>,
  expect_pass: LeanArray<LeanBorrowed<'_>>,
  quiet: LeanBool<LeanBorrowed<'_>>,
  fail_out: LeanString<LeanBorrowed<'

Source from the content-addressed store, hash-verified

586/// observers see entries as they happen), and capped with a `# total
587/// failures: N` footer once all checks complete. The format is the same
588/// one `Ix.Cli.CheckIxonCmd.readNamesFile` expects (`#`-prefixed comments
589/// plus bare-name lines), so the file is round-trippable as a
590/// `--consts-file` input on a re-run.
591#[unsafe(no_mangle)]
592pub extern "C" fn rs_kernel_check_ixon(
593 env_path: LeanString<LeanBorrowed<'_>>,
594 names: LeanArray<LeanBorrowed<'_>>,
595 expect_pass: LeanArray<LeanBorrowed<'_>>,
596 quiet: LeanBool<LeanBorrowed<'_>>,
597 fail_out: LeanString<LeanBorrowed<'_>>,
598) -> LeanIOResult<LeanOwned> {
599 let total_start = Instant::now();
600 let quiet = quiet.to_bool();
601 let path = env_path.to_string();
602 let fail_out_path = fail_out.to_string();
603 let fail_out_path =
604 if fail_out_path.is_empty() { None } else { Some(fail_out_path) };
605 let names_vec: Vec<Name> = decode_name_array(&names);
606 let expect_pass_vec: Vec<bool> =
607 expect_pass.map(|b| b.unbox_usize() == 1).into_iter().collect();
608
609 let t0 = Instant::now();
610 let bytes = match std::fs::read(&path) {
611 Ok(bytes) => bytes,
612 Err(e) => {
613 return LeanIOResult::error_string(&format!(
614 "rs_kernel_check_ixon: failed to read {path}: {e}"
615 ));
616 },
617 };
618 eprintln!(
619 "[rs_kernel_check_ixon] read env: {:>8.1?} ({} bytes)",
620 t0.elapsed(),
621 bytes.len()
622 );
623
624 let t1 = Instant::now();
625 let mut slice: &[u8] = &bytes;
626 let ixon_env = match IxonEnv::get(&mut slice) {
627 Ok(env) => env,
628 Err(e) => {
629 return LeanIOResult::error_string(&format!(
630 "rs_kernel_check_ixon: failed to deserialize {path}: {e}"
631 ));
632 },
633 };
634 drop(bytes);
635 eprintln!(
636 "[rs_kernel_check_ixon] deserialize:{:>8.1?} ({} named)",
637 t1.elapsed(),
638 ixon_env.named_count()
639 );
640
641 // Open the streaming failure log up front so any seed that fails
642 // mid-run is persisted before this function returns. We open it before
643 // the ingress lookups are built so that even a setup-time crash leaves
644 // the user with a header noting the env path and seed count.
645 let failure_log: Option<Arc<FailureLog>> = match fail_out_path.as_deref() {

Callers

nothing calls this directly

Calls 10

decode_name_arrayFunction · 0.85
build_uniform_errorFunction · 0.85
build_result_arrayFunction · 0.85
finalizeMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
cloneMethod · 0.45
countMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected