Skip to content

Commit 92f83e6

Browse files
committed
Add QEMU to Coverage
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 7ac81d5 commit 92f83e6

File tree

5 files changed

+58
-12
lines changed

5 files changed

+58
-12
lines changed

.github/workflows/coverage.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ jobs:
9393
name: exports-coverage-multinuma-os-ubuntu-22.04
9494
path: coverage
9595

96+
- name: Download files exports-coverage-qemu-all
97+
uses: actions/download-artifact@v4
98+
with:
99+
name: exports-coverage-qemu-all
100+
path: coverage
101+
96102
- name: Compute coverage
97103
working-directory: ${{env.COVERAGE_DIR}}
98104
run: |

.github/workflows/pr_push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,5 @@ jobs:
111111
needs: [Build]
112112
uses: ./.github/workflows/multi_numa.yml
113113
Coverage:
114-
needs: [Build, DevDax, GPU, MultiNuma]
114+
needs: [Build, DevDax, GPU, MultiNuma, Qemu]
115115
uses: ./.github/workflows/coverage.yml

.github/workflows/qemu.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on: workflow_call
66
permissions:
77
contents: read
88

9+
env:
10+
UMF_DIR: "/home/runner/work/unified-memory-framework/unified-memory-framework"
11+
912
jobs:
1013
qemu-build:
1114
name: Qemu
@@ -44,10 +47,10 @@ jobs:
4447
cat > user-data << EOF
4548
#cloud-config
4649
47-
# Add a 'testuser' user to the system with a password
50+
# Add a 'runner' user to the system with a password
4851
users:
4952
- default
50-
- name: testuser
53+
- name: runner
5154
gecos: Test User
5255
primary_group: wheel
5356
groups: users
@@ -61,7 +64,7 @@ jobs:
6164
chpasswd:
6265
list: |
6366
root:password
64-
testuser:password
67+
runner:password
6568
expire: False
6669
EOF
6770
@@ -82,12 +85,18 @@ jobs:
8285
run: |
8386
umf/scripts/qemu/start_qemu.sh default.xml
8487
85-
# Copy UMF repository's content into the home dir in QEMU
86-
rsync -az -e "ssh -p 2222" ${{github.workspace}}/umf/ [email protected]:/home/testuser/
87-
ssh [email protected] -p 2222 -t "sudo chown -R testuser:users /home/testuser"
88+
ssh [email protected] -p 2222 -t "sudo chown -R runner:users /home/runner"
89+
90+
# Coverage (lcov) has to be run in the same directory on all runners:
91+
# /home/runner/work/unified-memory-framework/unified-memory-framework/build
92+
# so we have to create the same path here.
93+
ssh [email protected] -p 2222 -t "mkdir -p ${{env.UMF_DIR}}"
94+
95+
# Copy UMF repository's content into QEMU.
96+
rsync -az -e "ssh -p 2222" ${{github.workspace}}/umf/ [email protected]:${{env.UMF_DIR}}/
8897
89-
ssh testuser@127.0.0.1 -p 2222 -t "bash /home/testuser/scripts/qemu/run-build.sh"
90-
ssh testuser@127.0.0.1 -p 2222 -t "sudo shutdown -h now"
98+
ssh runner@127.0.0.1 -p 2222 -t "bash ${{env.UMF_DIR}}/scripts/qemu/run-build.sh COVERAGE"
99+
ssh runner@127.0.0.1 -p 2222 -t "sudo shutdown -h now"
91100
92101
- name: Run tests in QEMU
93102
run: |
@@ -102,6 +111,13 @@ jobs:
102111
echo "\n ### Testing ${config_name} ###"
103112
umf/scripts/qemu/start_qemu.sh ${config_name}
104113
105-
ssh [email protected] -p 2222 -t "bash /home/testuser/scripts/qemu/run-tests.sh"
106-
ssh [email protected] -p 2222 -t "sudo shutdown -h now"
114+
ssh [email protected] -p 2222 -t "bash ${{env.UMF_DIR}}/scripts/qemu/run-tests.sh ${config_name}"
115+
scp -r -P 2222 [email protected]:/home/runner/coverage ./
116+
ssh [email protected] -p 2222 -t "sudo shutdown -h now"
107117
done
118+
ls -al ./coverage
119+
120+
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
121+
with:
122+
name: exports-coverage-qemu-all
123+
path: coverage

scripts/qemu/run-build.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@
55

66
set -e
77

8+
[ "$1" = "COVERAGE" ] && COVERAGE=ON || COVERAGE=OFF
9+
10+
# This is ${UMF_DIR}/scripts/qemu/run-build.sh file, so
11+
UMF_DIR=$(dirname $0)/../..
12+
cd $UMF_DIR
13+
pwd
14+
815
echo password | sudo -Sk apt-get update
916
echo password | sudo -Sk apt-get install -y git cmake gcc g++ pkg-config \
10-
numactl libnuma-dev hwloc libhwloc-dev libjemalloc-dev libtbb-dev valgrind
17+
numactl libnuma-dev hwloc libhwloc-dev libjemalloc-dev libtbb-dev valgrind lcov
1118

1219
mkdir build
1320
cd build
@@ -21,6 +28,7 @@ cmake .. \
2128
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON \
2229
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON \
2330
-DUMF_BUILD_EXAMPLES=ON \
31+
-DUMF_USE_COVERAGE=${COVERAGE} \
2432
-DUMF_TESTS_FAIL_ON_SKIP=ON
2533

2634
make -j $(nproc)

scripts/qemu/run-tests.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55

66
set -e
77

8+
CONFIG_NAME=$(echo $1 | cut -d. -f1) # remove the '.xml' extension
9+
COVERAGE_DIR=${HOME}/coverage
10+
SOURCE_DIR=$(pwd)
11+
12+
# This is ${UMF_DIR}/scripts/qemu/run-build.sh file, so
13+
UMF_DIR=$(dirname $0)/../..
14+
cd $UMF_DIR
15+
pwd
16+
817
# Drop caches, restores free memory on NUMA nodes
918
echo password | sudo sync;
1019
echo password | sudo sh -c "/usr/bin/echo 3 > /proc/sys/vm/drop_caches"
@@ -20,6 +29,13 @@ ctest --verbose
2029
numactl -N 0 ctest --output-on-failure
2130
numactl -N 1 ctest --output-on-failure
2231

32+
COVERAGE_FILE_NAME=exports-coverage-qemu-$CONFIG_NAME
33+
echo "COVERAGE_FILE_NAME: $COVERAGE_FILE_NAME"
34+
../scripts/coverage/coverage_capture.sh $COVERAGE_FILE_NAME
35+
mkdir -p $COVERAGE_DIR
36+
mv ./$COVERAGE_FILE_NAME $COVERAGE_DIR
37+
ls -al $COVERAGE_DIR
38+
2339
# run tests under valgrind
2440
echo "Running tests under valgrind memcheck ..."
2541
../test/test_valgrind.sh .. . memcheck

0 commit comments

Comments
 (0)