gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitc5d28fb5c5d28fb5Tickets conductor: S51 startedmrec5d28fb5/tests/realdata-compare-writes.py

1.6 KB

  1. #!/usr/bin/env python3
  2. # tests/realdata-compare-writes.py (mission 010): compare the WRITE part ('w-' files) of two realdata-baseline.mjs
  3. # runs. Besides realdata-compare.py's masks it masks
  4. # what a write makes new each run: mpackdb ids that the read part of the run never showed, epoch ms of today, Vienna
  5. # stamps "YYYY-MM-DD HH:MM" of today, the API token. Each new id is numbered in order of appearance, so the SAME
  6. # record must stand at the same places in both runs.
  7. import os, re, sys, time
  8. a, b = sys.argv[1], sys.argv[2]
  9. src = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'realdata-compare.py')).read()
  10. exec(src[src.index('masks = '):src.index('fa, fb')])
  11. known = set()
  12. for f in os.listdir(a):
  13. if '-w-' not in f: known |= set(re.findall(r'\b0m[0-9a-z]{10}\b', open(os.path.join(a, f)).read()))
  14. today = time.strftime('%Y-%m-%d')
  15. def wnorm(t, ids):
  16. t = norm(t)
  17. t = re.sub(r'tkt_[0-9a-f]{48}', 'TOKEN', t)
  18. t = re.sub(r'\b17\d{11}\b', 'MS', t)
  19. t = re.sub(today + r' \d\d:\d\d', 'STAMP', t)
  20. t = re.sub(r'\b0m[0-9a-z]{10}\b', lambda m: m.group(0) if m.group(0) in known else ids.setdefault(m.group(0), 'NEW%d' % len(ids)), t)
  21. return t
  22. fs = sorted(f for f in os.listdir(a) if '-w-' in f)
  23. assert fs == sorted(f for f in os.listdir(b) if '-w-' in f), 'file lists differ'
  24. ia, ib = {}, {}; bad = []
  25. for f in fs:
  26. x, y = wnorm(open(os.path.join(a, f)).read(), ia), wnorm(open(os.path.join(b, f)).read(), ib)
  27. if x != y: bad.append(f)
  28. print(f'{len(fs)} write files: {len(fs) - len(bad)} identical after masking, {len(bad)} DIFFERENT; new ids {len(ia)} / {len(ib)}')
  29. for f in bad[:20]: print(' DIFF', f)
  30. sys.exit(1 if bad else 0)

Branches

Latest commits

  • c5d28fb5Tickets conductor: S51 startedmre
  • fd6ca1e6Tickets conductor: brief 027 waker design, push-test projectmre
  • e448e656Tickets conductor: STATUS #51mre
  • 1c10857bTickets conductor: P51 eval, brief 027mre
  • e725969dTickets conductor: #51 directionmre
  • 1b5c63ddTickets conductor: P51 startedmre
  • 9f13fbdaTickets conductor: brief 026 prioritymre
  • acc477d9Tickets conductor: brief 026 + Vinzenz recommendationsmre
  • 9233a734Tickets conductor: brief 026 completemre
  • 5da589fdTickets conductor: brief 026 + Gitoria's answermre
  • a3cd5329Tickets conductor: tickets#51 opened, brief 026 draftmre
  • 6f6e5797Tickets conductor: STATUS wordingmre
  • 957de51fTickets conductor: T36 live, #36 review, #50 donemre
  • bc2fde32Merge branch 'main' into t36-stylemre
  • b7ca093atests: wait for the new row and normalize editor marker spacesmre
  • 41da3525Tickets conductor: flake cause, T36 deploy stepmre
  • 64c477e6Tickets conductor: deploy waits for Arachnemre
  • 467d7286Tickets conductor: T36 done, deploy questionmre
  • fed5ca81ticket_list: remove repeated selected-state coloursmre
  • 8542fc8aTickets conductor: T36 proof reviewedmre