Skip to content

Commit

Permalink
Fixed a couple corner cases in scripts when fields are empty
Browse files Browse the repository at this point in the history
- Fixed added/removed count in scripts when an entry has no field in
  the expected results

- Fixed a python-sort-type issue when by-field is missing in a result
  • Loading branch information
geky committed Nov 28, 2022
1 parent 0b11ce0 commit 387cf6f
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 1 deletion.
6 changes: 6 additions & 0 deletions scripts/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,9 @@ def main(obj_paths, *,
with openio(args['use']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('code_'+k in r and r['code_'+k].strip()
for k in CodeResult._fields):
continue
try:
results.append(CodeResult(
**{k: r[k] for k in CodeResult._by
Expand Down Expand Up @@ -566,6 +569,9 @@ def main(obj_paths, *,
with openio(args['diff']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('code_'+k in r and r['code_'+k].strip()
for k in CodeResult._fields):
continue
try:
diff_results.append(CodeResult(
**{k: r[k] for k in CodeResult._by
Expand Down
6 changes: 6 additions & 0 deletions scripts/cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ def main(gcda_paths, *,
with openio(args['use']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('cov_'+k in r and r['cov_'+k].strip()
for k in CovResult._fields):
continue
try:
results.append(CovResult(
**{k: r[k] for k in CovResult._by
Expand Down Expand Up @@ -639,6 +642,9 @@ def main(gcda_paths, *,
with openio(args['diff']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('cov_'+k in r and r['cov_'+k].strip()
for k in CovResult._fields):
continue
try:
diff_results.append(CovResult(
**{k: r[k] for k in CovResult._by
Expand Down
3 changes: 3 additions & 0 deletions scripts/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,9 @@ def main(obj_paths, *,
with openio(args['diff']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('data_'+k in r and r['data_'+k].strip()
for k in DataResult._fields):
continue
try:
diff_results.append(DataResult(
**{k: r[k] for k in DataResult._by
Expand Down
6 changes: 6 additions & 0 deletions scripts/perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,9 @@ def report(perf_paths, *,
with openio(args['use']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('perf_'+k in r and r['perf_'+k].strip()
for k in PerfResult._fields):
continue
try:
results.append(PerfResult(
**{k: r[k] for k in PerfResult._by
Expand Down Expand Up @@ -1073,6 +1076,9 @@ def report(perf_paths, *,
with openio(args['diff']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('perf_'+k in r and r['perf_'+k].strip()
for k in PerfResult._fields):
continue
try:
diff_results.append(PerfResult(
**{k: r[k] for k in PerfResult._by
Expand Down
6 changes: 6 additions & 0 deletions scripts/perfbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,9 @@ def report(obj_path='', trace_paths=[], *,
with openio(args['use']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('perfbd_'+k in r and r['perfbd_'+k].strip()
for k in PerfBdResult._fields):
continue
try:
results.append(PerfBdResult(
**{k: r[k] for k in PerfBdResult._by
Expand Down Expand Up @@ -1053,6 +1056,9 @@ def report(obj_path='', trace_paths=[], *,
with openio(args['diff']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('perfbd_'+k in r and r['perfbd_'+k].strip()
for k in PerfBdResult._fields):
continue
try:
diff_results.append(PerfBdResult(
**{k: r[k] for k in PerfBdResult._by
Expand Down
6 changes: 6 additions & 0 deletions scripts/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,9 @@ def main(ci_paths,
with openio(args['use']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('stack_'+k in r and r['stack_'+k].strip()
for k in StackResult._fields):
continue
try:
results.append(StackResult(
**{k: r[k] for k in StackResult._by
Expand Down Expand Up @@ -591,6 +594,9 @@ def main(ci_paths,
with openio(args['diff']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('stack_'+k in r and r['stack_'+k].strip()
for k in StackResult._fields):
continue
try:
diff_results.append(StackResult(
**{k: r[k] for k in StackResult._by
Expand Down
6 changes: 6 additions & 0 deletions scripts/struct_.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ def main(obj_paths, *,
with openio(args['use']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('struct_'+k in r and r['struct_'+k].strip()
for k in StructResult._fields):
continue
try:
results.append(StructResult(
**{k: r[k] for k in StructResult._by
Expand Down Expand Up @@ -516,6 +519,9 @@ def main(obj_paths, *,
with openio(args['diff']) as f:
reader = csv.DictReader(f, restval='')
for r in reader:
if not any('struct_'+k in r and r['struct_'+k].strip()
for k in StructResult._fields):
continue
try:
diff_results.append(StructResult(
**{k: r[k] for k in StructResult._by
Expand Down
8 changes: 7 additions & 1 deletion scripts/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def infer(results, *,
# create result class
def __new__(cls, **r):
return cls.__mro__[1].__new__(cls,
**{k: r.get(k) for k in by},
**{k: r.get(k, '') for k in by},
**{k: r[k] if k in r and isinstance(r[k], list)
else [types[k](r[k])] if k in r
else []
Expand Down Expand Up @@ -631,6 +631,9 @@ def main(csv_paths, *,
renames=renames)
results_ = []
for r in results:
if not any(k in r and r[k].strip()
for k in Result._fields):
continue
try:
results_.append(Result(**{
k: r[k] for k in Result._by + Result._fields
Expand Down Expand Up @@ -676,6 +679,9 @@ def main(csv_paths, *,
r_[new_k] = r[old_k]
r.update(r_)

if not any(k in r and r[k].strip()
for k in Result._fields):
continue
try:
diff_results.append(Result(**{
k: r[k] for k in Result._by + Result._fields
Expand Down

0 comments on commit 387cf6f

Please sign in to comment.