Skip to content

Commit 27f6bdd

Browse files
committed
dv: add krate field to MergeHashKaniList
1 parent d27dc4c commit 27f6bdd

File tree

5 files changed

+43853
-3
lines changed

5 files changed

+43853
-3
lines changed

src/bin/verify_rust_std/merge.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use distributed_verification::{
55
diff::{KaniListJson, MergeHashKaniList},
66
logger,
77
};
8-
use std::collections::HashMap;
8+
use std::{collections::HashMap, path::PathBuf};
99

1010
pub fn run(args: &[String]) -> Result<()> {
1111
logger::init();
@@ -17,7 +17,7 @@ pub fn run(args: &[String]) -> Result<()> {
1717
struct SubCmdMerge {
1818
/// Path to hash json file which is generated by distributed-verification.
1919
#[arg(long)]
20-
hash_json: String,
20+
hash_json: PathBuf,
2121

2222
/// Strip file path prefix in hash json.
2323
#[arg(long, default_value_t)]
@@ -36,7 +36,9 @@ impl SubCmdMerge {
3636
fn run(self) -> Result<()> {
3737
debug!(?self);
3838

39-
let mut hash_json: Vec<SerFunction> = crate::read_json(&self.hash_json)?;
39+
// NOTE: extract crate_name from crate_name.json, since we don't store crate_name in data.
40+
let crate_name = self.hash_json.file_stem().unwrap().to_str().unwrap();
41+
let mut hash_json: Vec<SerFunction> = crate::read_json(self.hash_json.to_str().unwrap())?;
4042

4143
let mut kani_list: KaniListJson = crate::read_json(&self.kani_list)?;
4244
// normalize paths like core/src/../../portable-simd/crates/core_simd/src/masks.rs
@@ -63,6 +65,7 @@ impl SubCmdMerge {
6365
None => (None, None),
6466
};
6567
v_merge.push(MergeHashKaniList {
68+
krate: crate_name.into(),
6669
file: file.into(),
6770
func: func.into(),
6871
hash,

src/diff.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ impl MergedHarnesses<'_> {
249249
/// Merge hash json and kani-list.
250250
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
251251
pub struct MergeHashKaniList {
252+
#[serde(rename = "crate")]
253+
pub krate: Box<str>,
252254
pub file: Box<str>,
253255
pub func: Box<str>,
254256
#[serde(skip_serializing_if = "Option::is_none")]

0 commit comments

Comments
 (0)