Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiaswal committed Nov 29, 2024
1 parent 9647dda commit 0c15871
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
1 change: 0 additions & 1 deletion test/case/ietf_system/bundles/package

This file was deleted.

17 changes: 11 additions & 6 deletions test/case/ietf_system/upgrade/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Verify it is possible to upgrade.
"""
# NOTE: THIS TEST IS HARDCODED TO NETCONF
# There is a bug somewhere in the restconf-code (infamy or rousette)
import os
import time
import netifaces
Expand Down Expand Up @@ -59,9 +61,10 @@ def set_boot_order(self, order):
os.unlink(PKGPATH)
except FileNotFoundError:
pass
#os.unlink(PKGPATH)
os.symlink(os.path.abspath(env.args.package), PKGPATH)

target = env.attach("target", "mgmt")
target = env.attach("target", "mgmt", "netconf")
target_ssh = env.attach("target", "mgmt", "ssh")
if target_ssh.run("test -e /sys/firmware/devicetree/base/chosen/u-boot,version".split()).returncode == 0:
bootloader=Uboot(target_ssh)
Expand Down Expand Up @@ -109,23 +112,25 @@ def set_boot_order(self, order):

if not wait_boot(target, env):
test.fail()
target = env.attach("target", "mgmt")
target = env.attach("target", "mgmt", "netconf")


with test.step("Verify that the correct partition is booted"):
with test.step("Verify that the partition is the booted"):
should_boot=bootloader.get_boot_order().split()[0]
oper = target.get_dict("/system-state/software")
booted = oper["system-state"]["software"]["booted"]
print(f"Should: {should_boot}, booted: {booted}")
assert(booted == should_boot)

with test.step("Restore bootorder to original configured."):
with test.step("Restore boot order to original configured"):
print(f"Restore boot order to {old_bootorder}")
if bootloader.set_boot_order(old_bootorder) != 0:
test.fail()
target = env.attach("target", "mgmt")
target = env.attach("target", "mgmt", "netconf")
target.reboot()
if not wait_boot(target, env):
test.fail()

test.succeed()
with test.step("Verify the boot order is the orignal configured"):
assert(old_bootorder == bootloader.get_boot_order())
test.succeed()
7 changes: 4 additions & 3 deletions test/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ mode-run := -t $(BINARIES_DIR)/qemu.dot
mode := $(mode-$(TEST_MODE))

INFIX_IMAGE_ID := $(call qstrip,$(INFIX_IMAGE_ID))
binaries-$(ARCH) := $(addprefix $(INFIX_IMAGE_ID),.img -disk.img .pkg)
binaries-$(ARCH) := $(addprefix $(INFIX_IMAGE_ID),.img -disk.img)
pkg-$(ARCH) := -p $(O)/images/$(addprefix $(INFIX_IMAGE_ID),.pkg)
binaries-x86_64 += OVMF.fd
binaries := $(foreach bin,$(binaries-$(ARCH)),-f $(BINARIES_DIR)/$(bin))

Expand All @@ -32,10 +33,10 @@ export INFAMY_ARGS := --transport=netconf
endif

test:
$(test-dir)/env -r $(base) $(mode) $(binaries) $(ninepm) $(TESTS)
$(test-dir)/env -r $(base) $(mode) $(binaries) $(pkg-$(ARCH)) $(ninepm) $(TESTS)

test-sh:
$(test-dir)/env $(base) $(mode) $(binaries) -i /bin/sh
$(test-dir)/env $(base) $(mode) $(binaries) $(pkg-$(ARCH)) -i /bin/sh

test-spec:
@esc_infix_name="$(echo $(INFIX_NAME) | sed 's/\//\\\//g')"; \
Expand Down

0 comments on commit 0c15871

Please sign in to comment.