| 26 | |
| 27 | |
| 28 | def validate_report(report, iterations): |
| 29 | expected = {(case, backend, iteration) for case in CASES |
| 30 | for backend in ('graph', 'span') for iteration in range(iterations)} |
| 31 | seen = set() |
| 32 | for sample in report['samples']: |
| 33 | key = (sample['case'], sample['backend'], sample['iteration']) |
| 34 | if key not in expected or key in seen: |
| 35 | raise ValueError('unexpected or duplicate sample: ' + repr(key)) |
| 36 | seen.add(key) |
| 37 | if not isinstance(sample['total_ns'], int) or sample['total_ns'] <= 0: |
| 38 | raise ValueError('nonpositive or invalid sample duration') |
| 39 | if seen != expected: |
| 40 | raise ValueError('not all paired cases produced samples') |
| 41 | |
| 42 | |
| 43 | def digest(path): |