-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
103 lines (81 loc) · 3.53 KB
/
Copy pathjustfile
File metadata and controls
103 lines (81 loc) · 3.53 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
# verilator zig build - justfile
set shell := ["bash", "-cu"]
# extract upstream hash from build.zig.zon dynamically
upstream_hash := `awk '/\.verilator = /{f=1} f && /\.hash =/{match($0, /"[^"]+"/); print substr($0, RSTART+1, RLENGTH-2); exit}' build.zig.zon`
upstream_cache := "~/.cache/zig/p/" + upstream_hash
test_regress := upstream_cache + "/test_regress"
default:
just --list
# build verilator
build:
zig build
# build in release mode
release:
zig build -Doptimize=ReleaseFast
# clean build artifacts
clean:
rm -rf .zig-cache zig-out
# run verilator --version
version: build
VERILATOR_ROOT={{ justfile_directory() }}/zig-out ./zig-out/bin/verilator_bin --version
# run verilator --help
help-verilator: build
VERILATOR_ROOT={{ justfile_directory() }}/zig-out ./zig-out/bin/verilator_bin --help
# lint a verilog file (usage: just lint path/to/file.v)
lint file: build
VERILATOR_ROOT={{ justfile_directory() }}/zig-out ./zig-out/bin/verilator_bin --lint-only {{ file }}
# run a single test (usage: just test-one t/t_lint_basic.py)
test-one test_file:
cd {{ test_regress }} && \
VERILATOR_ROOT={{ justfile_directory() }}/zig-out \
uv run --with distro python3 driver.py --vlt {{ test_file }}
# run all lint tests (quick sanity check)
test-lint:
cd {{ test_regress }} && \
VERILATOR_ROOT={{ justfile_directory() }}/zig-out \
uv run --with distro python3 driver.py --vlt t/t_lint_*.py --quiet
# run selftest (basic functionality test)
test-self:
cd {{ test_regress }} && \
VERILATOR_ROOT={{ justfile_directory() }}/zig-out \
uv run --with distro python3 driver.py --vlt t/t_a3_selftest.py
# run vlt scenario tests (main verilator tests, no SystemC)
test-vlt *args='':
cd {{ test_regress }} && \
VERILATOR_ROOT={{ justfile_directory() }}/zig-out \
uv run --with distro python3 driver.py --vlt {{ args }}
# run vltmt scenario tests (multithreaded tests)
test-vltmt *args='':
cd {{ test_regress }} && \
VERILATOR_ROOT={{ justfile_directory() }}/zig-out \
uv run --with distro python3 driver.py --vltmt {{ args }}
# run full test suite (vlt + vltmt + dist scenarios)
test-all *args='':
cd {{ test_regress }} && \
VERILATOR_ROOT={{ justfile_directory() }}/zig-out \
uv run --with distro python3 driver.py --vlt --vltmt --dist {{ args }}
# run all vlt tests in parallel with auto job count (main test command)
test-full:
cd {{ test_regress }} && \
VERILATOR_ROOT={{ justfile_directory() }}/zig-out \
uv run --with distro python3 driver.py --vlt -j 0 --quiet --rerun
# run tests with parallel jobs (usage: just test-parallel 8)
test-parallel jobs='0' *args='':
cd {{ test_regress }} && \
VERILATOR_ROOT={{ justfile_directory() }}/zig-out \
uv run --with distro python3 driver.py --vlt -j {{ jobs }} {{ args }}
# show upstream test directory
show-test-dir:
@echo {{ test_regress }}
# list available test files
list-tests pattern='t_*.py':
@ls {{ test_regress }}/t/{{ pattern }} | head -50
# count tests by category
count-tests:
@echo "Total test files: $(ls {{ test_regress }}/t/t_*.py | wc -l | tr -d ' ')"
@echo "Lint tests: $(ls {{ test_regress }}/t/t_lint_*.py 2>/dev/null | wc -l | tr -d ' ')"
@echo "Assert tests: $(ls {{ test_regress }}/t/t_assert*.py 2>/dev/null | wc -l | tr -d ' ')"
@echo "Coverage tests: $(ls {{ test_regress }}/t/t_cover*.py 2>/dev/null | wc -l | tr -d ' ')"
# show current verilator version from build.zig.zon
show-version:
@grep -oE '(ref=v|\#v)[0-9.]+' build.zig.zon | head -1 | sed 's/.*v//' | xargs -I{} echo {}.0