用于运行、调试与更新 Pysa 污点分析端到端集成测试及期望结果
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "pysa-integration-tests" 技能: 1. 下载 https://raw.githubusercontent.com/facebook/pyre-check/main/.llms/skills/pysa-integration-tests/SKILL.md 2. 保存为 ~/.claude/skills/pysa-integration-tests/SKILL.md 3. 装好后重载技能,告诉我可以用了
请帮我排查 Pysa 集成测试失败原因,并更新 `source/interprocedural_analyses/taint/test/integration` 下对应测试的期望输出文件,说明改动前后差异。
定位失败原因、更新相关期望文件,并附上差异说明与后续验证建议。
我新增了一个污点分析场景,请为 Pysa 在 `source/interprocedural_analyses/taint/test/integration` 下创建完整集成测试,包括测试输入与所需的 `.models`、`.cg`、`.hofcg`、`.overrides` 或期望结果文件。
一套可运行的新集成测试文件,以及文件用途和断言目标说明。
请检查这个 Pysa 集成测试中的 `.models`、`.cg`、`.hofcg` 和 `.overrides` 文件是否一致,找出导致 taint 分析结果异常的配置或建模问题,并给出修复建议。
对相关测试文件的一致性分析、问题定位,以及可执行的修复方案。
End-to-end integration tests for the Pysa taint analysis engine. Each test is a .py file under source/interprocedural_analyses/taint/test/integration/. Tests run the full taint analysis pipeline and compare output against expected files.
All commands must be run from the source/ directory.
cd source
# Run ALL tests (parallelized with 16 shards)
OUNIT_SHARDS=16 dune exec interprocedural_analyses/taint/test/integrationTest.exe
# Run a SINGLE test (e.g., format.py)
PYSA_INTEGRATION_TEST=format.py dune exec interprocedural_analyses/taint/test/integrationTest.exe
See the "Pyrefly Integration" section in AGENTS.md for how to build the Pyrefly binary.
To run integration tests with Pyrefly:
PYREFLY_BINARY=<path-to-binary> PYSA_INTEGRATION_TEST=format.py dune exec interprocedural_analyses/taint/test/integrationTest.exe
Each test <name>.py may have these companion files:
| File | Required | Purpose |
|---|---|---|
<name>.py | Yes | Python source code to analyze |
<name>.py.pysa | No | Pysa model file: declares sources, sinks, TITO |
<name>.py.config | No | Taint configuration: rules, sources, sinks, options |
<name>.py.models | Yes | Expected output: taint models and issues (JSON) |
<name>.py.cg | Yes | Expected output: call graph |
<name>.py.hofcg | Yes | Expected output: higher-order call graph |
<name>.py.overrides | Yes | Expected output: override graph |
<name>.py.pyrefly.models | No | Expected Pyrefly output: models |
<name>.py.pyrefly.cg | No | Expected Pyrefly output: call graph |
<name>.py.pyrefly.hofcg | No | Expected Pyrefly output: higher-order call graph |
<name>.py.pyrefly.overrides | No | Expected Pyrefly output: overrides |
Default models: When no .pysa and no .config file is present, the test runner automatically provides default test models (_test_sink, _test_source, etc.). When either file is present, the test must be self-contained.
When a test fails because expected output doesn't match:
.actual files for each mismatched output (e.g., format.py.models.actual)diff to compare expected vs actual:diff source/interprocedural_analyses/taint/test/integration/format.py.models \
source/interprocedural_analyses/taint/test/integration/format.py.models.actual
If the test fails with type errors or analysis errors (not output mismatches), the issue is in the Python source or model definitions.
If the output changes are expected (e.g., you intentionally changed the analysis):
# Automatically moves all .actual files to their expected counterparts
facebook/scripts/in_path/pysa-update-expected
This replaces each <name>.py.<ext> with the corresponding <name>.py.<ext>.actual.
Always review the diff before updating — run sl diff after updating to verify changes are intentional.
<name>.py under source/interprocedural_analyses/taint/test/integration/<name>.py.pysa (model file) and/or <name>.py.config (taint config)PYSA_INTEGRATION_TEST=<name>.py dune exec interprocedural_analyses/taint/test/integrationTest.exe
.models, .cg, .hofcg, .overrides filesPYSA_INTEGRATION_TEST, not PYSA_TEST or similar.py extension: Use PYSA_INTEGRATION_TEST=format.py, not formatdune exec must be run from source/…
帮助开发者在提交代码或生成 diff 时套用正确的提交前缀、审阅人和测试计划。
帮助开发者排查 Pysa 漏报污点问题,比较输出并定位污点流丢失位置。
帮助你快速理解 Pyre/Pysa 代码架构并定位关键实现位置
帮助开发者读取、编写并调试 Pysa 的 JSON 污点模型与 .models 输出
帮助排查常见故障、版本兼容与会话流诊断问题,提升开发调试效率
帮助开发者完成 Meta AI 应用注册与设备权限接入流程配置。