Skip to content

Commit

Permalink
tests: Unify missing backports tests exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Efremov <efremov@linux.com>
  • Loading branch information
evdenis committed Feb 9, 2024
1 parent 111e857 commit f5c3e22
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 30 deletions.
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[pytest]
pythonpath = tests
minversion = 6.0
norecursedirs = linux
addopts = -rA --show-capture=stderr
Expand Down
16 changes: 16 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@
from git import Repo
from subprocess import run

missing_backports = [
('CVE-2019-12455', 'stable/linux-4.19.y'), # Disputed
('CVE-2021-4037', 'stable/linux-4.19.y'),
('CVE-2022-0998', 'stable/linux-5.15.y'),
('CVE-2022-1789', 'stable/linux-4.19.y'),
('CVE-2022-1789', 'stable/linux-5.4.y'),
('CVE-2022-3061', 'stable/linux-4.19.y'),
('CVE-2022-3061', 'stable/linux-5.4.y'),
('CVE-2023-4133', 'stable/linux-4.19.y'),
('CVE-2023-4133', 'stable/linux-5.4.y'),
('CVE-2023-4133', 'stable/linux-5.10.y'),
('CVE-2023-4133', 'stable/linux-5.15.y'),
('CVE-2023-4133', 'stable/linux-6.1.y'),
('CVE-2023-23005', 'stable/linux-6.1.y'),
]

def mount_tmpfs(target, req_mem_gb):
if os.path.ismount(target):
return True
Expand Down
17 changes: 2 additions & 15 deletions tests/test_01_on_branch.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
#!/usr/bin/env python3

import pytest
from conftest import missing_backports
from cvehound.exception import UnsupportedVersion

@pytest.mark.fast
@pytest.mark.notbackported(
('cve', 'branch'),
[
('CVE-2019-12455', 'stable/linux-4.19.y'), # Disputed
('CVE-2021-4037', 'stable/linux-4.19.y'),
('CVE-2022-0998', 'stable/linux-5.15.y'),
('CVE-2022-1789', 'stable/linux-4.19.y'),
('CVE-2022-1789', 'stable/linux-5.4.y'),
('CVE-2022-3061', 'stable/linux-4.19.y'),
('CVE-2022-3061', 'stable/linux-5.4.y'),
('CVE-2023-4133', 'stable/linux-4.19.y'),
('CVE-2023-4133', 'stable/linux-5.4.y'),
('CVE-2023-4133', 'stable/linux-5.10.y'),
('CVE-2023-4133', 'stable/linux-5.15.y'),
('CVE-2023-4133', 'stable/linux-6.1.y'),
('CVE-2023-23005', 'stable/linux-6.1.y'),
]
missing_backports
)
def test_on_branch(hound, branch, cve):
try:
Expand Down
17 changes: 2 additions & 15 deletions tests/test_06_on_branch_all_files.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
#!/usr/bin/env python3

import pytest
from conftest import missing_backports
from cvehound.exception import UnsupportedVersion

@pytest.mark.slow
@pytest.mark.notbackported(
('cve', 'branch'),
[
('CVE-2019-12455', 'stable/linux-4.19.y'), # Disputed
('CVE-2021-4037', 'stable/linux-4.19.y'),
('CVE-2022-0998', 'stable/linux-5.15.y'),
('CVE-2022-1789', 'stable/linux-4.19.y'),
('CVE-2022-1789', 'stable/linux-5.4.y'),
('CVE-2022-3061', 'stable/linux-4.19.y'),
('CVE-2022-3061', 'stable/linux-5.4.y'),
('CVE-2023-4133', 'stable/linux-4.19.y'),
('CVE-2023-4133', 'stable/linux-5.4.y'),
('CVE-2023-4133', 'stable/linux-5.10.y'),
('CVE-2023-4133', 'stable/linux-5.15.y'),
('CVE-2023-4133', 'stable/linux-6.1.y'),
('CVE-2023-23005', 'stable/linux-6.1.y'),
]
missing_backports
)
def test_on_branch(hound, branch, cve):
try:
Expand Down

0 comments on commit f5c3e22

Please sign in to comment.