Skip to content

Commit

Permalink
tests: update
Browse files Browse the repository at this point in the history
and split the override delimiter specific tests into
groups for latest (past kirkstone) and previous (dunfell and co)

Signed-off-by: Konrad Weihmann <[email protected]>
  • Loading branch information
priv-kweihmann committed Feb 17, 2024
1 parent 2e08061 commit 66e4f0a
Show file tree
Hide file tree
Showing 18 changed files with 878 additions and 233 deletions.
113 changes: 106 additions & 7 deletions tests/test_class_oelint_func_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,50 @@

class TestClassOelintFuncSpecific(TestBaseClass):

@pytest.mark.parametrize('id_', ['oelint.func.specific'])
@pytest.mark.parametrize('occurrence', [1])
@pytest.mark.parametrize('input_',
[
{
'oelint-adv_test.bb':
'''
do_install:append:fooarch() {
abc
}
''',
},
{
'oelint-adv_test.bb':
'''
do_configure:bararch() {
abc
}
''',
},
{
'oelint-adv_test.bb':
'''
COMPATIBLE_MACHINE = "xyz"
do_install:fooarch() {
abc
}
''',
},
{
'oelint-adv_test.bb':
'''
COMPATIBLE_MACHINE = "xyz"
do_configure:append:bararch() {
abc
}
''',
},
],
)
def test_bad(self, input_, id_, occurrence):
self.check_for_id(self._create_args(input_), id_, occurrence)

@pytest.mark.parametrize('id_', ['oelint.func.specific'])
@pytest.mark.parametrize('occurrence', [1])
@pytest.mark.parametrize('input_',
Expand Down Expand Up @@ -46,8 +90,8 @@ class TestClassOelintFuncSpecific(TestBaseClass):
],
)
def test_bad(self, input_, id_, occurrence):
self.check_for_id(self._create_args(input_), id_, occurrence)
def test_bad_old(self, input_, id_, occurrence):
self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence)

@pytest.mark.parametrize('id_', ['oelint.func.specific'])
@pytest.mark.parametrize('occurrence', [0])
Expand All @@ -56,7 +100,7 @@ def test_bad(self, input_, id_, occurrence):
{
'oelint-adv_test.bb':
'''
do_install_ptest () {
do_install:ptest () {
cp -r ${B}/testsuite ${D}${PTEST_PATH}/
cp ${B}/.config ${D}${PTEST_PATH}/
ln -s /bin/busybox ${D}${PTEST_PATH}/busybox
Expand All @@ -66,7 +110,7 @@ def test_bad(self, input_, id_, occurrence):
{
'oelint-adv_test.bb':
'''
do_install_qemuall () {
do_install:qemuall () {
cp -r ${B}/testsuite ${D}${PTEST_PATH}/
cp ${B}/.config ${D}${PTEST_PATH}/
ln -s /bin/busybox ${D}${PTEST_PATH}/busybox
Expand All @@ -77,7 +121,7 @@ def test_bad(self, input_, id_, occurrence):
'oelint-adv_test.bb':
'''
COMPATIBLE_MACHINE = "foo"
do_install_append_fooarch() {
do_install:append:fooarch() {
abc
}
''',
Expand All @@ -86,15 +130,15 @@ def test_bad(self, input_, id_, occurrence):
'oelint-adv_test.bb':
'''
COMPATIBLE_MACHINE += "|bar"
do_configure_append_bararch() {
do_configure:append:bararch() {
abc
}
''',
},
{
'oelint-adv_test.bb':
'''
pkg_preinst_${PN} () {
pkg_preinst:${PN} () {
abc
}
''',
Expand All @@ -111,3 +155,58 @@ def test_bad(self, input_, id_, occurrence):
)
def test_good(self, input_, id_, occurrence):
self.check_for_id(self._create_args(input_), id_, occurrence)

@pytest.mark.parametrize('id_', ['oelint.func.specific'])
@pytest.mark.parametrize('occurrence', [0])
@pytest.mark.parametrize('input_',
[
{
'oelint-adv_test.bb':
'''
do_install_ptest () {
cp -r ${B}/testsuite ${D}${PTEST_PATH}/
cp ${B}/.config ${D}${PTEST_PATH}/
ln -s /bin/busybox ${D}${PTEST_PATH}/busybox
}
''',
},
{
'oelint-adv_test.bb':
'''
do_install_qemuall () {
cp -r ${B}/testsuite ${D}${PTEST_PATH}/
cp ${B}/.config ${D}${PTEST_PATH}/
ln -s /bin/busybox ${D}${PTEST_PATH}/busybox
}
''',
},
{
'oelint-adv_test.bb':
'''
COMPATIBLE_MACHINE = "foo"
do_install_append_fooarch() {
abc
}
''',
},
{
'oelint-adv_test.bb':
'''
COMPATIBLE_MACHINE += "|bar"
do_configure_append_bararch() {
abc
}
''',
},
{
'oelint-adv_test.bb':
'''
pkg_preinst_${PN} () {
abc
}
''',
},
],
)
def test_good_old(self, input_, id_, occurrence):
self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence)
86 changes: 75 additions & 11 deletions tests/test_class_oelint_jetm_vars_dependssingleline.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,41 @@ class TestClassOelintJetmDependsSingleLine(TestBaseClass):
},
{
'oelint_adv_test.bb':
'RDEPENDS_${PN} += "abc def"',
'RDEPENDS:${PN} += "abc def"',
},
{
'oelint_adv_test.bb':
'''
RDEPENDS_${PN} += "ghi \\
RDEPENDS:${PN} += "ghi \\
jkl"
''',
},
],
)
def test_bad(self, input_, id_, occurrence):
self.check_for_id(self._create_args(input_, extraopts=[
'--addrules=jetm']), id_, occurrence)

