Skip to content

Commit

Permalink
Merge pull request #1249 from i12momal/rama6
Browse files Browse the repository at this point in the history
Replace bin in medium tests
  • Loading branch information
danigm authored Aug 7, 2024
2 parents 7a336ff + 8e93ceb commit f6ad983
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 11 deletions.
Binary file added test/files/m-no-CInf.beam
Binary file not shown.
Binary file added test/files/m.beam
Binary file not shown.
21 changes: 21 additions & 0 deletions test/mockdata/mock_erlang.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from Testing import get_tested_mock_package

ERLANG = get_tested_mock_package(
files={
'/usr/lib/erlang/m-no-CInf.beam': {
'content-path': 'files/m-no-CInf.beam',
'create_dirs': True,
},
'/usr/lib/erlang/m.beam': {
'content-path': 'files/m.beam',
'create_dirs': True,
},
},
header={
'requires': [
'rpmlib(CompressedFileNames) <= 3.0.4-1',
'rpmlib(FileDigests) <= 4.6.0-1',
'rpmlib(PayloadFilesHavePrefix) <= 4.0-1',
'rpmlib(PayloadIsZstd) <= 5.4.18-1'],
},
)
113 changes: 113 additions & 0 deletions test/mockdata/mock_lib_dependency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
from Testing import get_tested_mock_package

LIBDEPENDENCY = get_tested_mock_package(
name='shlib2-devel',
files={
'/usr/lib/libfoo.so': {'linkto': 'libfoo.so.1'},
},
header={
'requires': [
'rpmlib(CompressedFileNames) <= 3.0.4-1',
'rpmlib(FileDigests) <= 4.6.0-1',
'rpmlib(PayloadFilesHavePrefix) <= 4.0-1',
'rpmlib(PayloadIsXz) <= 5.2-1',
],
},
)

LIBDEPENDENCY2 = get_tested_mock_package(
files={
'/usr/bin/xrootd-config',
'/usr/include/xrootd',
'/usr/include/xrootd/XProtocol',
'/usr/include/xrootd/XProtocol/XProtocol.hh',
'/usr/include/xrootd/XProtocol/XPtypes.hh',
'/usr/include/xrootd/Xrd',
'/usr/include/xrootd/Xrd/XrdBuffer.hh',
'/usr/include/xrootd/Xrd/XrdJob.hh',
'/usr/include/xrootd/Xrd/XrdLink.hh',
'/usr/include/xrootd/Xrd/XrdLinkMatch.hh',
'/usr/include/xrootd/Xrd/XrdProtocol.hh',
'/usr/include/xrootd/Xrd/XrdScheduler.hh',
'/usr/include/xrootd/Xrd/XrdTcpMonPin.hh',
'/usr/include/xrootd/XrdCks',
'/usr/include/xrootd/XrdCks/XrdCks.hh',
'/usr/include/xrootd/XrdCks/XrdCksAssist.hh',
'/usr/include/xrootd/XrdCks/XrdCksCalc.hh',
'/usr/include/xrootd/XrdCks/XrdCksData.hh',
'/usr/include/xrootd/XrdCks/XrdCksManager.hh',
'/usr/include/xrootd/XrdCks/XrdCksWrapper.hh',
'/usr/include/xrootd/XrdNet',
'/usr/include/xrootd/XrdNet/XrdNet.hh',
'/usr/include/xrootd/XrdNet/XrdNetAddr.hh',
'/usr/include/xrootd/XrdNet/XrdNetAddrInfo.hh',
'/usr/include/xrootd/XrdNet/XrdNetCmsNotify.hh',
'/usr/include/xrootd/XrdNet/XrdNetConnect.hh',
'/usr/include/xrootd/XrdNet/XrdNetOpts.hh',
'/usr/include/xrootd/XrdNet/XrdNetSockAddr.hh',
'/usr/include/xrootd/XrdNet/XrdNetSocket.hh',
'/usr/include/xrootd/XrdNet/XrdNetUtils.hh',
'/usr/include/xrootd/XrdOuc',
'/usr/include/xrootd/XrdOuc/XrdOucBuffer.hh',
'/usr/include/xrootd/XrdOuc/XrdOucCRC.hh',
'/usr/include/xrootd/XrdOuc/XrdOucCacheCM.hh',
'/usr/include/xrootd/XrdOuc/XrdOucCacheStats.hh',
'/usr/include/xrootd/XrdOuc/XrdOucCallBack.hh',
'/usr/include/xrootd/XrdOuc/XrdOucChain.hh',
'/usr/include/xrootd/XrdOuc/XrdOucCompiler.hh',
'/usr/include/xrootd/XrdOuc/XrdOucDLlist.hh',
'/usr/include/xrootd/XrdOuc/XrdOucEnum.hh',
'/usr/include/xrootd/XrdOuc/XrdOucEnv.hh',
'/usr/include/xrootd/XrdOuc/XrdOucErrInfo.hh',
'/usr/include/xrootd/XrdOuc/XrdOucGMap.hh',
'/usr/include/xrootd/XrdOuc/XrdOucHash.hh',
'/usr/include/xrootd/XrdOuc/XrdOucHash.icc',
'/usr/include/xrootd/XrdOuc/XrdOucIOVec.hh',
'/usr/include/xrootd/XrdOuc/XrdOucLock.hh',
'/usr/include/xrootd/XrdOuc/XrdOucName2Name.hh',
'/usr/include/xrootd/XrdOuc/XrdOucPinObject.hh',
'/usr/include/xrootd/XrdOuc/XrdOucPinPath.hh',
'/usr/include/xrootd/XrdOuc/XrdOucRash.hh',
'/usr/include/xrootd/XrdOuc/XrdOucRash.icc',
'/usr/include/xrootd/XrdOuc/XrdOucSFVec.hh',
'/usr/include/xrootd/XrdOuc/XrdOucStream.hh',
'/usr/include/xrootd/XrdOuc/XrdOucString.hh',
'/usr/include/xrootd/XrdOuc/XrdOucTList.hh',
'/usr/include/xrootd/XrdOuc/XrdOucTable.hh',
'/usr/include/xrootd/XrdOuc/XrdOucTokenizer.hh',
'/usr/include/xrootd/XrdOuc/XrdOucTrace.hh',
'/usr/include/xrootd/XrdOuc/XrdOucUtils.hh',
'/usr/include/xrootd/XrdOuc/XrdOuca2x.hh',
'/usr/include/xrootd/XrdSec',
'/usr/include/xrootd/XrdSec/XrdSecAttr.hh',
'/usr/include/xrootd/XrdSec/XrdSecEntity.hh',
'/usr/include/xrootd/XrdSec/XrdSecEntityAttr.hh',
'/usr/include/xrootd/XrdSec/XrdSecEntityPin.hh',
'/usr/include/xrootd/XrdSec/XrdSecInterface.hh',
'/usr/include/xrootd/XrdSys',
'/usr/include/xrootd/XrdSys/XrdSysAtomics.hh',
'/usr/include/xrootd/XrdSys/XrdSysError.hh',
'/usr/include/xrootd/XrdSys/XrdSysFD.hh',
'/usr/include/xrootd/XrdSys/XrdSysHeaders.hh',
'/usr/include/xrootd/XrdSys/XrdSysLogPI.hh',
'/usr/include/xrootd/XrdSys/XrdSysLogger.hh',
'/usr/include/xrootd/XrdSys/XrdSysPageSize.hh',
'/usr/include/xrootd/XrdSys/XrdSysPlatform.hh',
'/usr/include/xrootd/XrdSys/XrdSysPlugin.hh',
'/usr/include/xrootd/XrdSys/XrdSysPthread.hh',
'/usr/include/xrootd/XrdSys/XrdSysSemWait.hh',
'/usr/include/xrootd/XrdSys/XrdSysTimer.hh',
'/usr/include/xrootd/XrdSys/XrdSysXAttr.hh',
'/usr/include/xrootd/XrdSys/XrdSysXSLock.hh',
'/usr/include/xrootd/XrdVersion.hh',
'/usr/include/xrootd/XrdXml',
'/usr/include/xrootd/XrdXml/XrdXmlReader.hh',
'/usr/lib64/libXrdAppUtils.so',
'/usr/lib64/libXrdCrypto.so',
'/usr/lib64/libXrdCryptoLite.so',
'/usr/lib64/libXrdUtils.so',
'/usr/lib64/libXrdXml.so',
'/usr/share/xrootd',
'/usr/share/xrootd/cmake',
'/usr/share/xrootd/cmake/XRootDConfig.cmake',
})
9 changes: 5 additions & 4 deletions test/test_erlang.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from importlib.metadata import distribution

