Skip to content

Commit 5f0c76f

Browse files
committed
add test of confidential VMs with multiple vCPUs
Signed-off-by: Wojciech Ozga <woz@zurich.ibm.com>
1 parent 5336f21 commit 5f0c76f

6 files changed

Lines changed: 42 additions & 3 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
hello from confidential VM's filesystem
1+
hello from confidential VM filesystem
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
hello from confidential VM's filesystem
1+
hello from confidential VM filesystem

hypervisor/rootfs/selftest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# This script runs all tests in harness
77

8-
declare -a TESTS=("test_attestation")
8+
declare -a TESTS=("test_attestation" "test_smp")
99

1010
for i in "${TESTS[@]}"; do
1111
./$i.sh 2>&1 > $i.log

hypervisor/rootfs/test_attestation.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ $SSH_CMD -p${TVM_PORT} ${TVM_USER}@${TVM_HOST} 'dmesg | grep Secret' > tmp_dmesg
2020
ATTESTATION_RESULT="$(grep 'Secret=0xc0ffee' tmp_dmesg.log | wc -l)"
2121

2222
kill_confidential_vm
23+
sleep 5
2324

2425
if [[ "x$ATTESTATION_RESULT" == "x1" ]]; then
2526
echo "Attestation test succeeded"

hypervisor/rootfs/test_smp.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
# SPDX-FileCopyrightText: 2025 IBM Corporation
3+
# SPDX-FileContributor: Wojciech Ozga <woz@zurich.ibm.com>, IBM Research - Zurich
4+
# SPDX-License-Identifier: Apache-2.0
5+
. common.sh
6+
7+
/root/run_linux_vm_qemu.sh -s=2 -m=256M --daemonize 2>&1 > tmp_run_smp.log &
8+
sleep 5
9+
10+
TVM_USER="root"
11+
TVM_HOST="localhost"
12+
TVM_PORT="$(grep 'SSH port' tmp_run_smp.log | awk -F': ' '{ print $2 }' )"
13+
echo "TVM's SSH is listening on port: $TVM_PORT"
14+
15+
wait_for_ssh $TVM_USER $TVM_HOST $TVM_PORT
16+
17+
$SSH_CMD -p${TVM_PORT} ${TVM_USER}@${TVM_HOST} 'cat /root/this_is_confidential_vm_filesystem' > tmp_smp_dmesg.log
18+
RESULT="$(grep 'hello from confidential VM filesystem' tmp_smp_dmesg.log | wc -l)"
19+
20+
kill_confidential_vm
21+
sleep 5
22+
23+
if [[ "x$RESULT" == "x1" ]]; then
24+
echo "SMP test succeeded"
25+
exit 0
26+
else
27+
echo "SMP test failed"
28+
exit 1
29+
fi

tools/common.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ function wait_for_ssh () {
1919
done
2020
}
2121

22+
function kill_users_qemu () {
23+
USER="$(whoami)"
24+
PID="$(ps aux | grep qemu | grep ${USER} | awk -F' ' '{ print $2 }')"
25+
if [ "$PID" != "" ]; then
26+
kill -9 $PID
27+
wait $PID 2>/dev/null
28+
fi
29+
}
30+
2231
# Usage: kill_qemu "22"
2332
function kill_qemu () {
2433
PORT=$1

0 commit comments

Comments
 (0)