File: test_shlib_policy.py

package info (click to toggle)
rpmlint 2.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,308 kB
  • sloc: python: 20,622; ansic: 2,511; xml: 1,272; makefile: 17; sh: 4
file content (42 lines) | stat: -rw-r--r-- 1,304 bytes parent folder | download | duplicates (2)
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
from mockdata.mock_shlib_policy import (
    Libslp1234Package,
    LibslpMissingSuffixPackage,
    Libtest1Package,
)
import pytest
from rpmlint.checks.SharedLibraryPolicyCheck import SharedLibraryPolicyCheck
from rpmlint.filter import Filter

from Testing import CONFIG


@pytest.fixture(scope='function', autouse=True)
def slpcheck():
    CONFIG.info = True
    output = Filter(CONFIG)
    test = SharedLibraryPolicyCheck(CONFIG, output)
    return output, test


@pytest.mark.parametrize('package', [Libtest1Package])
def test_shlib_policy_wrong_name(package, slpcheck):
    output, test = slpcheck
    test.check(package)
    out = output.print_results(output.results)
    assert 'W: shlib-unversioned-lib libtest.so.1x' in out


@pytest.mark.parametrize('package', [LibslpMissingSuffixPackage])
def test_shlib_policy_missing_suffix(package, slpcheck):
    output, test = slpcheck
    test.check(package)
    out = output.print_results(output.results)
    assert 'E: shlib-policy-excessive-dependency libsparta.so.2' in out


@pytest.mark.parametrize('package', [Libslp1234Package])
def test_shlib_policy_errors(package, slpcheck):
    output, test = slpcheck
    test.check(package)
    out = output.print_results(output.results)
    assert 'W: shlib-fixed-dependency libsparta.so.2 = 1.23' in out