mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-14 22:38:46 +00:00
Remove some deadcode and tqdm
This commit is contained in:
@@ -5,7 +5,6 @@ use ordered_float::OrderedFloat;
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::ir::*;
|
||||
use crate::*;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum Value {
|
||||
|
||||
@@ -3,9 +3,9 @@ use std::path::Path;
|
||||
|
||||
use lang_c::*;
|
||||
|
||||
use crate::Translate;
|
||||
use crate::ir::*;
|
||||
use crate::utils::AssertSupported;
|
||||
use crate::{Translate, *};
|
||||
|
||||
peg::parser! {
|
||||
grammar ir_parse() for str {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use crate::*;
|
||||
|
||||
mod deadcode;
|
||||
mod gvn;
|
||||
mod mem2reg;
|
||||
|
||||
@@ -194,9 +194,11 @@ pub fn test_irgen(path: &Path) {
|
||||
println!("clang (expected): {}, kecc: {}", status as u8, value as u8);
|
||||
if status as u8 != value as u8 {
|
||||
let mut stderr = io::stderr().lock();
|
||||
stderr.write_fmt(format_args!(
|
||||
"[irgen] Failed to correctly generate {path:?}.\n\n [incorrect ir]"
|
||||
));
|
||||
stderr
|
||||
.write_fmt(format_args!(
|
||||
"[irgen] Failed to correctly generate {path:?}.\n\n [incorrect ir]"
|
||||
))
|
||||
.unwrap();
|
||||
write(&ir, &mut stderr).unwrap();
|
||||
drop(stderr);
|
||||
panic!("[irgen]");
|
||||
|
||||
@@ -51,28 +51,6 @@ CSMITH_DIR = "csmith-2.3.0"
|
||||
SKIP_TEST = 102
|
||||
|
||||
|
||||
class ProgressBar:
|
||||
def __init__(self):
|
||||
self.stage = 0
|
||||
self.stage_indicators = [
|
||||
"-",
|
||||
"\\",
|
||||
"|",
|
||||
"/",
|
||||
]
|
||||
self.pbar = tqdm.tqdm(
|
||||
total=1, bar_format="{l_bar}{bar}| [Elapsed:{elapsed}, <ETA:{remaining}]"
|
||||
)
|
||||
self.last_progress = 0
|
||||
|
||||
def print_progressbar(self, progress):
|
||||
indicator = self.stage_indicators[self.stage % len(self.stage_indicators)]
|
||||
self.stage += 1
|
||||
self.pbar.set_description(indicator)
|
||||
self.pbar.update(progress - self.last_progress)
|
||||
self.last_progress = progress
|
||||
|
||||
|
||||
def execute_command(command, cwd=None):
|
||||
try:
|
||||
process = subprocess.Popen(
|
||||
@@ -300,17 +278,6 @@ def creduce(tests_dir, fuzz_arg, analyze):
|
||||
proc = subprocess.Popen(
|
||||
args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=tests_dir
|
||||
)
|
||||
pbar = ProgressBar()
|
||||
while True:
|
||||
line = proc.stdout.readline()
|
||||
if not line:
|
||||
break
|
||||
line = line.decode()
|
||||
if "%" in line:
|
||||
try:
|
||||
pbar.print_progressbar(abs(float(line[1 : line.index("%")])) / 100)
|
||||
except:
|
||||
pass # This is for potential error
|
||||
(out, err) = proc.communicate()
|
||||
if proc.returncode != 0:
|
||||
print(out.decode())
|
||||
@@ -456,8 +423,6 @@ if __name__ == "__main__":
|
||||
)
|
||||
|
||||
if args.reduce:
|
||||
import tqdm
|
||||
|
||||
creduce(tests_dir, fuzz_arg, args.clang_analyze)
|
||||
else:
|
||||
fuzz(tests_dir, fuzz_arg, args.num, args.easy)
|
||||
|
||||
Reference in New Issue
Block a user