Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hkctkuy committed Nov 2, 2023
1 parent 95eca0b commit 63e27c7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
2 changes: 0 additions & 2 deletions casr/src/bin/casr-cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ fn make_clusters(inpath: &Path, outpath: Option<&Path>, jobs: usize, dedup: bool
traces.write().unwrap().push(trace);
filtered_casreps.write().unwrap().push(casreps[i].clone());
}
// TODO: Try to avoid of checking same cond
if dedup {
crashlines.write().unwrap().push(report.crashline);
}
Expand Down Expand Up @@ -410,7 +409,6 @@ fn main() -> Result<()> {
)
.get_matches();

// Init log
init_ignored_frames!("cpp", "rust", "python", "go", "java");

// Get number of threads
Expand Down
1 change: 1 addition & 0 deletions casr/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2416,6 +2416,7 @@ fn test_casr_cluster_c() {
// Check crashline deduplication:
// 2.casrep and 20.caserp without crashlines => no dedup
// 3.casrep and 30.caserp with crashlines => dedup
// Thus, cluster with 2.casrep has 2 casreps and others have 1 casrep
for i in 1..clusters_cnt + 1 {
let cluster_path = paths[1].to_owned() + "/cl" + &i.to_string();
let size = std::fs::read_dir(cluster_path.clone()).unwrap().count();
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ Tool for clustering CASR reports

If you set `CASR_CLUSTER_UNIQUE_CRASHLINE` environment variable as "1"
casr-cluster will deduplicate reports by crashline for each cluster and won't if
you set ant other value or do not set anything.
you set any other value or do not set anything.

Report deduplication and clustering is based on stack trace comparison from
[gdb-command](https://github.com/anfedotoff/gdb-command). The idea is to run
Expand Down
7 changes: 2 additions & 5 deletions libcasr/src/stacktrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,9 @@ pub fn cluster_stacktraces(stacktraces: &[Stacktrace]) -> Result<Vec<usize>> {
/// * 'clusters' - An vector of the same length as `crashlines`.
/// Vec\[i\] is the flat cluster number to which original casrep i belongs.
///
/// * cluster_num - number of cluster
///
/// # Return value
///
/// An vector of the same length as `crashlines`.
/// An vector of the same length as `clusters`.
/// Vec\[i\] is the flat cluster number to which original casrep i belongs,
/// if Vec\[i\] is 0, casrep crashline is duplicate of some other
pub fn dedup_crashlines(crashlines: &[String], clusters: Vec<usize>) -> Result<Vec<usize>> {
Expand All @@ -275,8 +273,7 @@ pub fn dedup_crashlines(crashlines: &[String], clusters: Vec<usize>) -> Result<V
let mut unique_crashlines: Vec<HashSet<String>> = vec![HashSet::new(); cluster_num];

// Dedup reports by crashlibe
for i in 0..crashlines.len() {
let crashline = &crashlines[i];
for (i, crashline) in crashlines.iter().enumerate() {
// Leave report in the cluster if crashline is absent
if crashline.is_empty() || unique_crashlines[clusters[i] - 1].insert(crashline.to_string())
{
Expand Down

0 comments on commit 63e27c7

Please sign in to comment.