Skip to content

Commit b109734

Browse files
committed
Add magic gdb
1 parent 0f4af1b commit b109734

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,37 @@ jobs:
126126
env:
127127
LBUG_PYTHON_BACKEND: capi
128128
run: |
129-
.venv/bin/python -m pytest -vv ./test
129+
if ! command -v gdb >/dev/null 2>&1; then
130+
sudo apt-get update
131+
sudo apt-get install -y gdb
132+
fi
133+
echo "Relevant environment:"
134+
env | sort | grep -Ei '^(http|https|all|no|ladybug|lbug|lang|lc_)' || true
135+
echo "Resolved liblbug dependencies:"
136+
ldd "$LBUG_C_API_LIB_PATH"
137+
138+
run_gdb() {
139+
local log_file="$1"
140+
shift
141+
set +e
142+
gdb --batch \
143+
-ex "set pagination off" \
144+
-ex "set print thread-events off" \
145+
-ex "run" \
146+
-ex "thread apply all bt full" \
147+
--args "$@" 2>&1 | tee "$log_file"
148+
local gdb_status=${PIPESTATUS[0]}
149+
set -e
150+
if grep -q "received signal SIGSEGV" "$log_file"; then
151+
echo "gdb caught SIGSEGV" >&2
152+
exit 1
153+
fi
154+
return "$gdb_status"
155+
}
156+
157+
run_gdb .cache/gdb-json-install-smoke.log .venv/bin/python -c 'import shutil, tempfile; from pathlib import Path; import ladybug as lb; tmp = Path(tempfile.mkdtemp()); db = lb.Database(tmp / "db.lbdb"); conn = lb.Connection(db); conn.execute("INSTALL json; LOAD json;"); shutil.rmtree(tmp)'
158+
159+
run_gdb .cache/gdb-capi-pytest.log .venv/bin/python -m pytest -vv ./test
130160
131161
python-ci-pybind:
132162
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)