forked from Linaro/lava-test-plans
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtest_lava_test_plans.py
More file actions
109 lines (96 loc) · 3.44 KB
/
test_lava_test_plans.py
File metadata and controls
109 lines (96 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
from lava_test_plans.__main__ import main
from unittest import TestCase
from unittest.mock import patch, MagicMock
import sys
import glob
import os
import pytest
import shlex
import tempfile
test_lava_validity = (
"" if os.getenv("SKIP_TEST_LAVA_VALIDITY") else "--test-lava-validity"
)
# all Linux tests all devices
devices = [os.path.basename(d) for d in glob.glob("lava_test_plans/devices/*")]
testcases = [
os.path.basename(d)
for d in glob.glob("lava_test_plans/testcases/[!android-]*.yaml")
]
variable_input_file = "variables.ini"
tests = []
for device in devices:
if device == "variables":
continue
for testcase in testcases:
tests.append((variable_input_file, device, testcase))
@pytest.mark.parametrize("param", tests)
def test_call_lava_test_plan_testcases(param):
variable_input_file, device, testcase = param
sys.argv = shlex.split(
f'lava_test_plans --dry-run --variables "{variable_input_file}" --device-type "{device}" --test-case "{testcase}"'
)
assert main() == 0
# meta-qcom tests
meta_qcom_project_device_path = "lava_test_plans/projects/meta-qcom/devices"
meta_qcom_devices = [
os.path.basename(d)
for d in glob.glob("lava_test_plans/projects/meta-qcom/devices/*")
]
assert len(meta_qcom_devices) > 0
meta_qcom_testplans = [
"meta-qcom/nodistro/boot",
"meta-qcom/poky-altcfg/boot",
"meta-qcom/qcom-distro/boot",
"meta-qcom/qcom-distro/pre-merge",
]
assert len(meta_qcom_testplans) > 0
meta_qcom_variable_input_file = "projects/meta-qcom/variables.yaml"
tests = []
for device in meta_qcom_devices:
for testplan in meta_qcom_testplans:
tests.append(
(
meta_qcom_variable_input_file,
device,
testplan,
meta_qcom_project_device_path,
)
)
@pytest.mark.parametrize("param", tests)
def test_call_lava_test_plan_testplans_project_meta_qcom(param):
variable_input_file, device, testplan, project_device_path = param
sys.argv = shlex.split(
f'lava_test_plans --dry-run --variables "{variable_input_file}" --testplan-device-path "{project_device_path}" --device-type "{device}" --test-plan "{testplan}" {test_lava_validity}'
)
assert main() == 0
# qcom-deb-images tests
qcom_deb_images_project_device_path = "lava_test_plans/projects/qcom-deb-images/devices"
qcom_deb_images_devices = [
os.path.basename(d)
for d in glob.glob("lava_test_plans/projects/qcom-deb-images/devices/*")
]
assert len(qcom_deb_images_devices) > 0
qcom_deb_images_testplans = [
"qcom-deb-images/boot",
"qcom-deb-images/pre-merge",
]
assert len(qcom_deb_images_testplans) > 0
qcom_deb_images_variable_input_file = "projects/qcom-deb-images/variables.yaml"
tests = []
for device in qcom_deb_images_devices:
for testplan in qcom_deb_images_testplans:
tests.append(
(
qcom_deb_images_variable_input_file,
device,
testplan,
qcom_deb_images_project_device_path,
)
)
@pytest.mark.parametrize("param", tests)
def test_call_lava_test_plan_testplans_project_qcom_deb_images(param):
variable_input_file, device, testplan, project_device_path = param
sys.argv = shlex.split(
f'lava_test_plans --dry-run --variables "{variable_input_file}" --testplan-device-path "{project_device_path}" --device-type "{device}" --test-plan "{testplan}" {test_lava_validity}'
)
assert main() == 0