File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Build and run the issue #405 concurrency regression test.
3+ # Runs the stress harness several times under a private D-Bus session.
4+ # Exit 0 only if every run completes without crashing.
5+
6+ set -u
7+ SCRIPT_DIR=" $( cd " $( dirname " $0 " ) " && pwd) "
8+ SDBUS_CFLAGS=$( pkg-config --cflags libsystemd)
9+ SDBUS_LIBS=$( pkg-config --libs libsystemd)
10+ BIN=" $SCRIPT_DIR /test_sni_concurrency"
11+
12+ echo " Compiling concurrency test..."
13+ gcc -O2 -g -fPIC -Wall -Wextra -Wno-unused-parameter \
14+ -I " $SCRIPT_DIR " $SDBUS_CFLAGS \
15+ " $SCRIPT_DIR /sni.c" " $SCRIPT_DIR /test_sni_concurrency.c" \
16+ $SDBUS_LIBS -lpthread -lm -o " $BIN " || { echo " compile failed" ; exit 2; }
17+
18+ RUNS=" ${1:- 5} "
19+ rc=0
20+ for i in $( seq 1 " $RUNS " ) ; do
21+ echo " --- run $i /$RUNS ---"
22+ dbus-run-session -- " $BIN "
23+ status=$?
24+ if [ $status -ne 0 ]; then
25+ echo " FAIL: run $i exited with status $status (signal $(( status- 128 )) if >128)"
26+ rc=1
27+ break
28+ fi
29+ done
30+
31+ rm -f " $BIN "
32+ if [ $rc -eq 0 ]; then
33+ echo " PASS: all $RUNS runs completed without crash"
34+ fi
35+ exit $rc
You can’t perform that action at this time.
0 commit comments