Fixed a couple corner cases in scripts when fields are empty

- 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
This commit is contained in:
Christopher Haster
2022-11-19 01:43:28 -06:00
parent 0b11ce03b7
commit 387cf6f6e0
8 changed files with 46 additions and 1 deletions

View File

@ -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
@ -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

View File

@ -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
@ -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

View File

@ -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

View File

@ -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
@ -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

View File

@ -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
@ -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

View File

@ -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
@ -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

View File

@ -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
@ -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

View File

@ -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 []
@ -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
@ -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