@@ -38,110 +38,122 @@ steps:
3838 ref : c3
3939 persist-credentials : false
4040
41+ - name : Install build dependencies
42+ run : |
43+ sudo apt-get update -y
44+ sudo apt-get install -y cmake ninja-build python3 gcc g++ 2>&1 | tail -5
45+
46+ - name : Build Z3 in debug mode
47+ id : build-z3
48+ continue-on-error : true
49+ run : |
50+ mkdir -p build/debug specbot-results
51+ cd build/debug
52+ cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ../.. 2>&1 | tee ../../specbot-results/cmake.log
53+ ninja 2>&1 | tee ../../specbot-results/build.log
54+ BUILD_EXIT=$?
55+ cd ../..
56+ echo "build_exit=${BUILD_EXIT}" >> specbot-results/build-status.txt
57+ ls -la build/debug/libz3* build/debug/*.so* 2>/dev/null >> specbot-results/build-status.txt || echo "Library not found" >> specbot-results/build-status.txt
58+ exit $BUILD_EXIT
59+
60+ - name : Compile specbot tests
61+ continue-on-error : true
62+ run : |
63+ mkdir -p specbot-results
64+ gcc -g -O0 \
65+ -I src/api \
66+ specbot/test_specbot_seq.c \
67+ -L build/debug \
68+ -lz3 \
69+ -Wl,-rpath,"${GITHUB_WORKSPACE}/build/debug" \
70+ -o specbot-results/test_specbot_seq \
71+ 2>&1 | tee specbot-results/compile_specbot_seq.log
72+ echo "compile_specbot_seq_exit=$?" >> specbot-results/compile-status.txt
73+
74+ gcc -g -O0 \
75+ -I src/api \
76+ specbot/test_deeptest_seq.c \
77+ -L build/debug \
78+ -lz3 \
79+ -Wl,-rpath,"${GITHUB_WORKSPACE}/build/debug" \
80+ -o specbot-results/test_deeptest_seq \
81+ 2>&1 | tee specbot-results/compile_deeptest_seq.log
82+ echo "compile_deeptest_seq_exit=$?" >> specbot-results/compile-status.txt
83+
84+ - name : Run specbot tests
85+ continue-on-error : true
86+ run : |
87+ mkdir -p specbot-results
88+ if [ -f specbot-results/test_specbot_seq ]; then
89+ LD_LIBRARY_PATH="${GITHUB_WORKSPACE}/build/debug" timeout 120 specbot-results/test_specbot_seq > specbot-results/test_specbot_seq.log 2>&1
90+ SPECBOT_EXIT=$?
91+ echo "specbot_seq_exit=${SPECBOT_EXIT}" >> specbot-results/test-status.txt
92+ else
93+ echo "Binary not compiled" > specbot-results/test_specbot_seq.log
94+ echo "specbot_seq_exit=127" >> specbot-results/test-status.txt
95+ fi
96+
97+ if [ -f specbot-results/test_deeptest_seq ]; then
98+ LD_LIBRARY_PATH="${GITHUB_WORKSPACE}/build/debug" timeout 120 specbot-results/test_deeptest_seq > specbot-results/test_deeptest_seq.log 2>&1
99+ DEEPTEST_EXIT=$?
100+ echo "deeptest_seq_exit=${DEEPTEST_EXIT}" >> specbot-results/test-status.txt
101+ else
102+ echo "Binary not compiled" > specbot-results/test_deeptest_seq.log
103+ echo "deeptest_seq_exit=127" >> specbot-results/test-status.txt
104+ fi
105+
41106---
42107
43108# Specbot Crash Analyzer
44109
45110## Job Description
46111
47112Your name is ${{ github.workflow }}. You are an expert C/C++ and SMT solver analyst for the Z3 theorem prover
48- repository ` ${{ github.repository }} ` . Your task is to build Z3 in debug mode from the ` c3 ` branch, compile and run
49- the specbot test suite, capture any crashes or assertion failures, diagnose their root causes by reading the
50- relevant source files, and publish a structured findings report as a GitHub Discussion.
113+ repository ` ${{ github.repository }} ` . The pre-steps above have already built Z3 in debug mode from the ` c3 `
114+ branch, compiled and run the specbot test suite, and saved all output to the ` specbot-results/ ` directory in
115+ the workspace (` ${{ github.workspace }}/specbot-results/ ` ). Your task is to analyze those results, diagnose
116+ any crash root causes by reading the relevant source files, and publish a structured findings report as a
117+ GitHub Discussion.
51118
52- The repository has already been checked out at the ` c3 ` branch in the pre-step above .
119+ ** Do not try to build Z3 or run tests yourself. ** All build and test output is already in ` specbot-results/ ` .
53120
54121## Your Task
55122
56- ### 1. Install Build Dependencies
57-
58- Install the tools needed to build Z3 and compile the C test programs:
59-
60- ``` bash
61- sudo apt-get update -y
62- sudo apt-get install -y cmake ninja-build python3 gcc g++ 2>&1 | tail -5
63- ```
64-
65- ### 2. Build Z3 in Debug Mode
66-
67- Configure and build Z3 in debug mode. Store the build output in ` build/debug ` :
68-
69- ``` bash
70- mkdir -p build/debug
71- cd build/debug
72- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ../.. 2>&1 | tail -10
73- ninja 2>&1 | tail -20
74- cd ../..
75- ```
123+ ### 1. Read the Pre-Generated Results
76124
77- Verify the build succeeded by checking that ` build/debug/libz3.so ` (or ` build/debug/libz3.a ` ) exists :
125+ All build and test outputs are in ` specbot-results/ ` (relative to the workspace root). Read each file :
78126
79127``` bash
80- ls build/debug/libz3* 2> /dev/null || ls build/debug/* .so* 2> /dev/null || echo " Library not found"
81- ```
82-
83- If the build fails, capture the last 50 lines of ninja output and include them in the report under a
84- "Build Failure" section, then stop.
128+ # Build status
129+ cat specbot-results/build-status.txt 2> /dev/null || echo " No build status"
85130
86- ### 3. Compile the Specbot Tests
131+ # Compile status
132+ cat specbot-results/compile-status.txt 2> /dev/null || echo " No compile status"
87133
88- The ` specbot/ ` directory at the root of the repository contains two C test programs:
134+ # Test status
135+ cat specbot-results/test-status.txt 2> /dev/null || echo " No test status"
89136
90- - ` specbot/test_specbot_seq.c ` — basic specbot invariant tests for the Z3 seq/Nielsen solver
91- - ` specbot/test_deeptest_seq.c ` — deep-coverage tests targeting under-exercised code paths
137+ # Test output from test_specbot_seq
138+ cat specbot-results/test_specbot_seq.log 2> /dev/null || echo " No test_specbot_seq output "
92139
93- Compile each test, linking against the debug build of Z3. Use the Z3 public C API header from ` src/api/z3.h ` :
140+ # Test output from test_deeptest_seq
141+ cat specbot-results/test_deeptest_seq.log 2> /dev/null || echo " No test_deeptest_seq output"
94142
95- ``` bash
96- # Compile test_specbot_seq
97- gcc -g -O0 \
98- -I src/api \
99- specbot/test_specbot_seq.c \
100- -L build/debug \
101- -lz3 \
102- -Wl,-rpath,build/debug \
103- -o /tmp/test_specbot_seq \
104- 2>&1
105- echo " test_specbot_seq compile exit: $? "
106-
107- # Compile test_deeptest_seq
108- gcc -g -O0 \
109- -I src/api \
110- specbot/test_deeptest_seq.c \
111- -L build/debug \
112- -lz3 \
113- -Wl,-rpath,build/debug \
114- -o /tmp/test_deeptest_seq \
115- 2>&1
116- echo " test_deeptest_seq compile exit: $? "
143+ # Last 30 lines of the build log
144+ tail -30 specbot-results/build.log 2> /dev/null || echo " No build log"
117145```
118146
119- If a test fails to compile, include the compiler error in the report and skip running that test.
120-
121- ### 4. Run the Tests and Capture Output
122-
123- Run each compiled test binary. Capture stdout and stderr. The test harness prints lines like:
147+ If ` specbot-results/build-status.txt ` shows ` build_exit=0 ` , the build succeeded.
148+ If it shows a non-zero exit, include the last 50 lines of ` specbot-results/build.log ` in the report
149+ under a "Build Failure" section.
124150
125- - ` [TEST] Running <name> ` — test started
126- - ` [TEST] PASS <name> ` — test passed
127- - ` [TEST] CRASH <name> (exception 0x...) ` — SEH exception caught (Windows only; on Linux the process aborts)
128- - ` [TEST] ABORT <name> (caught SIGABRT) ` — assertion failure caught via SIGABRT + longjmp
129-
130- On Linux, wrap each run with a timeout and capture the exit code and any signal:
131-
132- ``` bash
133- LD_LIBRARY_PATH=build/debug timeout 120 /tmp/test_specbot_seq > /tmp/specbot_out.txt 2>&1
134- echo " specbot exit: $? "
135- cat /tmp/specbot_out.txt
136-
137- LD_LIBRARY_PATH=build/debug timeout 120 /tmp/test_deeptest_seq > /tmp/deeptest_out.txt 2>&1
138- echo " deeptest exit: $? "
139- cat /tmp/deeptest_out.txt
140- ```
151+ If ` specbot-results/compile-status.txt ` shows a non-zero exit for a test, include the compile error
152+ from ` specbot-results/compile_specbot_seq.log ` or ` specbot-results/compile_deeptest_seq.log ` .
141153
142- Collect every line that contains ` CRASH ` or ` ABORT ` from both output files — these are the crashes to analyze.
154+ Collect every line containing ` CRASH ` or ` ABORT ` from the test log files — these are the crashes to analyze.
143155
144- ### 5 . Diagnose Each Crash
156+ ### 2 . Diagnose Each Crash
145157
146158For each crashed test function, perform the following analysis:
147159
@@ -170,7 +182,7 @@ For each crashed test function, perform the following analysis:
1701824 . ** Suggest a fix** : propose a minimal, concrete fix — e.g., a guard condition, an additional lemma,
171183 a missing reference-count increment, or a missing case in a switch/match.
172184
173- ### 6 . Generate the Report
185+ ### 3 . Generate the Report
174186
175187After analyzing all crashes, produce a structured GitHub Discussion in the "Agentic Workflows" category
176188using ` create-discussion ` .
@@ -231,6 +243,7 @@ Format workflow run references as: `[§${{ github.run_id }}](https://github.com/
231243
232244## Usage
233245
234- Trigger via ** Actions → Specbot Crash Analyzer → Run workflow** on any branch; the pre-step
235- always checks out the ` c3 ` branch where ` specbot/test_specbot_seq.c ` and
236- ` specbot/test_deeptest_seq.c ` live. The discussion is posted to the "Agentic Workflows" category.
246+ Trigger via ** Actions → Specbot Crash Analyzer → Run workflow** on any branch. The pre-steps
247+ always check out the ` c3 ` branch where ` specbot/test_specbot_seq.c ` and
248+ ` specbot/test_deeptest_seq.c ` live, build Z3, run the tests, and save results to ` specbot-results/ ` .
249+ The agent then analyzes the results and posts a discussion to the "Agentic Workflows" category.
0 commit comments