Skip to content

Commit 245d916

Browse files
authored
Merge pull request #588 from lplewa/qemu
optimize qemu workflow
2 parents aec0a8f + 5f8692e commit 245d916

File tree

5 files changed

+91
-64
lines changed

5 files changed

+91
-64
lines changed

.github/workflows/pr_push.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ jobs:
204204
Sanitizers:
205205
needs: [Spellcheck, FastBuild, CodeStyle]
206206
uses: ./.github/workflows/sanitizers.yml
207+
Qemu:
208+
needs: [Spellcheck, FastBuild, CodeStyle]
209+
uses: ./.github/workflows/qemu.yml
207210
Benchmarks:
208211
needs: [Build]
209212
uses: ./.github/workflows/benchmarks.yml
@@ -213,9 +216,6 @@ jobs:
213216
GPU:
214217
needs: [Build]
215218
uses: ./.github/workflows/gpu.yml
216-
Qemu:
217-
needs: [Build]
218-
uses: ./.github/workflows/qemu.yml
219219
Valgrind:
220220
needs: [Build]
221221
uses: ./.github/workflows/valgrind.yml

.github/workflows/qemu.yml

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Qemu
44
on: workflow_call
55

66
env:
7-
CI_BRANCH : "${{ github.head_ref || github.ref_name }}"
7+
CI_BRANCH: "${{ github.head_ref || github.ref_name }}"
88

99
permissions:
1010
contents: read
@@ -13,19 +13,6 @@ jobs:
1313
qemu-build:
1414
name: Qemu
1515
runs-on: ubuntu-22.04
16-
strategy:
17-
matrix:
18-
config: [{name: 'default', hmat: 'on'},
19-
{ name: 'sock_2_var1', hmat: 'off'},
20-
{ name: 'sock_2_var1_hmat', hmat: 'on'},
21-
{ name: 'sock_2_var2', hmat: 'off'},
22-
{ name: 'sock_2_var2_hmat', hmat: 'on'},
23-
{ name: 'sock_2_var3', hmat: 'off'},
24-
{ name: 'sock_2_var3_hmat', hmat: 'on'},
25-
{ name: 'sock_4_var1', hmat: 'off'},
26-
{ name: 'sock_4_var1_hmat', hmat: 'on'},
27-
{ name: 'sock_4_var2', hmat: 'off'},
28-
{ name: 'sock_4_var2_hmat', hmat: 'on'}]
2916

