Skip to content

Commit

Permalink
better ice classification
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Apr 12, 2024
1 parent 2a64f78 commit fe94431
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ http://github.com/langston-barrett/tree-splicer code mutator which icemaker can

Trophy case (1120+):

https://github.com/rust-lang/rust/issues/123863
https://github.com/rust-lang/rust/issues/123862
https://github.com/rust-lang/rust/issues/123861
https://github.com/rust-lang/rust/issues/123821
https://github.com/rust-lang/rust/issues/123818
https://github.com/rust-lang/rust/issues/123810
https://github.com/rust-lang/rust/issues/123809
Expand Down
2 changes: 1 addition & 1 deletion src/fuzz_tree_splicer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::time::{Instant};
use std::time::Instant;

use rand::Rng;
use tree_sitter::{Parser, Tree};
Expand Down
2 changes: 2 additions & 0 deletions src/ice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ impl Default for ICEKind {

#[derive(Debug, Default, Serialize, Deserialize, Clone, Copy, Eq, PartialEq)]
pub enum Interestingness {
VeryInteresting,
#[default]
Interesting,
Boring,
Expand Down Expand Up @@ -103,6 +104,7 @@ impl ICE {
// print a ICE to stdout or something
pub(crate) fn to_printable(&self) -> ICEDisplay {
let kind = match self.kind {
ICEKind::Ice(Interestingness::VeryInteresting) => "ICE!".red(),
ICEKind::Ice(Interestingness::Interesting) => "ICE".red(),
ICEKind::Ice(Interestingness::Boring) => "ice".normal(),
ICEKind::Ub(UbKind::Interesting) => "UB".green(),
Expand Down
31 changes: 31 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,8 @@ impl ICE {
silent: bool,
global_tempdir_path: &PathBuf,
) -> Option<Self> {
// potentially very intersting?

// convert IntoIterator<Item &&str> to &[&str]
let compiler_flags = &compiler_flags.into_iter().cloned().collect::<Vec<&str>>()[..];

Expand Down Expand Up @@ -1070,12 +1072,39 @@ impl ICE {
let stderr = String::from_utf8_lossy(&cmd_output.stderr);
let mut lines_iter = stderr.lines();

//potentially_very_interesting
let mut pviopt = None;

let mut ice_msg = lines_iter
.find(|line| {
line.contains("panicked at") || line.contains("error: internal compiler error: ")
})
.unwrap_or_default()
.to_string();

if stderr
.lines()
.nth(0)
.map(|line| line.contains(&ice_msg))
.is_some()
{
pviopt = Some(Interestingness::VeryInteresting);
}

// iff potentially_very_interesting is Some, map Interesting to VeryInterestinge else return whatever else we had
fn pvi(
prev_intr: ICEKind,
potentially_very_interesting: Option<Interestingness>,
) -> ICEKind {
if matches!(prev_intr, ICEKind::Ice(Interestingness::Interesting))
&& potentially_very_interesting.is_some()
{
ICEKind::Ice(Interestingness::VeryInteresting)
} else {
prev_intr
}
}

if ice_msg.contains("panicked at") {
// the panick message is actually on the next line
let panic_msg = lines_iter
Expand All @@ -1084,6 +1113,7 @@ impl ICE {
// reconstruct the old one-line panic msg, somewhat
ice_msg = format!(r#"{ice_msg} '{panic_msg}'"#);
}
drop(lines_iter);

ice_msg = ice_msg.replace("error: internal compiler error:", "ICE:");

Expand Down Expand Up @@ -1121,6 +1151,7 @@ impl ICE {
// this is basically an unprocessed ICE, we know we have crashed, but we have not reduced the flags yet.
// prefer return this over returning an possible hang while minimizing flags later
let raw_ice = if let Some((ice_msg, icekind, query_stack)) = found_error.clone() {
let icekind = pvi(icekind, pviopt);
let ice = ICE {
regresses_on: Regression::Master,
needs_feature: uses_feature,
Expand Down

0 comments on commit fe94431

Please sign in to comment.