Skip to content

Commit 9796f66

Browse files
committed
add core file download for ci test
Signed-off-by: LHT129 <[email protected]>
1 parent f1a22e8 commit 9796f66

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/asan_build_and_test.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,48 @@ jobs:
1414
image: vsaglib/vsag:ci-x86
1515
volumes:
1616
- /opt:/useless
17+
options: |
18+
--privileged
1719
concurrency:
1820
group: asan_build_x86-${{ github.event.pull_request.number }}
1921
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2022
steps:
23+
- name: Prepare CoreDump Env
24+
run: |
25+
mkdir -p /tmp/core_file/
26+
mkdir -p /var/lib/systemd/coredump/
27+
chown root:root /var/lib/systemd/coredump/
28+
chmod 755 /var/lib/systemd/coredump/
29+
apt install systemd-coredump -y
30+
cd /tmp/core_file
31+
ulimit -c unlimited
32+
cat /proc/sys/kernel/core_pattern
33+
echo "/tmp/core_file/" > /proc/sys/kernel/core_pattern
34+
cat << 'EOF' > segfault.c
35+
#include <signal.h>
36+
#include <unistd.h>
37+
38+
int main() {
39+
raise(SIGSEGV);
40+
return 0;
41+
}
42+
EOF
43+
44+
gcc -o segfault segfault.c
45+
./segfault || true
46+
ls -lh
47+
ls -l /var/lib/systemd/coredump/
48+
coredumpctl list
49+
dmesg
50+
51+
- name: Find Core File
52+
if: always()
53+
run: |
54+
cd /tmp/core_file
55+
ls -lh
56+
mkdir -p /var/lib/systemd/coredump/
57+
cd /var/lib/systemd/coredump/
58+
ls -lh
2159
- name: Free Disk Space
2260
run: rm -rf /useless/hostedtoolcache
2361
- uses: actions/checkout@v4
@@ -90,6 +128,11 @@ jobs:
90128
with:
91129
name: test_x86-${{ github.run_id }}
92130
path: ./build/
131+
- name: Prepare CoreDump Env
132+
run: |
133+
mkdir -p /tmp/core_file/
134+
ulimit -c unlimited
135+
cat /proc/sys/kernel/core_pattern
93136
- name: Do Asan Test In ${{ matrix.test_type }}
94137
run: |
95138
echo leak:libomp.so > omp.supp
@@ -104,6 +147,22 @@ jobs:
104147
compression-level: 1
105148
retention-days: 1
106149
overwrite: 'true'
150+
- name: Find Core File
151+
if: always()
152+
run: |
153+
corefile_path=`find . -name "core.*"`
154+
echo $corefile_path
155+
mv corefile_path /tmp/core_file/
156+
mkdir -p /var/lib/systemd/coredump/
157+
find /var/lib/systemd/coredump/ -name "core.*"
158+
- name: Upload Core File
159+
uses: actions/upload-artifact@v4
160+
with:
161+
path: /tmp/core_file/core*, ./build/test/${{ matrix.test_type }}
162+
name: corefile-x86-${{ matrix.test_type }}-${{ github.run_id }}
163+
compression-level: 1
164+
retention-days: 1
165+
overwrite: 'true'
107166

108167
test_asan_aarch64:
109168
name: Test Aarch64

0 commit comments

Comments
 (0)