Skip to content

Commit f65c69c

Browse files
authored
Merge pull request #984 from sever-sever/T7706
T7606: Split VPP test for smoketest
2 parents 5e1e6cb + f2ac2fb commit f65c69c

2 files changed

Lines changed: 70 additions & 2 deletions

File tree

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ test: checkiso
2828
test-no-interfaces: checkiso
2929
scripts/check-qemu-install --debug --configd --smoketest --uefi --no-interfaces --cpu 4 --memory 8 build/live-image-amd64.hybrid.iso
3030

31+
.PHONY: test-no-interfaces-no-vpp
32+
.ONESHELL:
33+
test-no-interfaces-no-vpp: checkiso
34+
scripts/check-qemu-install --debug --configd --smoketest --uefi --no-interfaces --no-vpp build/live-image-amd64.hybrid.iso
35+
3136
.PHONY: test-interfaces
3237
.ONESHELL:
3338
test-interfaces: checkiso
@@ -36,12 +41,17 @@ test-interfaces: checkiso
3641
.PHONY: test-vpp
3742
.ONESHELL:
3843
test-vpp: checkiso
39-
scripts/check-qemu-install --debug --configd --match="vpp" --smoketest --uefi --cpu 4 --memory 8 build/live-image-amd64.hybrid.iso
44+
scripts/check-qemu-install --debug --configd --match="vpp" --smoketest --uefi --cpu 4 --memory 8 --huge-page-size 2M --huge-page-count 1800 build/live-image-amd64.hybrid.iso
4045

4146
.PHONY: testc
4247
.ONESHELL:
4348
testc: checkiso
44-
scripts/check-qemu-install --debug --configd --cpu 2 --memory 7 --configtest build/live-image-amd64.hybrid.iso $(filter-out $@,$(MAKECMDGOALS))
49+
scripts/check-qemu-install --debug --configd --match="!vpp" --cpu 2 --memory 7 --configtest build/live-image-amd64.hybrid.iso $(filter-out $@,$(MAKECMDGOALS))
50+
51+
.PHONY: testcvpp
52+
.ONESHELL:
53+
testcvpp: checkiso
54+
scripts/check-qemu-install --debug --configd --match="vpp" --cpu 4 --memory 8 --huge-page-size 2M --huge-page-count 1800 --configtest build/live-image-amd64.hybrid.iso $(filter-out $@,$(MAKECMDGOALS))
4555

4656
.PHONY: testraid
4757
.ONESHELL:

scripts/check-qemu-install

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ parser.add_argument('--cpu', help='Set QEMU CPU', type=int, default=2)
9999
parser.add_argument('--memory', help='Set QEMU memory', type=int, default=4)
100100
parser.add_argument('--vyconf', help='Execute testsuite with vyconfd', action='store_true',
101101
default=False)
102+
parser.add_argument('--no-vpp', help='Execute testsuite without VPP tests',
103+
action='store_true', default=False)
104+
parser.add_argument('--huge-page-size', help='Huge page size (e.g., 2M, 1G)', type=str)
105+
parser.add_argument('--huge-page-count', help='Number of huge pages to allocate', type=int)
102106

103107
args = parser.parse_args()
104108

@@ -411,6 +415,22 @@ try:
411415
exit(1)
412416

413417
#################################################
418+
# Configure boot options if required
419+
#################################################
420+
if args.huge_page_size and args.huge_page_count:
421+
c.sendline('configure')
422+
c.expect(cfg_mode_prompt)
423+
c.sendline(f'set system option kernel memory hugepage-size {args.huge_page_size} hugepage-count {args.huge_page_count}')
424+
c.expect(cfg_mode_prompt)
425+
c.sendline('set system option kernel disable-mitigations')
426+
c.expect(cfg_mode_prompt)
427+
c.sendline('commit')
428+
c.expect(cfg_mode_prompt)
429+
c.sendline('save')
430+
c.expect(cfg_mode_prompt)
431+
c.sendline('exit')
432+
c.expect(op_mode_prompt)
433+
#################################################
414434
# Installing into VyOS system
415435
#################################################
416436
log.info('Starting installer')
@@ -526,6 +546,14 @@ try:
526546

