Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
127 lines (109 loc) · 4.32 KB
/
Copy pathMakefile
File metadata and controls
127 lines (109 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Recipes use bash features (`source`). Without this, make runs them with
# /bin/sh, which is dash on Ubuntu, and `make venv-dev` fails there.
SHELL := /bin/bash
VCS_REF := $(shell git rev-parse --short HEAD)
.PHONY: venv-dev
venv-dev:
@echo Building Python virtual environment for developer
set -e ;\
python3 -m venv venv-dev ;\
source venv-dev/bin/activate ;\
pip install --upgrade pip ;\
pip install -r requirements.txt -r requirements.dev.txt
.PHONY: fresh-requirements
fresh-requirements:
@echo Freshening requirments files
set -e ;\
python3 -m piptools compile -o requirements.txt pyproject.toml ;\
python3 -m piptools compile --extra dev -o requirements.dev.txt pyproject.toml
.PHONY: quick
quick:
@echo Performing 'quick' build
set -e ;\
maturin develop ;\
pytest
submodule-cedar-integration-tests: third_party/cedar-integration-tests/
git submodule update --init --recursive
submodules: submodule-cedar-integration-tests
.PHONY: integration-tests
integration-tests: submodules
@echo Running integration tests
@echo Running official Cedar integration test cases
set -e ;\
pytest tests/integration/test_cedar_integration_tests.py
.PHONY: corpus-tests
corpus-tests: submodules
@echo Running auto-generated cedar corpus tests
@echo This suite is large \(7000+ files\) and may take several minutes.
set -e ;\
pytest tests/integration/test_cedar_corpus_tests.py
.PHONY: release
release:
@echo Building a release
set -e ;\
maturin build --release ;\
WHEEL=$$(ls -1t target/wheels/cedarpy-*.whl | head -1) ;\
echo "Installing $$WHEEL for test" ;\
python -m pip install --force-reinstall --no-deps "$$WHEEL" ;\
pytest
# Performance benchmark targets
BENCHMARK_RESULTS_DIR := tests/benchmark/results
.PHONY: benchmark
benchmark:
@echo Running performance benchmarks
set -e ;\
maturin develop --release ;\
pytest tests/benchmark --benchmark-only -v
.PHONY: benchmark-save
benchmark-save:
@echo Running benchmarks and saving results
@mkdir -p $(BENCHMARK_RESULTS_DIR)/out
set -e ;\
maturin develop --release ;\
pytest tests/benchmark --benchmark-only \
--benchmark-json=$(BENCHMARK_RESULTS_DIR)/out/results.$(VCS_REF).$$(date +%Y%m%d_%H%M%S).json -v
.PHONY: benchmark-compare
benchmark-compare:
@echo Running N benchmark runs at HEAD and comparing median Δ against baseline
@if [ ! -f $(BENCHMARK_RESULTS_DIR)/baseline.json ]; then \
echo "Error: $(BENCHMARK_RESULTS_DIR)/baseline.json not found. Sym-link $(BENCHMARK_RESULTS_DIR)/baseline.json to a baseline-<state>-median.json first."; \
exit 1; \
fi
set -e ;\
bash tests/benchmark/run_current.sh ;\
python3 tests/benchmark/aggregate.py --compare-current $(BENCHMARK_RESULTS_DIR)/current
.PHONY: benchmark-history
benchmark-history:
@echo Capturing release-mode benchmark history across the commits listed in tests/benchmark/capture_history.sh
@echo "(this takes ~30-40 min; switches branches and restores on exit)"
set -e ;\
bash tests/benchmark/capture_history.sh ;\
python3 tests/benchmark/aggregate.py
.PHONY: benchmark-gil
# Measure each `release_gil` entry point alone and beside a CPU-bound Python
# thread; prints the Measurements table for
# docs/guides/threads-and-asyncio-guide.md. Takes ~2 min.
benchmark-gil:
@echo Measuring release_gil contention behavior
set -e ;\
maturin develop --release ;\
python3 tests/benchmark/gil_contention.py
.PHONY: benchmark-gil-asyncio
# Validate synthetic two-slot templates in asyncio.to_thread on an idle and a
# busy event loop; prints the case study table's shape for
# docs/guides/threads-and-asyncio-guide.md. Takes ~30 s.
benchmark-gil-asyncio:
@echo Measuring the event loop while templates validate
set -e ;\
maturin develop --release ;\
python3 tests/benchmark/gil_asyncio.py
.PHONY: benchmark-baseline
# Synthesize a median-of-N baseline JSON from BASELINE_STATE's committed
# historical runs (default v4_12_0; override with BASELINE_STATE=...). Output
# lands in tests/benchmark/results/baseline-<state>-median.json — a new file
# alongside the existing baseline.json, not a replacement. The maintainer
# decides when (and whether) to point `make benchmark-compare` at it.
BASELINE_STATE ?= v4_12_0
benchmark-baseline:
@echo Synthesizing $(BENCHMARK_RESULTS_DIR)/baseline-$(BASELINE_STATE)-median.json from $(BASELINE_STATE) historical runs
python3 tests/benchmark/aggregate.py --build-baseline-from $(BASELINE_STATE)