Skip to content

Commit d1590a1

Browse files
authored
tests : checkbox rework to be synced with latest test (#337)
1 parent 2cd1a18 commit d1590a1

File tree

4 files changed

+77
-144
lines changed

4 files changed

+77
-144
lines changed

tests/bin/setup-env-and-run

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,24 @@
1616
# of MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
1717
# See the GNU General Public License for more details.
1818

19-
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
19+
# this is the wrapper script to run a test file with pytest
2020

21+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
2122
PROVIDER_FOLDER=${SNAP}/providers/checkbox-provider-tdx
2223

2324
# for provider python simple utilities
2425
export PYTHONPATH=${PYTHONPATH}:${PROVIDER_FOLDER}/lib
2526
# for tdxtools package
2627
export PYTHONPATH=${PYTHONPATH}:${SNAP}/lib/python3.12/site-packages/
2728

29+
# use a cache for pytest
2830
PYTEST_CACHE=${PLAINBOX_SESSION_SHARE}/pytest/.pytest_cache
2931
mkdir -p ${PYTEST_CACHE}
3032

33+
# Go to the pytest folder, it is important for pytest to load some
34+
# conf files (conftest.py)
35+
36+
# default pytest arguments
3137
# -s : do not capture logs
3238
# -v : increase verbosity
33-
pytest -o cache_dir=${PYTEST_CACHE} -s -v ${PROVIDER_FOLDER}/tests/$1
39+
cd ${PROVIDER_FOLDER}/tests && pytest -o cache_dir=${PYTEST_CACHE} -s -v "$@"

tests/checkbox/checkbox-provider-tdx/units/test-plan.pxu

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ include:
55
tdx-host/.*
66
tdx-guest/.*
77
tdx-boot/.*
8-
tdx-perf/.*
98
tdx-quote/.*
109
tdx-stress/.*
10+
tdx-eventlog/.*
1111
mandatory_include:
1212
com.canonical.certification::miscellanea/submission-resources
1313
bootstrap_include:
@@ -69,6 +69,17 @@ bootstrap_include:
6969
com.canonical.certification::executable
7070
com.canonical.certification::snap
7171

72+
id: intel-tdx-eventlog
73+
unit: test plan
74+
_name: Intel Trusted Domain eXtension (TDX) eventlog tests
75+
include:
76+
tdx-eventlog/.*
77+
mandatory_include:
78+
com.canonical.certification::miscellanea/submission-resources
79+
bootstrap_include:
80+
com.canonical.certification::executable
81+
com.canonical.certification::snap
82+
7283
id: intel-tdx-stress
7384
unit: test plan
7485
_name: Intel Trusted Domain eXtension (TDX) stress tests
Lines changed: 56 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,262 +1,178 @@
1-
id: tdx-host/platform-check
1+
id: tdx-host/test_host_tdx_hardware_enabled
22
category_id: tdx-host
33
flags: simple
44
user: root
5-
_summary: Check if platform is TDX capable
5+
_summary: Check if platform is TDX capable from hardware standpoint
66
depends:
77
after:
88
requires:
99
command:
10-
setup-env-and-run test_host_tdx_hardware.py
10+
setup-env-and-run host/test_host_tdx_hardware.py -k 'test_host_tdx_hardware_enabled'
1111

12-
id: tdx-host/tdx-module-check
12+
id: tdx-host/test_host_tdx_cpu
1313
category_id: tdx-host
1414
flags: simple
1515
user: root
16-
_summary: Check if TDX module has been properly initialized
16+
_summary: Check if the CPU is TDX capable
1717
depends:
18-
tdx-host/platform-check
18+
tdx-host/test_host_tdx_hardware_enabled
1919
after:
2020
requires:
2121
command:
22-
setup-env-and-run test_host_tdx_software.py
22+
setup-env-and-run host/test_host_tdx_software.py -k 'test_host_tdx_cpu'
2323

24-
id: tdx-host/qemu-basic-td-creation
24+
id: tdx-host/test_host_tdx_software
2525
category_id: tdx-host
2626
flags: simple
2727
user: root
28-
_summary: Check if TD guest can be created with QEMU
28+
_summary: Check if the software stack is TDX capable
2929
depends:
30+
tdx-host/test_host_tdx_hardware_enabled
3031
after:
3132
requires:
32-
executable.name == 'qemu-system-x86_64'
3333
command:
34-
which qemu-system-x86_64
35-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
36-
qemu-system-x86_64 --version
34+
setup-env-and-run host/test_host_tdx_software.py -k 'test_host_tdx_software'
3735

38-
id: tdx-boot/td-boot
39-
category_id: tdx-boot
36+
id: tdx-host/test_host_tdx_module_load
37+
category_id: tdx-host
4038
flags: simple
41-
_summary: Test TD boot
39+
user: root
40+
_summary: Check if the TDX module is loaded
4241
depends:
42+
tdx-host/test_host_tdx_hardware_enabled
4343
after:
4444
requires:
45-
executable.name == 'qemu-system-x86_64'
4645
command:
47-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
48-
setup-env-and-run test_boot_basic.py
46+
setup-env-and-run host/test_host_tdx_software.py -k 'test_host_tdx_module_load'
4947

50-
id: tdx-boot/td-nmi
48+
id: tdx-boot/td-boot-guest
5149
category_id: tdx-boot
5250
flags: simple
53-
_summary: Test TD nmi after boot
51+
_summary: Test TD boot
5452
depends:
5553
after:
5654
requires:
5755
executable.name == 'qemu-system-x86_64'
5856
command:
59-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
60-
setup-env-and-run test_nmi_debug_off.py
57+
setup-env-and-run boot/test_boot_basic.py -k 'test_guest_boot'
6158

62-
id: tdx-boot/td-coexist
59+
id: tdx-boot/td-boot-guest-printk
6360
category_id: tdx-boot
6461
flags: simple
65-
_summary: Test coexistence of TD and VM
62+
_summary: Test TD boot earlyprintk
6663
depends:
6764
after:
6865
requires:
6966
executable.name == 'qemu-system-x86_64'
7067
command:
71-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
72-
setup-env-and-run test_boot_coexist.py
68+
setup-env-and-run boot/test_boot_basic.py -k 'test_guest_early_printk'
7369

74-
id: tdx-boot/td-creation
70+
id: tdx-boot/td-coexist
7571
category_id: tdx-boot
7672
flags: simple
77-
_summary: Test TD creation
73+
_summary: Test coexistence of TD and VM
7874
depends:
7975
after:
8076
requires:
8177
executable.name == 'qemu-system-x86_64'
8278
command:
83-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
84-
setup-env-and-run test_boot_td_creation.py
79+
setup-env-and-run boot/test_boot_coexist.py -k 'test_coexist_boot'
8580

86-
id: tdx-boot/td-creation-multiple
81+
id: tdx-boot/td-creation-without-ovmf
8782
category_id: tdx-boot
8883
flags: simple
89-
_summary: Test multiple TD creation
84+
_summary: Test TD creation
9085
depends:
9186
after:
9287
requires:
9388
executable.name == 'qemu-system-x86_64'
9489
command:
95-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
96-
setup-env-and-run test_boot_multiple.py
90+
setup-env-and-run boot/test_boot_td_creation.py -k 'test_create_td_without_ovmf'
9791

98-
id: tdx-stress/td-resource-limits
99-
category_id: tdx-stress
92+
id: tdx-boot/test_4vcpus_1socket_10times
93+
category_id: tdx-boot
10094
flags: simple
101-
_summary: Test resource limits
95+
_summary: Test multiple TD creation
10296
depends:
10397
after:
10498
requires:
10599
executable.name == 'qemu-system-x86_64'
106100
command:
107-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
108-
setup-env-and-run test_stress_resources.py
109-
110-
#id: tdx-stress/td-stress-boot
111-
#category_id: tdx-stress
112-
#flags: simple
113-
#_summary: Test boot stress
114-
#depends:
115-
#after:
116-
#requires:
117-
# executable.name == 'qemu-system-x86_64'
118-
#command:
119-
# export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
120-
# setup-env-and-run test_stress_boot.py
101+
setup-env-and-run boot/test_boot_multiple.py -k 'test_4vcpus_1socket_10times'
121102

122-
id: tdx-guest/td-measurement
123-
category_id: tdx-guest
103+
id: tdx-boot/test_4vcpus_2sockets_5times
104+
category_id: tdx-boot
124105
flags: simple
125-
_summary: Test guest measurements
106+
_summary: Test multiple TD creation
126107
depends:
127108
after:
128109
requires:
129110
executable.name == 'qemu-system-x86_64'
130111
command:
131-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
132-
setup-env-and-run test_guest_measurement.py
112+
setup-env-and-run boot/test_boot_multiple.py -k 'test_4vcpus_2sockets_5times'
133113

134-
id: tdx-guest/td-ita
114+
id: tdx-guest/test_guest_cpu_off
135115
category_id: tdx-guest
136116
flags: simple
137-
_summary: Test guest Intel Trust Authority
117+
_summary: Test TD with cpu on/off
138118
depends:
139119
after:
140120
requires:
141121
executable.name == 'qemu-system-x86_64'
142122
command:
143-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
144-
setup-env-and-run test_guest_ita.py
123+
setup-env-and-run boot/test_guest_cpu_off.py -k 'test_guest_cpu_off'
145124

146-
id: tdx-guest/td-libtdx-attest
125+
id: tdx-guest/test_guest_cpu_pinned_off
147126
category_id: tdx-guest
148127
flags: simple
149-
_summary: Test guest libtdx_attest
128+
_summary: Test TD with cpu pinned
150129
depends:
151130
after:
152131
requires:
153132
executable.name == 'qemu-system-x86_64'
154133
command:
155-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
156-
setup-env-and-run test_guest_tdxattest.py
134+
setup-env-and-run boot/test_guest_cpu_off.py -k 'test_guest_cpu_pinned_off'
157135

158-
id: tdx-guest/td-guest-reboot
136+
id: tdx-guest/test_nmi_debug_off
159137
category_id: tdx-guest
160138
flags: simple
161-
_summary: Test guest multiple boot
139+
_summary: Test TD nmi after boot
162140
depends:
163141
after:
164142
requires:
165143
executable.name == 'qemu-system-x86_64'
166144
command:
167-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
168-
setup-env-and-run test_boot_multiple.py
145+
setup-env-and-run test_nmi_debug_off.py -k 'test_nmi_debug_off'
169146

170-
id: tdx-guest/td-guest-report
171-
category_id: tdx-guest
147+
id: tdx-stress/test_stress_boot
148+
category_id: tdx-stress
172149
flags: simple
173-
_summary: Test guest report
150+
_summary: Test TD boot loop
174151
depends:
175152
after:
176153
requires:
177154
executable.name == 'qemu-system-x86_64'
178155
command:
179-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
180-
setup-env-and-run test_guest_report.py
156+
setup-env-and-run stress/test_stress_boot.py -k 'test_stress_boot'
181157

182-
id: tdx-guest/td-guest-eventlog
158+
id: tdx-eventlog/test_guest_measurement_check_rtmr
183159
category_id: tdx-guest
184160
flags: simple
185-
_summary: Test guest eventlog
186-
depends:
187-
after:
188-
requires:
189-
executable.name == 'qemu-system-x86_64'
190-
command:
191-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
192-
setup-env-and-run test_guest_eventlog.py
193-
194-
#id: tdx-perf/td-perf-benchmark
195-
#category_id: tdx-perf
196-
#flags: simple
197-
#_summary: Test perf benchmark
198-
#depends:
199-
#after:
200-
#requires:
201-
# executable.name == 'qemu-system-x86_64'
202-
#command:
203-
# export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
204-
# setup-env-and-run test_perf_benchmark.py
205-
206-
id: tdx-perf/td-perf-boot-time
207-
category_id: tdx-perf
208-
flags: simple
209-
_summary: Test perf boot-time
161+
_summary: Test guest measurements
210162
depends:
211163
after:
212164
requires:
213165
executable.name == 'qemu-system-x86_64'
214166
command:
215-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
216-
setup-env-and-run test_perf_boot_time.py
167+
setup-env-and-run eventlog/test_guest_measurement.py -k 'test_guest_measurement_check_rtmr'
217168

218-
id: tdx-quote/td-quote-configfs-tsm
169+
id: tdx-quote/test_quote_check_configfs_tsm
219170
category_id: tdx-quote
220171
flags: simple
221-
_summary: Test quote configfs tsm
222-
depends:
223-
after:
224-
requires:
225-
executable.name == 'qemu-system-x86_64'
226-
command:
227-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
228-
setup-env-and-run test_quote_configfs_tsm.py
229-
230-
id: tdx-guest/td-vsock
231-
category_id: tdx-guest
232-
flags: simple
233-
_summary: Test TD vsock between host and VM
234-
depends:
235-
after:
236-
requires:
237-
executable.name == 'qemu-system-x86_64'
238-
executable.name == 'iperf3'
239-
command:
240-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
241-
# The order of binary look-up:
242-
# - test working folder
243-
# - checkbox
244-
# - provider
245-
# - snaps binaries (/snap/bin)
246-
# - host system
247-
# so for iperf3, the binary from the checkbox snap will be used.
248-
# however we want to use the one from tdx provider (that has vsock support)
249-
export PATH=${SNAP}/usr/bin/:${PATH}
250-
setup-env-and-run test_vsock_vm.py
251-
252-
id: tdx-guest/td-memory
253-
category_id: tdx-guest
254-
flags: simple
255-
_summary: Test TD memory confidentiality
172+
_summary: Test guest configfs tsm check
256173
depends:
257174
after:
258175
requires:
259176
executable.name == 'qemu-system-x86_64'
260177
command:
261-
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
262-
setup-env-and-run test_guest_memory.py
178+
setup-env-and-run quote/test_quote_configfs_tsm.py -k 'test_quote_check_configfs_tsm'

tests/snap/snapcraft.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ parts:
104104
snapcraftctl prime
105105
# python3-pytest does not install the /usr/bin/pytest but only /usr/bin/pytest-3
106106
# we have to make the symlink ourself
107-
ln -sf pytest-3 usr/bin/pytest
107+
ln -sf py.test-3 usr/bin/pytest
108108
109109
tdx-tools:
110110
plugin: python

0 commit comments

Comments
 (0)