11# This Dockerfile onnly for GH action runs and performs:
22# 1) Code lint checking
33# 2) Runs tests from tests/
4+ #
5+ # Author: Abhishek Sriram <noobsiecoder@gmail.com>
6+ # Date: Aug 20th, 2025
7+ # Place: Boston, MA
48
9+ # Image (OS) type
510FROM ubuntu:22.04
611
712# Prevent interactive prompts
@@ -14,7 +19,6 @@ RUN apt-get update && apt-get install -y \
1419 python3 \
1520 python3-pip \
1621 iverilog \
17- yosys \
1822 && apt-get clean
1923
2024# Install uv
@@ -35,5 +39,33 @@ RUN echo "=== Running Code Linting ===" && \
3539 uv run ruff format --check .
3640
3741# Step 2: Run tests
38- RUN echo "=== Running Tests ===" && \
42+ RUN echo "=== Running Python Script(s) Tests ===" && \
43+ uv run pytest -v tests/test_evals.py \
3944 uv run pytest -v tests/test_models.py::test_api_connection_with_no_env_load
45+
46+ # Step 3: Run tests for ground truth with corrresponding testbench
47+ RUN echo "=== Running Verilog Tests ===" && \
48+ # Collect all filenames in a directory:
49+ # 1) tb_*.v and 2) answer_*.v
50+ cd dataset/testbench/hdlbits && \
51+ find . -name "tb_*.v" | while read tb_path; do \
52+ # Get directory and filename
53+ dir=$(dirname "$tb_path"); \
54+ tb_file=$(basename "$tb_path"); \
55+ base=${tb_file#tb_}; \
56+ base=${base%.v}; \
57+ answer_file="answer_${base}.v"; \
58+ answer_path="${dir}/${answer_file}"; \
59+ \
60+ if [ -f "$answer_path" ]; then \
61+ echo "Testing: ${dir}/${base}"; \
62+ cd "$dir" && \
63+ # Run verilog testbench using icarus verilog
64+ iverilog -o test_${base} ${tb_file} ${answer_file} && \
65+ vvp test_${base} || (echo "✗ Test failed: ${dir}/${base}" && exit 1); \
66+ cd - > /dev/null; \
67+ else \
68+ echo "⚠ Missing answer file: $answer_path"; \
69+ fi; \
70+ done && \
71+ echo "✓ All Verilog tests passed!"
0 commit comments