527547
loginVM(c, log)
528548

549+
#################################################
550+
# Boot options require a reboot
551+
#################################################
552+
if args.huge_page_size and args.huge_page_count:
553+
log.info('Rebooting to apply kernel boot options')
554+
c.sendline('reboot now')
555+
loginVM(c, log)
556+
529557
################################################
530558
# Always load the WiFi simulation module
531559
################################################
@@ -570,6 +598,12 @@ try:
570598
c.expect(op_mode_prompt)
571599
c.sendline('show system memory')
572600
c.expect(op_mode_prompt)
601+
c.sendline('show system memory detail | no-more')
602+
c.expect(op_mode_prompt)
603+
c.sendline('show configuration commands | match kernel')
604+
c.expect(op_mode_prompt)
605+
c.sendline('cat /proc/cmdline')
606+
c.expect(op_mode_prompt)
573607
c.sendline('show version all | grep -e "vpp" -e "vyos-1x"')
574608
c.expect(op_mode_prompt)
575609

@@ -806,6 +840,10 @@ try:
806840
# remove interface tests as they consume a lot of time
807841
c.sendline('sudo rm -f /usr/libexec/vyos/tests/smoke/cli/test_interfaces_*')
808842
c.expect(op_mode_prompt)
843+
if args.no_vpp:
844+
# remove VPP tests
845+
c.sendline('sudo rm -f /usr/libexec/vyos/tests/smoke/cli/test_vpp*')
846+
c.expect(op_mode_prompt)
809847

810848
if args.vyconf:
811849
c.sendline('sudo /usr/libexec/vyos/set_vyconf_backend.py --no-prompt &> /dev/null')
@@ -837,6 +875,26 @@ try:
837875

838876
# else, run configtest suite
839877
elif args.configtest:
878+
# Remove config-tests that we don't want to run
879+
if args.match:
880+
if args.match.startswith("!"):
881+
# Exclude mode — delete only the matched names
882+
names = args.match[1:].split("|")
883+
match_str = '-o '.join([f'-name "{name}"' for name in names])
884+
cleanup_config_dir_cmd = f'sudo find /usr/libexec/vyos/tests/config -mindepth 1 -maxdepth 1 \\( {match_str} \\) -exec rm -rf {{}} +'
885+
cleanup_config_tests_dir_cmd = f'sudo find /usr/libexec/vyos/tests/config-tests -mindepth 1 -maxdepth 1 \\( {match_str} \\) -exec rm -rf {{}} +'
886+
else:
887+
# Include mode — keep only the matched names, delete the rest
888+
names = args.match.split("|")
889+
match_str = '-o '.join([f'-name "{name}"' for name in names])
890+
cleanup_config_dir_cmd = f'sudo find /usr/libexec/vyos/tests/config -mindepth 1 -maxdepth 1 ! \\( {match_str} \\) -exec rm -rf {{}} +'
891+
cleanup_config_tests_dir_cmd = f'sudo find /usr/libexec/vyos/tests/config-tests -mindepth 1 -maxdepth 1 ! \\( {match_str} \\) -exec rm -rf {{}} +'
892+
893+
c.sendline(cleanup_config_dir_cmd)
894+
c.expect(op_mode_prompt)
895+
c.sendline(cleanup_config_tests_dir_cmd)
896+
c.expect(op_mode_prompt)
897+
840898
log.info('Adding a legacy WireGuard default keypair for migrations')
841899
c.sendline('sudo mkdir -p /config/auth/wireguard/default')
842900
c.expect(op_mode_prompt)

0 commit comments

Comments
 (0)