from mockdata.mock_erlang import ERLANG
from packaging.version import parse
import pytest
from rpmlint.checks.ErlangCheck import ErlangCheck
from rpmlint.filter import Filter

from Testing import CONFIG, get_tested_package
from Testing import CONFIG


@pytest.fixture(scope='function', autouse=True)
Expand All @@ -17,10 +18,10 @@ def erlangcheck():


@pytest.mark.skipif(parse(distribution('pybeam').version) < parse('0.7'), reason='pybeam >= 0.7 required')
@pytest.mark.parametrize('package', ['binary/erlang-test'])
def test_erlang(tmp_path, package, erlangcheck):
@pytest.mark.parametrize('package', [ERLANG])
def test_erlang(package, erlangcheck):
output, test = erlangcheck
test.check(get_tested_package(package, tmp_path))
test.check(package)
out = output.print_results(output.results)
assert 'E: beam-compiled-without-debuginfo /usr/lib/erlang/m.beam' in out
assert 'W: beam-compile-info-missed /usr/lib/erlang/m-no-CInf.beam' in out
17 changes: 10 additions & 7 deletions test/test_lib_dependency.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from mockdata.mock_lib_dependency import LIBDEPENDENCY, LIBDEPENDENCY2
import pytest
from rpmlint.checks.LibraryDependencyCheck import LibraryDependencyCheck
from rpmlint.filter import Filter

from Testing import CONFIG, get_tested_package
from Testing import CONFIG


@pytest.fixture(scope='function', autouse=True)
Expand All @@ -13,19 +14,21 @@ def libdependencycheck():
return output, test


@pytest.mark.parametrize('package', ['binary/shlib2-devel'])
def test_shlib2_devel(tmp_path, package, libdependencycheck):
@pytest.mark.parametrize('package', [LIBDEPENDENCY])
def test_shlib2_devel(package, libdependencycheck):
output, test = libdependencycheck
test.check(get_tested_package(package, tmp_path))
test.check(package)
test.after_checks()
out = output.print_results(output.results)
print(out)
assert 'E: no-library-dependency-for /usr/lib/libfoo.so.1' in out


@pytest.mark.parametrize('package', ['binary/xrootd-devel'])
def test_missing_depency_on(tmp_path, package, libdependencycheck):
# TODO: Check out this test. It seems to do nothing
@pytest.mark.parametrize('package', [LIBDEPENDENCY2])
def test_missing_depency_on(package, libdependencycheck):
output, test = libdependencycheck
test.check(get_tested_package(package, tmp_path))
test.check(package)
test.after_checks()
out = output.print_results(output.results)
assert 'W: missing-dependency-on' not in out

0 comments on commit f6ad983

Please sign in to comment.