mirror of
https://github.com/eunomia-bpf/bpf-developer-tutorial.git
synced 2026-10-29 03:34:44 +08:00
* Add targeted TCP connection quarantine tool * Document TCP quarantine workflow * Refresh package indexes before CI install * Document TCP quarantine namespace scope * Require BPF events for TCP iterator * Add production fsession latency tracer * Document fsession latency workflow * Reject empty fsession CLI values * Preserve successful fsession exit status * Document fsession deadline regression test * Drain fsession events before summary * Document fsession PID and shutdown semantics * Simplify fsession polling control flow * Add bounded BPF egress pacer tutorial * Test queued packet cleanup on signal * Document the BPF egress pacer * Polish and review the BPF egress pacer * Refactor egress pacer option parsing * Add executable image inspector lesson * Build the exec image inspector in CI * Document executable image inspection * Handle re-exec chains in the image inspector * Polish exec image inspector guidance * Reduce exec inspector wait complexity * Rewrite the egress pacer tutorial * Rewrite the exec image inspector tutorial * Polish the exec image inspector tutorial * Correct the egress pacer tutorial * Make the exec tutorial Chinese natural * Fix egress tutorial prose checks * Finish the exec tutorial style pass * Clarify exec tutorial runtime evidence * Polish exec tutorial scope wording * Rewrite the egress pacer tutorial for readers * Regenerate tutorial indexes * Teach the egress pacer component by component * Use standard Markdown in the egress tutorial * Strengthen the egress pacer tutorial narrative * jiji * Use positive framing in the egress tutorial * Rewrite the exec image inspector tutorial * Rewrite the TCP quarantine tutorial * Add the egress pacer lifecycle diagram * Refresh TCP tutorial indexes * Add the exec image inspection flow diagram * Use one source directory link * Rewrite the fsession latency tutorial * Add fsession feature background * Add BPF qdisc feature background * Add TCP iterator feature background * Add exec inspection feature background * Require feature background in tutorial openings * Polish fsession background prose * Simplify repository tutorial skills * Update exec inspector tooling revisions * Restructure tutorials 51-54 following advanced guideline - Update SKILL.md with strict section ordering and "why" requirements - Rewrite README.zh.md for tutorials 51-54: - Add background sections explaining why traditional approaches fail - Move compilation/execution sections after code analysis - Add high-level mechanism explanation before code - Use paragraph style instead of bullet lists * Consolidate skill guidelines and remove duplicates - Update write-bpf-production-tutorial skill to reference 47, 48, 49 - Add structure requirements section with "Why" section emphasis - Remove duplicate advanced-tutorial-guidelines.md (use scripts/guideline_advance.md instead) * Rewrite English READMEs 51-54 to match Chinese structure Restructure all four English tutorials to match their Chinese counterparts: - Add "Why this approach is needed" sections explaining traditional limitations - Add high-level mechanism sections before code - Move compilation/execution sections after code analysis - Add environment requirements tables - Use consistent section ordering across all tutorials * Regenerate TOC after tutorial title changes Run generate_toc.py to sync SUMMARY and README files with updated tutorial titles from the restructuring. * Regenerate compatibility tables after title changes --------- Co-authored-by: LinuxDev9002 <i@littlefisher.me>
51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
import re
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
from scripts.generate_toc import generate_toc, generate_toc_cn
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
LINK_PATTERN = re.compile(r"\]\((src/.+?)/README(?:\.zh)?\.md\)")
|
|
TRACING_LESSONS = {
|
|
"src/30-sslsniff",
|
|
"src/31-goroutine",
|
|
"src/33-funclatency",
|
|
"src/37-uprobe-rust",
|
|
"src/39-nginx",
|
|
"src/40-mysql",
|
|
"src/48-energy",
|
|
"src/52-fsession-latency",
|
|
}
|
|
|
|
|
|
def lesson_links(markdown: str) -> set[str]:
|
|
return set(LINK_PATTERN.findall(markdown))
|
|
|
|
|
|
def subsection(markdown: str, heading: str, next_heading: str) -> str:
|
|
return markdown.split(f"\n\n{heading}:\n\n", 1)[1].split(
|
|
f"\n\n{next_heading}:\n\n", 1
|
|
)[0]
|
|
|
|
|
|
class TocParityTest(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.english = generate_toc(ROOT / "src", ROOT, ROOT)
|
|
cls.chinese = generate_toc_cn(ROOT / "src", ROOT, ROOT)
|
|
|
|
def test_english_and_chinese_indexes_contain_the_same_lessons(self):
|
|
self.assertSetEqual(lesson_links(self.english), lesson_links(self.chinese))
|
|
|
|
def test_chinese_tracing_subsection_contains_all_tracing_lessons(self):
|
|
english_tracing = lesson_links(subsection(self.english, "Tracing", "Security"))
|
|
chinese_tracing = lesson_links(subsection(self.chinese, "追踪", "安全"))
|
|
|
|
self.assertSetEqual(english_tracing, TRACING_LESSONS)
|
|
self.assertSetEqual(chinese_tracing, TRACING_LESSONS)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|