Skip to content

Commit 03cfa60

Browse files
committed
[Tools] add options to tv
1 parent 938ed5b commit 03cfa60

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ docker run -it optimuzz
1717
# Inside the docker
1818
echo $PWD # /home/user/optimuzz
1919
./build.sh
20+
eval $(opam env) # Optimuzz toolchains are installed under the current opam switch
2021
```
2122

2223
### Environment Variables

tools/tv.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222

2323
parser.add_argument('--opt-bin', type=Path, help='path to the opt binary', required=True)
2424
parser.add_argument('--passes', type=str, help='passes to run with opt', default='instcombine')
25-
parser.add_argument('-j', '--jobs', type=int, help='number of parallel jobs', default=os.cpu_count() // 8)
2625

26+
parser.add_argument('--no-undef', action='store_true', help='disable undef inputs')
27+
parser.add_argument('--no-poison', action='store_true', help='disable poison inputs')
28+
29+
parser.add_argument('-j', '--jobs', type=int, help='number of parallel jobs', default=os.cpu_count() // 8)
2730
parser.add_argument('--cont', action='store_true', help='continue TV even if the first miscompilation is found')
2831

2932
# Placeholder removed as args parsing is moved under __main__
@@ -36,8 +39,12 @@ def run_opt(d: Path, timeout: str = '2s', passes: str = 'instcombine', save_resu
3639
return opt_result if save_result else None
3740
return None
3841

39-
def run_tv(before: Path, after: Path, timeout: str = '2m'):
40-
tv_args = ['timeout', timeout, 'alive-tv', after.absolute().as_posix(), before.absolute().as_posix()]
42+
def run_tv(before: Path, after: Path, timeout: str = '2m', no_undef: bool = False, no_poison: bool = False):
43+
tv_args = ['timeout', timeout, 'alive-tv', before.absolute().as_posix(), after.absolute().as_posix()]
44+
if no_undef:
45+
tv_args.append('--disable-undef-input')
46+
if no_poison:
47+
tv_args.append('--disable-poison-input')
4148
tv_p = sp.run(tv_args, capture_output=True, text=True)
4249
if "1 incorrect" in tv_p.stdout:
4350
return "incorrect"
@@ -80,7 +87,7 @@ def process_file(target: Path, crash_dir: Path):
8087

8188

8289
def postmortem(covers_dir: Path, crash_dir: Path, jobs: int, cont: bool = False):
83-
files = [d.absolute() for d in covers_dir.iterdir() if d.suffix == '.ll']
90+
files = [d.absolute() for d in covers_dir.iterdir() if d.suffix == '.ll' and 'opt.ll' not in d.name]
8491
files = unique_sorted_files(files)
8592
print(f"Found {len(files)} files to process", file=sys.stderr)
8693

0 commit comments

Comments
 (0)