gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitcf9648afcf9648afhome: format Style with nested rules and bare mediamrecf9648af/tests/same-output-modules.py

2.6 KB

  1. #!/usr/bin/env python3
  2. # (copied from gitoria .scratch/w082 for components mission 002; file filter = baseline.mjs names)
  3. # tests/same-output-modules.py <dirA> <dirB> (gitoria's modcmp.py): the browser modules of two baseline runs. A module = the component's own code + tables of the
  4. # statics it imports (each a real, client-callable function or a refusing server-only stub naming its file). A move of a
  5. # static to another file changes the tables and the source positions, not the behaviour. Checked here:
  6. # 1. the module without the import tables and with every source position masked is the same;
  7. # 2. every imported name the component's own code uses is the same kind (function / stub), a function with the same body.
  8. import os, re, sys
  9. a, b = sys.argv[1], sys.argv[2]
  10. POS = re.compile(r'[\w-]+\.hl:\d+:\d+')
  11. def parts(t):
  12. t = re.sub(r'\?v=[0-9a-f]+', '?v=H', t)
  13. kinds, own = {}, []
  14. lines = t.split('\n'); i = 0
  15. while i < len(lines):
  16. l = lines[i]
  17. m = re.match(r'\$_\d+\.(\w+)=(.*)$', l)
  18. if m:
  19. if m.group(2).startswith('()=>_55('): kinds.setdefault(m.group(1), ('stub', ''))
  20. else:
  21. body = [m.group(2)]
  22. while not lines[i].endswith('}));') and not (lines[i].endswith(';') and lines[i] is l and '=>{' not in l):
  23. i += 1; body.append(lines[i])
  24. kinds[m.group(1)] = ('fn', POS.sub('P', re.sub(r'\$_\d+', '$_N', '\n'.join(body))))
  25. i += 1; continue
  26. if re.match(r'const \$_\d+=\{\};$', l) or re.match(r'const \w+=\$_\d+\.\w+;$', l) or re.match(r'const \w+=\(\)=>_55\(2,', l):
  27. m2 = re.match(r'const (\w+)=\(\)=>_55\(2,', l)
  28. if m2: kinds[m2.group(1)] = ('plugin', '')
  29. i += 1; continue
  30. own.append(POS.sub('P', re.sub(r'\$_\d+', '$_N', l))); i += 1
  31. return kinds, '\n'.join(own)
  32. bad = 0
  33. for f in sorted(os.listdir(a)):
  34. if not (f.startswith('http__') and f.endswith('.hl')): continue # m002: the browser modules of baseline.mjs
  35. x, y = open(os.path.join(a, f)).read(), open(os.path.join(b, f)).read()
  36. if x == y: print(f, 'identical'); continue
  37. kx, ox = parts(x); ky, oy = parts(y)
  38. notes = []
  39. if ox != oy: notes.append('the component code differs')
  40. words = set(re.findall(r'\b\w+\b', ox))
  41. for n in sorted(words & (set(kx) | set(ky))):
  42. if kx.get(n) != ky.get(n): notes.append(f'{n}: {kx.get(n, ("absent",))[0]} → {ky.get(n, ("absent",))[0]}' + (' (body differs)' if kx.get(n, ('',))[0] == ky.get(n, ('',))[0] == 'fn' else ''))
  43. print(f, 'same code, same imported functions (only the tables / positions moved)' if not notes else 'DIFF: ' + '; '.join(notes))
  44. bad += len(notes)
  45. sys.exit(1 if bad else 0)

Branches

Latest commits

  • cf9648afhome: format Style with nested rules and bare mediamre
  • 846a6242user-menu: format Style with nested rules and bare mediamre
  • 4d58708cthree-pane: format Style with nested rules and bare mediamre
  • 0bbfc553main-menu: format Style with nested rules and bare mediamre
  • 7755199dlist-first: format Style with nested rules and bare mediamre
  • 35199303content-first: format Style with nested rules and bare mediamre
  • 00f6e698app-sidebar: format Style with nested rules and bare mediamre
  • bb2f29c9app-header: format Style with nested rules and bare mediamre
  • 3aca2d7fSync components from 8176eb1 with reviewed nested stylesmre
  • 87e4003dRe-vendor layouts to Hybriel set day35mre
  • d8628cfflayouts: a startup error prints its message before exit 1 (hybriel#247)mre
  • 180fd76elayouts: MdEditor from components 59704ce (text on the clipboard always pastes, a file manager copy still attaches; pipe rows; empty Table-button table; tickets#49, notes#5)mre
  • a3eda8afRe-vendor Hybriel master 7a684920 (binary 74ab3715): plugins whole, startup fault exits 1; files-upload gate 340/0mre
  • 025d5880WIP re-vendor Hybriel set-day27b (a9712e61, master f5ff97bf): plugins whole, startup fault exits 1; NOT deployable: files-upload emit refused (see .scratch/rv27-upload)mre
  • 42183a71Merge sb3-standby: layouts deploys through its standbymre
  • 408de1f2layouts: no jobs switch needed in the standbymre
  • 0b85f57elayouts: a standby container (port 45019, profile standby); deploy hands over through standby-swap.sh without a gapmre
  • 31e40b8bMerge dm3-media: range handling in the layouts media routemre
  • 856dcacbLayouts media route: read suffix ranges and ignore range lists and garbage, like the components route (the layouts copy still answered 416 for the last bytes)mre
  • ad5056eaMerge dm3-sync: components re-sync to c2834ddmre