From eb02dfb0ae5d26af74ae88f4e96d3098161c3870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= <karel.koci@nic.cz> Date: Wed, 15 Jul 2020 09:38:32 +0200 Subject: [PATCH] Add ability to specify target branch to test This is now only initial implementation. There should be also specification of board and more but that is going to be added later on once we are able to run tests on more than one board. --- imgs/boot/bin/prepare_turris_image | 8 ++------ tests/conftest.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/imgs/boot/bin/prepare_turris_image b/imgs/boot/bin/prepare_turris_image index 03937c7..4548268 100755 --- a/imgs/boot/bin/prepare_turris_image +++ b/imgs/boot/bin/prepare_turris_image @@ -2,15 +2,11 @@ set -e TFTP_ROOT="/var/tftpboot" -# TODO use this -BOARD="$1" -MODE="$2" -TARGET="$3" -# TODO +branch="${1:-hbk}" # Get appropriate medkit wait4network -wget "https://repo.turris.cz/hbk/medkit/omnia-medkit-latest.tar.gz" -O medkit.tar.gz +wget "https://repo.turris.cz/$branch/medkit/omnia-medkit-latest.tar.gz" -O medkit.tar.gz # Repack as CPIO mkdir root diff --git a/tests/conftest.py b/tests/conftest.py index 3e269c5..53be587 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,9 +1,9 @@ -import pytest import os import time import random import string import configparser +import pytest import nsfarm.board import nsfarm.cli import nsfarm.lxd @@ -21,6 +21,12 @@ def pytest_addoption(parser): help="Path to configuration file with additional targets.", metavar="PATH", ) + parser.addoption( + "-B", "--branch", + default="hbk", + help="Run tests for specified Turris OS BRANCH.", + metavar="BRANCH", + ) def pytest_configure(config): @@ -36,6 +42,8 @@ def pytest_configure(config): if target not in targets: raise Exception(f"No configuration for target: {target}") setattr(config, "target_config", targets[target]) + # Set target branch + setattr(config, "target_branch", config.getoption("-B")) def pytest_runtest_setup(item): @@ -85,7 +93,7 @@ def fixture_board_serial(request, board, wan): Provides instance of nsfarm.cli.Shell() """ request.addfinalizer(lambda: board.reset(True)) - return board.bootup(wan) + return board.bootup(wan, request.config.target_branch) @pytest.fixture(name="board_root_password", scope="session") -- GitLab