@pytest.mark.parametrize('id_', ['oelint.jetm.vars.dependssingleline'])
@pytest.mark.parametrize('occurrence', [1])
@pytest.mark.parametrize('input_',
[
{
'oelint_adv_test.bb':
'RDEPENDS_${PN} += "abc def"',
},
{
'oelint_adv_test.bb':
'''
RDEPENDS:${PN} += "ghi \\
RDEPENDS_${PN} += "ghi \\
jkl"
''',
},
],
)
def test_bad(self, input_, id_, occurrence):
def test_bad_old(self, input_, id_, occurrence):
self.check_for_id(self._create_args(input_, extraopts=[
'--addrules=jetm']), id_, occurrence)
'--addrules=jetm', '--release=dunfell']), id_, occurrence)

@pytest.mark.parametrize('id_', ['oelint.jetm.vars.dependssingleline'])
@pytest.mark.parametrize('occurrence', [0])
Expand All @@ -59,10 +73,10 @@ def test_bad(self, input_, id_, occurrence):
{
'oelint_adv_test.bb':
'''
RDEPENDS_${PN} += "abc"
RDEPENDS_${PN} += "def"
RDEPENDS_${PN} += "ghi"
RDEPENDS_${PN} += "jkl"
RDEPENDS:${PN} += "abc"
RDEPENDS:${PN} += "def"
RDEPENDS:${PN} += "ghi"
RDEPENDS:${PN} += "jkl"
''',
},
{
Expand All @@ -78,6 +92,25 @@ def test_good(self, input_, id_, occurrence):
self.check_for_id(self._create_args(input_, extraopts=[
'--addrules=jetm']), id_, occurrence)

@pytest.mark.parametrize('id_', ['oelint.jetm.vars.dependssingleline'])
@pytest.mark.parametrize('occurrence', [0])
@pytest.mark.parametrize('input_',
[
{
'oelint_adv_test.bb':
'''
RDEPENDS_${PN} += "abc"
RDEPENDS_${PN} += "def"
RDEPENDS_${PN} += "ghi"
RDEPENDS_${PN} += "jkl"
''',
},
],
)
def test_good_old(self, input_, id_, occurrence):
self.check_for_id(self._create_args(input_, extraopts=[
'--addrules=jetm', '--release=dunfell']), id_, occurrence)

@pytest.mark.parametrize('id_', ['oelint.jetm.vars.dependssingleline'])
@pytest.mark.parametrize('occurrence', [0])
@pytest.mark.parametrize('input_',
Expand All @@ -95,16 +128,47 @@ def test_good(self, input_, id_, occurrence):
},
{
'oelint_adv_test.bb':
'RDEPENDS_${PN} += "abc def"',
'RDEPENDS:${PN} += "abc def"',
},
{
'oelint_adv_test.bb':
'''
RDEPENDS_${PN} += "ghi \\
RDEPENDS:${PN} += "ghi \\
jkl"
''',
},
],
)
def test_good_module_off(self, input_, id_, occurrence):
self.check_for_id(self._create_args(input_), id_, occurrence)

@pytest.mark.parametrize('id_', ['oelint.jetm.vars.dependssingleline'])
@pytest.mark.parametrize('occurrence', [0])
@pytest.mark.parametrize('input_',
[
{
'oelint_adv_test.bb':
'DEPENDS += "abc def"',
},
{
'oelint_adv_test.bb':
'''
DEPENDS += "ghi \\
jkl"
''',
},
{
'oelint_adv_test.bb':
'RDEPENDS_${PN} += "abc def"',
},
{
'oelint_adv_test.bb':
'''
RDEPENDS_${PN} += "ghi \\
jkl"
''',
},
],
)
def test_good_module_off_old(self, input_, id_, occurrence):
self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence)
8 changes: 8 additions & 0 deletions tests/test_class_oelint_task_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ def test_bad(self, input_, id_, occurrence):
do_foo[doc] = "Fooo!!!!"
''',
},
{
'oelint_adv_test.bb':
'''
do_foo:append() {
:
}
''',
},
{
'oelint_adv_test.bb':
'''
Expand Down
Loading

0 comments on commit 66e4f0a

Please sign in to comment.