3017
steps:
3118
- name: Checkout
@@ -83,38 +70,40 @@ jobs:
8370
run: wget https://cloud-images.ubuntu.com/releases/lunar/release/ubuntu-23.04-server-cloudimg-amd64.img
8471
- name: Resize image
8572
run: qemu-img resize ./ubuntu-23.04-server-cloudimg-amd64.img +4G
86-
- name: Print qemu args
87-
run: |
88-
# notice: should be sedded, but it hides status
89-
python3 scripts/qemu/qemu_config.py scripts/qemu/configs/${{matrix.config.name}}.xml
90-
- name: Run qemu
91-
run: |
92-
sudo qemu-system-x86_64 \
93-
-drive file=./ubuntu-23.04-server-cloudimg-amd64.img,format=qcow2,index=0,media=disk,id=hd \
94-
-cdrom ./ubuntu-cloud-init.iso \
95-
-machine q35,usb=off,hmat=${{matrix.config.hmat}} \
96-
-enable-kvm \
97-
-net nic -net user,hostfwd=tcp::2222-:22 \
98-
$(echo `python3 scripts/qemu/qemu_config.py scripts/qemu/configs/${{matrix.config.name}}.xml | sed s/''\''/'/g`) \
99-
-daemonize -display none
100-
- name: Run ssh keyscan
101-
run: |
102-
set +e
103-
ssh-keyscan -p 2222 -H 127.0.0.1 >> ~/.ssh/known_hosts
104-
while [ $? -ne 0 ]
105-
do
106-
echo "Trying to connect..."
107-
ps -aux | grep qemu
108-
sleep 5
109-
ssh-keyscan -p 2222 -H 127.0.0.1 >> ~/.ssh/known_hosts
110-
done
111-
- name: Run build on qemu
73+
- name: Build
11274
run: |
75+
scripts/qemu/start_qemu.sh scripts/qemu/configs/default.xml
76+
11377
if [ ${{ github.event_name }} = 'pull_request' ]; then
11478
CI_REPO="${{ github.event.pull_request.head.repo.full_name }}"
11579
else
11680
CI_REPO="$GITHUB_REPOSITORY"
11781
fi
11882
11983
scp -P 2222 ${{github.workspace}}/scripts/qemu/run-build.sh [email protected]:/home/cxltest
84+
scp -P 2222 ${{github.workspace}}/scripts/qemu/run-tests.sh [email protected]:/home/cxltest
12085
ssh [email protected] -p 2222 -t "bash /home/cxltest/run-build.sh https://github.com/$CI_REPO ${{env.CI_BRANCH}}"
86+
87+
ssh [email protected] -p 2222 -t "sudo shutdown -h now"
88+
89+
- name: Run tests
90+
run: |
91+
for config_file in scripts/qemu/configs/*.xml; do
92+
config_name=$(basename $config_file .xml)
93+
94+
echo testing $config_name
95+
while ps -aux | grep qemu-system-x86_64 | grep -q -v grep; do
96+
echo "Waiting for QEMU to shut down..."
97+
sleep 5
98+
done
99+
scripts/qemu/start_qemu.sh $config_file
100+
101+
if [ ${{ github.event_name }} = 'pull_request' ]; then
102+
CI_REPO="${{ github.event.pull_request.head.repo.full_name }}"
103+
else
104+
CI_REPO="$GITHUB_REPOSITORY"
105+
fi
106+
107+
ssh [email protected] -p 2222 -t "bash /home/cxltest/run-tests.sh"
108+
ssh [email protected] -p 2222 -t "sudo shutdown -h now"
109+
done

scripts/qemu/run-build.sh

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
set -x
76
set -e
87

98
repo=$1
@@ -12,11 +11,6 @@ branch=$2
1211
echo password | sudo -Sk apt update
1312
echo password | sudo -Sk apt install -y git cmake gcc g++ numactl libnuma-dev libhwloc-dev libjemalloc-dev libtbb-dev pkg-config valgrind hwloc
1413

15-
# Set ptrace value for IPC test
16-
echo password | sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
17-
18-
numactl -H
19-
2014
git clone $repo umf
2115
cd umf
2216
git checkout $branch
@@ -31,20 +25,7 @@ cmake .. \
3125
-DUMF_DEVELOPER_MODE=ON \
3226
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON \
3327
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON \
34-
-DUMF_BUILD_EXAMPLES=ON
28+
-DUMF_BUILD_EXAMPLES=ON \
29+
-DUMF_TESTS_FAIL_ON_SKIP=ON
3530

3631
make -j $(nproc)
37-
38-
# Drop caches, restores free memory on NUMA nodes
39-
echo password | sudo sync;
40-
echo password | sudo sh -c "/usr/bin/echo 3 > /proc/sys/vm/drop_caches"
41-
42-
ctest --verbose
43-
44-
# run tests bound to a numa node
45-
numactl -N 0 ctest --output-on-failure
46-
numactl -N 1 ctest --output-on-failure
47-
48-
# run tests under valgrind
49-
echo "Running tests under valgrind memcheck ..."
50-
../test/test_valgrind.sh .. . memcheck

scripts/qemu/run-tests.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# Copyright (C) 2024 Intel Corporation
3+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
set -e
7+
8+
# Drop caches, restores free memory on NUMA nodes
9+
echo password | sudo sync;
10+
echo password | sudo sh -c "/usr/bin/echo 3 > /proc/sys/vm/drop_caches"
11+
# Set ptrace value for IPC test
12+
echo password | sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
13+
14+
numactl -H
15+
16+
cd umf/build
17+
ctest --verbose
18+
19+
# run tests bound to a numa node
20+
numactl -N 0 ctest --output-on-failure
21+
numactl -N 1 ctest --output-on-failure
22+
23+
# run tests under valgrind
24+
echo "Running tests under valgrind memcheck ..."
25+
../test/test_valgrind.sh .. . memcheck
26+

scripts/qemu/start_qemu.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
# Copyright (C) 2024 Intel Corporation
3+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
set -x
7+
set -e
8+
9+
config_file=$1
10+
11+
python3 scripts/qemu/qemu_config.py $config_file
12+
13+
if grep -q '<interconnects>' "$config_file"; then
14+
hmat="on"
15+
else
16+
hmat="off"
17+
fi
18+
19+
sudo qemu-system-x86_64 \
20+
-drive file=./ubuntu-23.04-server-cloudimg-amd64.img,format=qcow2,index=0,media=disk,id=hd \
21+
-cdrom ./ubuntu-cloud-init.iso \
22+
-machine q35,usb=off,hmat=$hmat \
23+
-enable-kvm \
24+
-net nic -net user,hostfwd=tcp::2222-:22 \
25+
$(python3 scripts/qemu/qemu_config.py $config_file | sed s/''\''/'/g) \
26+
-daemonize -display none
27+
28+
until ssh-keyscan -p 2222 -H 127.0.0.1 >> ~/.ssh/known_hosts 2>/dev/null; do
29+
echo "Waiting for SSH..."
30+
sleep 1
31+
done

0 commit comments

Comments
 (0)