Skip to content
Snippets Groups Projects
Verified Commit eb02dfb0 authored by Karel Koci's avatar Karel Koci :metal:
Browse files

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.
parent 99cf14ee
1 merge request!2Initial development
......@@ -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
......
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")
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment