Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# This config file stores necessary test and other configuration parameters
# This config file is applicable only to the previous Kuiper version thus the branch is set to main_old
# The new Kuiper version uses a different config file and the branch is set to main
---
testinfra:
host: "paramiko://analog:analog@localhost"

repo:
uri: https://github.com/analogdevicesinc/adi-kuiper-gen.git
branch: master
branch: main_old

packages:
paths:
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
atomicwrites==1.4.0
attrs==20.3.0
bcrypt==3.2.0
cffi==1.14.3
cffi==1.17.1
colorama==0.4.4
cryptography==3.2.1
gitdb==4.0.5
Expand All @@ -16,12 +16,12 @@ py==1.9.0
pycparser==2.20
PyNaCl==1.4.0
pyparsing==2.4.7
pytest==7.3.1
pytest>=7.4.4
pytest-html==3.1.1
pytest-testinfra==6.1.0
pytest-timeout==1.4.2
pytest_check==1.0.4
PyYAML==5.3.1
PyYAML>=6.0.0
six==1.15.0
smmap==3.0.4
toml==0.10.2
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
# timeout = 5
# timeout_method = thread
markers =
hardware_check: Run hardware related checks
hardware_check: Run hardware related checks
artifactory_check: Run artifactory boot files checks
16 changes: 10 additions & 6 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,28 @@

@task(
help={
"config" : "Configuration file to use",
"tree" : "Checkout to particular tree(branch or commit)"
},
)
def fetchkuipergen(c, tree=None):
def fetchkuipergen(c, config=None, tree=None):
""" Installs (Clone or pull) copy of ADI Kuiper Gen to host"""
utils.fetch_files(tree=tree)
utils.fetch_files(config=config, tree=tree)

@task(iterable=['files'],
help={
"config" : "Configuration file to use",
"files": "Set to test only files specified.",
"tree" : "Checkout to particular tree(branch or commit)",
"host" : "Target using format <backend>://<credentials>@<ip>",
"ip" : "IP of DUT, will assume paramiko backend"
"ip" : "IP of DUT, will assume paramiko backend",
"hardware_less" : "Run tests without hardware check",
"artifactory_target" : "Absolute path of target folder containing boot files",
},
)
def test(
c,
config=None,
files=None,
tree=None,
host=None,
Expand All @@ -29,9 +34,8 @@ def test(
artifactory_target=None
):
""" Run pytest tests """

# update adi kuiper gen repo
utils.fetch_files(tree=tree)
utils.fetch_files(config=config, tree=tree)

# build command based on parameters
target = ''
Expand All @@ -49,7 +53,7 @@ def test(
options = options + ' --ip={}'.format(ip)

if hardware_less:
options = options + ' -m "not hardware_check"'
options = options + '-m "not hardware_check"'

if artifactory_target:
options = options + ' -m "artifactory_check" --artifactory_target={}'\
Expand Down
2 changes: 1 addition & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def pytest_addoption(parser):
default=None,
help="Common project name of the board. ex: socfpga_arria10_socdk_daq2"
)

@pytest.fixture
def host(request):
# if host is given, ip and config will be ignored
Expand Down
40 changes: 17 additions & 23 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import functools
import pytest
import signal
import shutil
from sys import platform
from artifactory import ArtifactoryPath

Expand Down Expand Up @@ -109,29 +110,22 @@ def fetch_files(config=None, tree=None):
git_branch = data.get("repo").get("branch")
git_repo_dir = os.path.join(
get_package_path(), '..', OS_GEN_REPO_NAME)

try:
# use existing repo and update for any changes from remote using pull
print("Updating repo {}".format(git_repo_dir))
g = git.Repo(git_repo_dir).git
if not tree:
tree = g.log(pretty="format:%H",n=1)
g.checkout(tree)
print("Checkout to {}".format(tree))
status = g.pull('origin',tree)
print("Repo {} status: {}".format(git_repo_dir, status))
except(git.exc.NoSuchPathError, git.exc.InvalidGitRepositoryError) as exc:
# create a new repo by cloning remote
print(str(exc))
print("Cloning from {} to {}".format(git_uri, git_repo_dir))
g = git.Git(os.path.join(get_package_path(), '..'))
g.clone(git_uri)
print("Repo {} has been cloned from {} branch {}"\
.format(git_repo_dir, git_uri, git_branch))
if tree:
g = git.Repo(git_repo_dir).git
status = g.checkout(tree)
print("Checkout to {}".format(tree))
if tree:
git_branch = tree
# check if the directory already exists
if os.path.exists(git_repo_dir):
print(f"Deleting existing directory: {git_repo_dir}")
shutil.rmtree(git_repo_dir)
# always clone the repo to ensure we have the latest version
print("Cloning from {} to {}".format(git_uri, git_repo_dir))
git.Repo.clone_from(
git_uri,
git_repo_dir,
branch=git_branch,
depth=1
)
print("Repo {} has been cloned from {} branch {}"\
.format(git_repo_dir, git_uri, git_branch))

def get_host(backend='paramiko',username='analog', password='analog',host=None, ip=None):
if host:
Expand Down