Skip to content

Commit

Permalink
Fix the error for for_each when it's not run in the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
KanRobert committed Sep 10, 2024
1 parent d3df9c4 commit 81819b6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions for_each.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import argparse, csv, os, subprocess, glob
from subprocess import PIPE


if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Process all the files in the directory by running sde2csv, csv2json, annotater, bb2fline on them. The mapping from workloads to files is described by a csv file, where name, exe, sim_files are required.')
Expand All @@ -13,6 +12,7 @@
parser.add_argument('--addr2line', default='addr2line', help='path of addr2line (this is needed if dwarf format of binary is not supported by system addr2line)')
args = parser.parse_args()

repo = os.path.dirname(os.path.realpath(__file__))
popen_objs = []
with open(args.csv, 'r') as csv_file:
reader = csv.DictReader(csv_file)
Expand All @@ -33,10 +33,10 @@

for sim_file in sim_files:
sim_file_path = os.path.join(sub_dir, sim_file)
subprocess.run(['./sde2csv.py', sim_file_path, exe_path, f'--items={items}'], check=True)
subprocess.run(['./csv2json.py'] + glob.glob(f'{sim_file_path}.*.csv'), check=True)
annoator_popen = subprocess.Popen(['./annotater.py', disasm, f'{sim_file_path}.json'])
bb2fline_popen = subprocess.Popen(['./bb2fline.py', f'{sim_file_path}.bb.csv', exe_path, '--addr2line', args.addr2line])
subprocess.run([os.path.join(repo, 'sde2csv.py'), sim_file_path, exe_path, f'--items={items}'], check=True)
subprocess.run([os.path.join(repo, 'csv2json.py')] + glob.glob(f'{sim_file_path}.*.csv'), check=True)
annoator_popen = subprocess.Popen([os.path.join(repo, 'annotater.py'), disasm, f'{sim_file_path}.json'])
bb2fline_popen = subprocess.Popen([os.path.join(repo, 'bb2fline.py'), f'{sim_file_path}.bb.csv', exe_path, '--addr2line', args.addr2line])
popen_objs += [annoator_popen, bb2fline_popen]

for obj in popen_objs:
Expand Down

0 comments on commit 81819b6

Please sign in to comment.