Skip to content

Commit

Permalink
Add prototype appliance test definition for integration testing
Browse files Browse the repository at this point in the history
Signed-off-by: Stevan Radaković <[email protected]>
  • Loading branch information
stevanradakovic committed Dec 6, 2024
1 parent 978d12e commit df883e4
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
12 changes: 12 additions & 0 deletions automated/linux/torizon/integration-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

. ../../lib/sh-test-lib

gitlab_token=""
# source the secrets file to get the gitlab_token env var
. ../../../../../../secrets > /dev/null 2>&1
install_deps "git curl python3-pip"
get_test_program "https://gitlab-ci-token:${gitlab_token}@gitlab.com/LinaroLtd/lava/appliance/baklava-integration.git" "baklava-integration" "main"
pip3 install -r requirements.txt
robot --pythonpath . --variable remote:True --outputdir=.. test/ > /dev/null 2>&1
exit 0
22 changes: 22 additions & 0 deletions automated/linux/torizon/integration-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
metadata:
name: integration-tests
format: "Lava-Test Test Definition 1.0"
description: "Run appliance integration tests in LAVA."
maintainer:
- [email protected]
os:
- debian
- ubuntu
devices:
- qemu
scope:
- functional

params:
SKIP_INSTALL: "false"

run:
steps:
- cd ./automated/linux/torizon/
- ./integration-tests.sh
- ../../utils/parse-robot-framework.py -r output.xml
48 changes: 48 additions & 0 deletions automated/utils/parse-robot-framework.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python

import argparse
import subprocess
from robot.api import ExecutionResult, ResultVisitor


def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"-r",
"--result-file",
dest="result_file",
default="./output.xml",
help="Specify robot framework XML test result file.",
)
args = parser.parse_args()
return args


def main():
result = ExecutionResult(args.result_file)

def get_all_tests(suite):
for test in suite.tests:
yield test
for sub_suite in suite.suites:
yield from get_all_tests(sub_suite)

for test in get_all_tests(result.suite):
try:
subprocess.check_output(
[
"lava-test-case",
f"\"test.name.replace(' ', '')\"",
"--result",
test.status.lower(),
],
stderr=subprocess.STDOUT,
shell=True,
)
except subprocess.CalledProcessError as exc:
print(exc.output.decode())


if __name__ == "__main__":
args = parse_args()
main()

0 comments on commit df883e4

Please sign in to comment.