VEHwang's picture
Upload CoCogni4D-Bench (questions, media, scripts, render records, code) (part 6)
5afd2f7 verified
Raw History Blame Contribute Delete
7.77 kB
PYTHON ?= python3
# 规格核心按脚本跑,也要能 import embodied_pipeline.semantics
export PYTHONPATH := $(CURDIR)$(if $(PYTHONPATH),:$(PYTHONPATH))
NPM ?= npm
.PHONY: prover-plans questions-fast questions-core-test check test-pipeline test-pipeline-fast test-tools-source test-tools test-console-python test-python test-ui console-build test pr-check ci spec-check
.PHONY: quickstart
quickstart:
$(PYTHON) -B -m examples.quickstart
check:
$(PYTHON) -B tools/workspace/reachability.py check
$(PYTHON) -B tools/workspace/reachability.py check-dead $(if $(DEAD_BASE),--base $(DEAD_BASE))
$(PYTHON) tools/workspace/manage.py check
$(PYTHON) -B tools/workspace/doc_refs.py
# 证明器导入冒烟(0.2 秒):规格参数取端与证明器读取不符时,整个包导入即失败
$(PYTHON) -B -c "import embodied_pipeline.prover"
# plans.json 不进 git(prover/interp.py 的 plans()),由规格编出;测试前现编,新检出不缺、也不会比源码旧。
prover-plans:
$(PYTHON) -B -m embodied_pipeline.prover.compile
# 仅导入 unittest.mock 的模块仍可用 pytest 函数/夹具;只有导入 unittest 本身才选 unittest。
PYTEST_PIPELINE = $(notdir $(shell grep -L -E '^(import unittest([[:space:],]|$$)|from unittest import)' tests/pipeline/test_*.py))
test-pipeline: prover-plans
$(PYTHON) -m unittest discover -s tests/pipeline -p 'test_*.py' -v
$(PYTHON) -m pytest -q -p no:cacheprovider $(addprefix tests/pipeline/,$(PYTEST_PIPELINE))
# New pipeline test files enter PR by default; exclude only measured/full-only cases.
PR_PIPELINE_FULL_ONLY =
PR_PIPELINE_FULL_ONLY += test_native_matrices.py # 没有实际执行的正例
PR_PIPELINE_FULL_ONLY += test_range_server.py # 沙箱权限失败,正常耗时未验证
PR_PIPELINE_FULL_ONLY += test_rendering_buffers.py # 应用/渲染专项,保留全量
PR_PIPELINE_FULL_ONLY += test_rendering_contracts.py # 应用/渲染专项,保留全量
PR_PIPELINE_FULL_ONLY += test_rendering_masks.py # 缺FFmpeg/OpenCV等依赖,正常耗时未验证
PR_PIPELINE_FULL_ONLY += test_rendering_measurements.py # 应用/渲染专项,保留全量
PR_PIPELINE_FULL_ONLY += test_rendering_postprocess.py # 应用/渲染专项,保留全量
PR_PIPELINE_FULL_ONLY += test_rendering_runtime.py # 有依赖/外部夹具跳过,正常完整耗时未验证
PR_PIPELINE_FULL_ONLY += test_rendering_viewport.py # 应用/渲染专项,保留全量
PR_PIPELINE_FULL_ONLY += test_scene_capability.py # 有依赖/外部夹具跳过,正常完整耗时未验证
PR_PIPELINE_TESTS = $(notdir $(filter-out $(addprefix tests/pipeline/,$(PR_PIPELINE_FULL_ONLY)),$(wildcard tests/pipeline/test_*.py)))
# 逐文件一个目标,由 make -j 并行:串行时 129 个文件合计 273 s,是整轮 CI 的关键路径
PF_TARGETS = $(addprefix pipeline-fast/,$(PR_PIPELINE_TESTS))
test-pipeline-fast: $(PF_TARGETS)
$(PYTHON) -m pytest -q np/test_bench_db.py -k bench_db
@test -n "$(strip $(PR_PIPELINE_TESTS))"
$(PF_TARGETS): pipeline-fast/%: prover-plans
@case " $(PYTEST_PIPELINE) " in *" $* "*) runner="-m pytest -q -p no:cacheprovider tests/pipeline/$*";; \
*) runner="-m unittest discover -s tests/pipeline -p $* -v";; esac; \
/usr/bin/time -f "pipeline $*: %e s (exit %x)" $(PYTHON) $$runner
test-tools-source:
$(PYTHON) -m unittest discover -s tools/workspace -p 'test_*.py' -v
$(PYTHON) -m unittest discover -s tools/release -p 'test_*.py' -v
test-tools: test-tools-source
$(PYTHON) -m unittest discover -s tools/evaluation -p 'test_*.py' -v
# 同上逐文件并行(串行 250 条 82.8 s)
CT_TARGETS = $(addprefix console-py/,$(notdir $(wildcard apps/console/tests/test_*.py)))
test-console-python: $(CT_TARGETS)
$(CT_TARGETS): console-py/%:
$(PYTHON) -m unittest discover -s apps/console/tests -p $* -v
test-python: test-pipeline test-tools test-console-python
test-ui:
$(NPM) --prefix apps/console test
console-build:
$(NPM) --prefix apps/console run build
test: test-python test-ui
# PR feedback: source/contracts, selected pipeline units and source tools.
# Full pipeline, HTTP integrations, specification checks and UI stay in ci.
pr-check: check test-pipeline-fast test-tools test-console-python questions-fast
.PHONY: quick
quick:
$(PYTHON) -B tools/workspace/quick.py --base $${BASE:-origin/codex/next-pipeline} || { [ $$? = 3 ] && $(MAKE) pr-check; }
# 问法核心的快测试并进 pr-check;慢的 test_core 留在全套。
QUESTIONS_FAST = spec/questions/core/test_event_forwarding.py \
spec/questions/core/test_say_rule.py \
spec/questions/core/test_source_values.py \
tests/test_entry_narrative.py \
spec/questions/core/test_shortcut_consumers.py \
spec/questions/core/test_consensus_witnesses.py \
spec/questions/core/test_shared_consumers.py \
spec/questions/core/test_catalog_reader.py \
spec/questions/core/test_measurement.py \
spec/questions/core/test_shared_contracts.py \
spec/questions/core/test_lazy_selection.py \
spec/questions/core/test_nested_guards.py \
spec/questions/core/test_dependency_states.py \
spec/questions/core/test_shared_domains.py \
spec/questions/core/test_evidence_bindings.py \
spec/questions/core/test_catalog_mechanics.py \
spec/questions/core/test_canonical_names.py \
spec/questions/core/test_term_index.py \
spec/questions/core/test_instantiation_bindings.py \
spec/questions/core/test_sector4_basis.py
QF_TARGETS = $(addprefix questions-fast/,$(QUESTIONS_FAST))
questions-fast: $(QF_TARGETS)
$(QF_TARGETS): questions-fast/%:
$(PYTHON) -B $*
.PHONY: $(PF_TARGETS) $(CT_TARGETS) $(QF_TARGETS)
# 各行互不依赖,拆成子目标让 make -j 并行(串行 66 s,并行时由 check_methods 一行定,约 56 s)
SPEC_CHECKS = forms-build-test methods catalog declarations
spec-check: $(addprefix spec-check/,$(SPEC_CHECKS))
spec-check/forms-build-test:
$(PYTHON) -B spec/questions/core/test_forms_build.py
spec-check/methods:
$(PYTHON) -B spec/questions/core/check_methods.py --strict
spec-check/catalog:
$(PYTHON) -B -m np sync-catalog --catalog spec/questions --check
spec-check/declarations:
$(PYTHON) -B spec/questions/core/check_declarations.py
.PHONY: $(addprefix spec-check/,$(SPEC_CHECKS))
# Explicit core regressions; next CI routing is configured separately.
questions-core-test:
$(PYTHON) -B spec/questions/core/test_core.py
$(PYTHON) -B spec/questions/core/test_sector4_basis.py
$(PYTHON) -B spec/questions/core/test_catalog_mechanics.py
$(PYTHON) -B spec/questions/core/test_shared_contracts.py
$(PYTHON) -B spec/questions/core/test_shared_domains.py
$(PYTHON) -B spec/questions/core/test_instantiation.py
$(PYTHON) -B spec/questions/core/test_dependency_states.py
$(PYTHON) -B spec/questions/core/test_catalog_reader.py
$(PYTHON) -B spec/questions/core/test_canonical_names.py
$(PYTHON) -B spec/questions/core/test_measurement.py
$(PYTHON) -B spec/questions/core/test_typed_bindings.py
$(PYTHON) -B spec/questions/core/test_consensus_witnesses.py
$(PYTHON) -B spec/questions/core/test_consensus_properties.py
$(PYTHON) -B spec/questions/core/test_shared_consumers.py
$(PYTHON) -B spec/questions/core/test_query_contexts.py
$(PYTHON) -B spec/questions/core/test_evidence_bindings.py
$(PYTHON) -B spec/questions/core/test_nested_guards.py
$(PYTHON) -B spec/questions/core/test_instantiation_bindings.py
$(PYTHON) -B spec/questions/core/test_selection_projection.py
$(PYTHON) -B spec/questions/core/test_public_contracts.py
$(PYTHON) -B spec/questions/core/test_original_scoring.py
$(PYTHON) -B spec/questions/core/test_lazy_selection.py
$(PYTHON) -B spec/questions/core/test_shortcut_consumers.py
$(PYTHON) -B spec/questions/core/test_term_index.py
$(PYTHON) -B tests/test_entry_narrative.py
ci: check test console-build spec-check