From 66e4f0a01fe119942f5d551c6680753b330789c2 Mon Sep 17 00:00:00 2001 From: Konrad Weihmann Date: Sat, 17 Feb 2024 16:08:23 +0100 Subject: [PATCH] tests: update and split the override delimiter specific tests into groups for latest (past kirkstone) and previous (dunfell and co) Signed-off-by: Konrad Weihmann --- tests/test_class_oelint_func_specific.py | 113 +++++++++++- ...lass_oelint_jetm_vars_dependssingleline.py | 86 +++++++-- tests/test_class_oelint_task_docstrings.py | 8 + tests/test_class_oelint_var_filesoverride.py | 86 +++++---- tests/test_class_oelint_vars_doublemodify.py | 76 +++++++- tests/test_class_oelint_vars_duplicate.py | 74 +++++--- .../test_class_oelint_vars_fileextrapaths.py | 40 +++-- ...test_class_oelint_vars_fileextrapathsop.py | 44 +++-- ...t_class_oelint_vars_filessetting_double.py | 76 +++++--- ...t_class_oelint_vars_filessetting_hidden.py | 76 +++++--- tests/test_class_oelint_vars_inconspaces.py | 32 +++- tests/test_class_oelint_vars_insaneskip.py | 27 ++- tests/test_class_oelint_vars_listappend.py | 168 ++++++++++++++---- tests/test_class_oelint_vars_misspell.py | 24 ++- .../test_class_oelint_vars_notneededspace.py | 13 +- tests/test_class_oelint_vars_specific.py | 129 ++++++++++++-- tests/test_inlinesuppressions.py | 17 +- tests/test_user_interface.py | 22 ++- 18 files changed, 878 insertions(+), 233 deletions(-) diff --git a/tests/test_class_oelint_func_specific.py b/tests/test_class_oelint_func_specific.py index 3d8b22b0..69a66deb 100644 --- a/tests/test_class_oelint_func_specific.py +++ b/tests/test_class_oelint_func_specific.py @@ -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_', @@ -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]) @@ -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 @@ -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 @@ -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 } ''', @@ -86,7 +130,7 @@ def test_bad(self, input_, id_, occurrence): 'oelint-adv_test.bb': ''' COMPATIBLE_MACHINE += "|bar" - do_configure_append_bararch() { + do_configure:append:bararch() { abc } ''', @@ -94,7 +138,7 @@ def test_bad(self, input_, id_, occurrence): { 'oelint-adv_test.bb': ''' - pkg_preinst_${PN} () { + pkg_preinst:${PN} () { abc } ''', @@ -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) diff --git a/tests/test_class_oelint_jetm_vars_dependssingleline.py b/tests/test_class_oelint_jetm_vars_dependssingleline.py index 84ad33b8..5794e410 100644 --- a/tests/test_class_oelint_jetm_vars_dependssingleline.py +++ b/tests/test_class_oelint_jetm_vars_dependssingleline.py @@ -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]) @@ -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" ''', }, { @@ -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_', @@ -95,12 +128,12 @@ 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" ''', }, @@ -108,3 +141,34 @@ def test_good(self, input_, id_, occurrence): ) 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) diff --git a/tests/test_class_oelint_task_docstrings.py b/tests/test_class_oelint_task_docstrings.py index fd94097f..84c69af1 100644 --- a/tests/test_class_oelint_task_docstrings.py +++ b/tests/test_class_oelint_task_docstrings.py @@ -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': ''' diff --git a/tests/test_class_oelint_var_filesoverride.py b/tests/test_class_oelint_var_filesoverride.py index 96091b65..4ebf6d2f 100644 --- a/tests/test_class_oelint_var_filesoverride.py +++ b/tests/test_class_oelint_var_filesoverride.py @@ -11,40 +11,49 @@ class TestClassOelintVarFilesOverride(TestBaseClass): [ { 'oelint_adv_test.bb': - 'FILES_${PN} = " foo"', + 'FILES:${PN} = " foo"', }, { 'oelint_adv_test.bb': - 'FILES_${PN} := "foo"', + 'FILES:${PN} := "foo"', }, { 'oelint_adv_test.bb': - 'FILES_${PN}-dev = "foo"', + 'FILES:${PN}-dev = "foo"', }, { 'oelint_adv_test.bb': - 'FILES_${PN}-dev := "foo"', + 'FILES:${PN}-dev := "foo"', }, + ], + ) + def test_bad(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_), id_, occurrence) + + @pytest.mark.parametrize('id_', ['oelint.var.filesoverride']) + @pytest.mark.parametrize('occurrence', [1]) + @pytest.mark.parametrize('input_', + [ { 'oelint_adv_test.bb': - 'FILES:${PN} = " foo"', + 'FILES_${PN} = " foo"', }, { 'oelint_adv_test.bb': - 'FILES:${PN} := "foo"', + 'FILES_${PN} := "foo"', }, { 'oelint_adv_test.bb': - 'FILES:${PN}-dev = "foo"', + 'FILES_${PN}-dev = "foo"', }, { 'oelint_adv_test.bb': - 'FILES:${PN}-dev := "foo"', + 'FILES_${PN}-dev := "foo"', }, ], ) - 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.var.filesoverride']) @pytest.mark.parametrize('occurrence', [0]) @@ -52,93 +61,102 @@ def test_bad(self, input_, id_, occurrence): [ { 'oelint_adv_test.bbappend': - 'FILES_SOLIBSDEV = "abc"', + 'FILES:SOLIBSDEV = "abc"', }, { 'oelint_adv_test.bbappend': - 'FILES_${PN}_append = " foo"', + 'FILES:${PN}:append = " foo"', }, { 'oelint_adv_test.bbappend': - 'FILES_${PN}_prepend = "foo "', + 'FILES:${PN}:prepend = "foo "', }, { 'oelint_adv_test.bbappend': - 'FILES_${PN} += "foo"', + 'FILES:${PN} += "foo"', }, { 'oelint_adv_test.bbappend': - 'FILES_${PN} =+ "foo"', + 'FILES:${PN} =+ "foo"', }, { 'oelint_adv_test.bbappend': - 'FILES_${PN} .= " foo"', + 'FILES:${PN} .= " foo"', }, { 'oelint_adv_test.bbappend': - 'FILES_${PN} =. "foo "', + 'FILES:${PN} =. "foo "', }, { 'oelint_adv_test.bbappend': - 'FILES_${PN}-dev += "foo"', + 'FILES:${PN}-dev += "foo"', }, { 'oelint_adv_test.bbappend': - 'FILES_${PN}-dev =+ "foo"', + 'FILES:${PN}-dev =+ "foo"', }, { 'oelint_adv_test.bbappend': - 'FILES_${PN}-dev .= " foo"', + 'FILES:${PN}-dev .= " foo"', }, { 'oelint_adv_test.bbappend': - 'FILES_${PN}-dev =. "foo "', + 'FILES:${PN}-dev =. "foo "', }, + ], + ) + def test_good(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_), id_, occurrence) + + @pytest.mark.parametrize('id_', ['oelint.var.filesoverride']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ { 'oelint_adv_test.bbappend': - 'FILES:SOLIBSDEV = "abc"', + 'FILES_SOLIBSDEV = "abc"', }, { 'oelint_adv_test.bbappend': - 'FILES:${PN}:append = " foo"', + 'FILES_${PN}_append = " foo"', }, { 'oelint_adv_test.bbappend': - 'FILES:${PN}:prepend = "foo "', + 'FILES_${PN}_prepend = "foo "', }, { 'oelint_adv_test.bbappend': - 'FILES:${PN} += "foo"', + 'FILES_${PN} += "foo"', }, { 'oelint_adv_test.bbappend': - 'FILES:${PN} =+ "foo"', + 'FILES_${PN} =+ "foo"', }, { 'oelint_adv_test.bbappend': - 'FILES:${PN} .= " foo"', + 'FILES_${PN} .= " foo"', }, { 'oelint_adv_test.bbappend': - 'FILES:${PN} =. "foo "', + 'FILES_${PN} =. "foo "', }, { 'oelint_adv_test.bbappend': - 'FILES:${PN}-dev += "foo"', + 'FILES_${PN}-dev += "foo"', }, { 'oelint_adv_test.bbappend': - 'FILES:${PN}-dev =+ "foo"', + 'FILES_${PN}-dev =+ "foo"', }, { 'oelint_adv_test.bbappend': - 'FILES:${PN}-dev .= " foo"', + 'FILES_${PN}-dev .= " foo"', }, { 'oelint_adv_test.bbappend': - 'FILES:${PN}-dev =. "foo "', + 'FILES_${PN}-dev =. "foo "', }, ], ) - def test_good(self, input_, id_, occurrence): - self.check_for_id(self._create_args(input_), id_, occurrence) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) diff --git a/tests/test_class_oelint_vars_doublemodify.py b/tests/test_class_oelint_vars_doublemodify.py index 0badedf4..b54f9faf 100644 --- a/tests/test_class_oelint_vars_doublemodify.py +++ b/tests/test_class_oelint_vars_doublemodify.py @@ -5,6 +5,51 @@ class TestClassOelintVarsDoubleModify(TestBaseClass): + @pytest.mark.parametrize('id_', ['oelint.vars.doublemodify']) + @pytest.mark.parametrize('occurrence', [1]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + 'A:append:prepend:remove += "1"', + }, + { + 'oelint_adv_test.bb': + 'A:append:prepend += "1"', + }, + { + 'oelint_adv_test.bb': + 'A:append += "1"', + }, + { + 'oelint_adv_test.bb': + 'A:prepend:remove += "1"', + }, + { + 'oelint_adv_test.bb': + 'A:append:remove += "1"', + }, + { + 'oelint_adv_test.bb': + 'A:remove += "1"', + }, + { + 'oelint_adv_test.bb': + 'A:append:prepend:remove = " 1 "', + }, + { + 'oelint_adv_test.bb': + 'A:append:remove = " 1 "', + }, + { + 'oelint_adv_test.bb': + 'A:prepend:remove = " 1 "', + }, + ], + ) + def test_bad(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_), id_, occurrence) + @pytest.mark.parametrize('id_', ['oelint.vars.doublemodify']) @pytest.mark.parametrize('occurrence', [1]) @pytest.mark.parametrize('input_', @@ -47,8 +92,8 @@ class TestClassOelintVarsDoubleModify(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.vars.doublemodify']) @pytest.mark.parametrize('occurrence', [0]) @@ -56,15 +101,15 @@ def test_bad(self, input_, id_, occurrence): [ { 'oelint_adv_test.bb': - 'A_append = " a"', + 'A:append = " a"', }, { 'oelint_adv_test.bb': - 'A_prepend = "a "', + 'A:prepend = "a "', }, { 'oelint_adv_test.bb': - 'A_remove = "a"', + 'A:remove = "a"', }, { 'oelint_adv_test.bb': @@ -78,3 +123,24 @@ 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.vars.doublemodify']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + 'A_append = " a"', + }, + { + 'oelint_adv_test.bb': + 'A_prepend = "a "', + }, + { + 'oelint_adv_test.bb': + 'A_remove = "a"', + }, + ], + ) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) diff --git a/tests/test_class_oelint_vars_duplicate.py b/tests/test_class_oelint_vars_duplicate.py index 005c27c0..34daa8f0 100644 --- a/tests/test_class_oelint_vars_duplicate.py +++ b/tests/test_class_oelint_vars_duplicate.py @@ -16,27 +16,6 @@ class TestClassOelintVarsDuplicate(TestBaseClass): DEPENDS += "foo" ''', }, - { - 'oelint_adv_test.bb': - ''' - DEPENDS = "foo" - DEPENDS_append = " foo" - ''', - }, - { - 'oelint_adv_test.bb': - ''' - DEPENDS = "foo" - DEPENDS_prepend = " foo" - ''', - }, - { - 'oelint_adv_test.bb': - ''' - RDEPENDS_${PN} = "foo" - RDEPENDS_${PN}_prepend = " foo" - ''', - }, { 'oelint_adv_test.bb': ''' @@ -75,35 +54,51 @@ def test_bad(self, input_, id_, occurrence): self.check_for_id(self._create_args(input_), id_, occurrence) @pytest.mark.parametrize('id_', ['oelint.vars.duplicate']) - @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('occurrence', [1]) @pytest.mark.parametrize('input_', [ { 'oelint_adv_test.bb': ''' - DEPENDS += "foo" DEPENDS = "foo" + DEPENDS_append = " foo" ''', }, { 'oelint_adv_test.bb': ''' - DEPENDS += "foo" - DEPENDS_class-native += "foo" + DEPENDS = "foo" + DEPENDS_prepend = " foo" ''', }, { 'oelint_adv_test.bb': ''' - DEPENDS += "${@inline.block}" - DEPENDS += "${@inline.block}" + RDEPENDS_${PN} = "foo" + RDEPENDS_${PN}_prepend = " foo" ''', }, + ], + ) + 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.vars.duplicate']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ { 'oelint_adv_test.bb': ''' DEPENDS += "foo" - DEPENDS_remove = "foo" + DEPENDS = "foo" + ''', + }, + { + 'oelint_adv_test.bb': + ''' + DEPENDS += "${@inline.block}" + DEPENDS += "${@inline.block}" ''', }, { @@ -135,3 +130,26 @@ 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.vars.duplicate']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + ''' + DEPENDS += "foo" + DEPENDS_class-native += "foo" + ''', + }, + { + 'oelint_adv_test.bb': + ''' + DEPENDS += "foo" + DEPENDS_remove = "foo" + ''', + }, + ], + ) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) diff --git a/tests/test_class_oelint_vars_fileextrapaths.py b/tests/test_class_oelint_vars_fileextrapaths.py index 8bdbf339..8dfa7685 100644 --- a/tests/test_class_oelint_vars_fileextrapaths.py +++ b/tests/test_class_oelint_vars_fileextrapaths.py @@ -9,14 +9,6 @@ class TestClassOelintVarsFilextrapaths(TestBaseClass): @pytest.mark.parametrize('occurrence', [1]) @pytest.mark.parametrize('input_', [ - { - 'oelint_adv_test.bb': - 'FILESEXTRAPATHS_prepend := "${THISDIR}/file"', - }, - { - 'oelint_adv_test.bb': - 'FILESEXTRAPATHS_append := "${THISDIR}/file"', - }, { 'oelint_adv_test.bb': 'FILESEXTRAPATHS:prepend := "${THISDIR}/file"', @@ -35,17 +27,26 @@ def test_bad(self, input_, id_, occurrence): self.check_for_id(self._create_args(input_), id_, occurrence) @pytest.mark.parametrize('id_', ['oelint.vars.fileextrapaths']) - @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('occurrence', [1]) @pytest.mark.parametrize('input_', [ { - 'oelint_adv_test.bbappend': + 'oelint_adv_test.bb': 'FILESEXTRAPATHS_prepend := "${THISDIR}/file"', }, { - 'oelint_adv_test.bbappend': + 'oelint_adv_test.bb': 'FILESEXTRAPATHS_append := "${THISDIR}/file"', }, + ], + ) + 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.vars.fileextrapaths']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ { 'oelint_adv_test.bbappend': 'FILESEXTRAPATHS:prepend := "${THISDIR}/file"', @@ -58,3 +59,20 @@ 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.vars.fileextrapaths']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bbappend': + 'FILESEXTRAPATHS_prepend := "${THISDIR}/file"', + }, + { + 'oelint_adv_test.bbappend': + 'FILESEXTRAPATHS_append := "${THISDIR}/file"', + }, + ], + ) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) diff --git a/tests/test_class_oelint_vars_fileextrapathsop.py b/tests/test_class_oelint_vars_fileextrapathsop.py index 0758bfa5..8e74737a 100644 --- a/tests/test_class_oelint_vars_fileextrapathsop.py +++ b/tests/test_class_oelint_vars_fileextrapathsop.py @@ -9,14 +9,6 @@ class TestClassOelintVarsFilextrapaths(TestBaseClass): @pytest.mark.parametrize('occurrence', [1]) @pytest.mark.parametrize('input_', [ - { - 'oelint_adv_test.bb': - 'FILESEXTRAPATHS_prepend .= "${THISDIR}/file"', - }, - { - 'oelint_adv_test.bb': - 'FILESEXTRAPATHS_append = "${THISDIR}/file"', - }, { 'oelint_adv_test.bb': 'FILESEXTRAPATHS:prepend .= "${THISDIR}/file"', @@ -51,17 +43,26 @@ def test_bad(self, input_, id_, occurrence): self.check_for_id(self._create_args(input_), id_, occurrence) @pytest.mark.parametrize('id_', ['oelint.vars.fileextrapathsop']) - @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('occurrence', [1]) @pytest.mark.parametrize('input_', [ { - 'oelint_adv_test.bbappend': - 'FILESEXTRAPATHS_prepend := "${THISDIR}/file"', + 'oelint_adv_test.bb': + 'FILESEXTRAPATHS_prepend .= "${THISDIR}/file"', }, { - 'oelint_adv_test.bbappend': - 'FILESEXTRAPATHS_append := "${THISDIR}/file"', + 'oelint_adv_test.bb': + 'FILESEXTRAPATHS_append = "${THISDIR}/file"', }, + ], + ) + 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.vars.fileextrapathsop']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ { 'oelint_adv_test.bbappend': 'FILESEXTRAPATHS:prepend := "${THISDIR}/file"', @@ -82,3 +83,20 @@ 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.vars.fileextrapathsop']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bbappend': + 'FILESEXTRAPATHS_prepend := "${THISDIR}/file"', + }, + { + 'oelint_adv_test.bbappend': + 'FILESEXTRAPATHS_append := "${THISDIR}/file"', + }, + ], + ) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) diff --git a/tests/test_class_oelint_vars_filessetting_double.py b/tests/test_class_oelint_vars_filessetting_double.py index 849e8fe8..d7ae4d00 100644 --- a/tests/test_class_oelint_vars_filessetting_double.py +++ b/tests/test_class_oelint_vars_filessetting_double.py @@ -12,73 +12,74 @@ class TestClassOelintVarsFileSettingsDouble(TestBaseClass): { 'oelint_adv_test.bb': ''' - FILES_${PN} += "${bindir}" - FILES_${PN}-ping = "${base_bindir}/ping.${BPN}" + FILES:${PN} += "${bindir}" + FILES:${PN}-ping = "${base_bindir}/ping.${BPN}" ''', }, { 'oelint_adv_test.bbappend': ''' - FILES_${PN} += "${bindir}" - FILES_${PN}-ping = "${base_bindir}/ping.${BPN}" + FILES:${PN} += "${bindir}" + FILES:${PN}-ping = "${base_bindir}/ping.${BPN}" ''', }, { 'oelint_adv_test.bb': ''' - FILES_${PN} += "${bindir}" + FILES:${PN} += "${bindir}" ''', }, { 'oelint_adv_test.bb': ''' - FILES_${PN}-doc += "${docdir}" + FILES:${PN}-doc += "${docdir}" ''', }, + + ], + ) + def test_bad(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_), id_, occurrence) + + @pytest.mark.parametrize('id_', ['oelint.vars.filessetting.double']) + @pytest.mark.parametrize('occurrence', [1]) + @pytest.mark.parametrize('input_', + [ { 'oelint_adv_test.bb': ''' - FILES:${PN} += "${bindir}" - FILES:${PN}-ping = "${base_bindir}/ping.${BPN}" + FILES_${PN} += "${bindir}" + FILES_${PN}-ping = "${base_bindir}/ping.${BPN}" ''', }, { 'oelint_adv_test.bbappend': ''' - FILES:${PN} += "${bindir}" - FILES:${PN}-ping = "${base_bindir}/ping.${BPN}" + FILES_${PN} += "${bindir}" + FILES_${PN}-ping = "${base_bindir}/ping.${BPN}" ''', }, { 'oelint_adv_test.bb': ''' - FILES:${PN} += "${bindir}" + FILES_${PN} += "${bindir}" ''', }, { 'oelint_adv_test.bb': ''' - FILES:${PN}-doc += "${docdir}" + FILES_${PN}-doc += "${docdir}" ''', }, - ], ) - 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.vars.filessetting.double']) @pytest.mark.parametrize('occurrence', [2]) @pytest.mark.parametrize('input_', [ - { - 'oelint_adv_test.bb': - ''' - FILES_${PN} += "/opt/other/path" - FILES_${PN}-ping = "${base_bindir}/ping.${BPN}" - FILES_${PN} += "/opt/other/path" - ''', - }, { 'oelint_adv_test.bb': ''' @@ -87,14 +88,13 @@ def test_bad(self, input_, id_, occurrence): FILES:${PN} += "/opt/other/path" ''', }, - ], ) def test_bad_non_default(self, input_, id_, occurrence): self.check_for_id(self._create_args(input_), id_, occurrence) @pytest.mark.parametrize('id_', ['oelint.vars.filessetting.double']) - @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('occurrence', [2]) @pytest.mark.parametrize('input_', [ { @@ -102,8 +102,18 @@ def test_bad_non_default(self, input_, id_, occurrence): ''' FILES_${PN} += "/opt/other/path" FILES_${PN}-ping = "${base_bindir}/ping.${BPN}" + FILES_${PN} += "/opt/other/path" ''', }, + ], + ) + def test_bad_non_default_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) + + @pytest.mark.parametrize('id_', ['oelint.vars.filessetting.double']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ { 'oelint_adv_test.bb': ''' @@ -115,3 +125,19 @@ def test_bad_non_default(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.vars.filessetting.double']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + ''' + FILES_${PN} += "/opt/other/path" + FILES_${PN}-ping = "${base_bindir}/ping.${BPN}" + ''', + }, + ], + ) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) diff --git a/tests/test_class_oelint_vars_filessetting_hidden.py b/tests/test_class_oelint_vars_filessetting_hidden.py index c6c0c762..10872c78 100644 --- a/tests/test_class_oelint_vars_filessetting_hidden.py +++ b/tests/test_class_oelint_vars_filessetting_hidden.py @@ -9,30 +9,6 @@ class TestClassOelintVarsFileSettingsHidden(TestBaseClass): @pytest.mark.parametrize('occurrence', [1]) @pytest.mark.parametrize('input_', [ - { - 'oelint_adv_test.bb': - ''' - SPLITPKGS = "${PN}-ping ${PN}-arping ${PN}-tracepath ${PN}-clockdiff \ - ${PN}-tftpd ${PN}-rdisc \ - ${@bb.utils.contains('PACKAGECONFIG', 'rarpd', '${PN}-rarpd', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', '${PN}-traceroute6 ${PN}-ninfod', '', d)}" - PACKAGES =+ "${SPLITPKGS}" - - ALLOW_EMPTY_${PN} = "1" - RDEPENDS_${PN} += "${SPLITPKGS}" - - FILES_${PN} += "${bindir}" - FILES_${PN}-ping = "${base_bindir}/ping.${BPN}" - FILES_${PN}-arping = "${base_bindir}/arping" - FILES_${PN}-tracepath = "${base_bindir}/tracepath" - FILES_${PN}-traceroute6 = "${base_bindir}/traceroute6" - FILES_${PN}-clockdiff = "${base_bindir}/clockdiff" - FILES_${PN}-tftpd = "${bindir} ${base_bindir}/tftpd" - FILES_${PN}-rarpd = "${base_sbindir}/rarpd ${systemd_unitdir}/system/rarpd@.service" - FILES_${PN}-rdisc = "${base_sbindir}/rdisc" - FILES_${PN}-ninfod = "${base_sbindir}/ninfod ${sysconfdir}/init.d/ninfod.sh" - ''', - }, { 'oelint_adv_test.bb': ''' @@ -61,20 +37,22 @@ def test_bad(self, input_, id_, occurrence): self.check_for_id(self._create_args(input_), id_, occurrence) @pytest.mark.parametrize('id_', ['oelint.vars.filessetting.hidden']) - @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('occurrence', [1]) @pytest.mark.parametrize('input_', [ { 'oelint_adv_test.bb': ''' - SPLITPKGS = "${PN}-ping ${PN}-arping ${PN}-tracepath \ - ${PN}-clockdiff ${PN}-tftpd ${PN}-rdisc \ + SPLITPKGS = "${PN}-ping ${PN}-arping ${PN}-tracepath ${PN}-clockdiff \ + ${PN}-tftpd ${PN}-rdisc \ ${@bb.utils.contains('PACKAGECONFIG', 'rarpd', '${PN}-rarpd', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', '${PN}-traceroute6 ${PN}-ninfod', '', d)}" - PACKAGES += "${SPLITPKGS}" + PACKAGES =+ "${SPLITPKGS}" + ALLOW_EMPTY_${PN} = "1" RDEPENDS_${PN} += "${SPLITPKGS}" - FILES_${PN} = "" + + FILES_${PN} += "${bindir}" FILES_${PN}-ping = "${base_bindir}/ping.${BPN}" FILES_${PN}-arping = "${base_bindir}/arping" FILES_${PN}-tracepath = "${base_bindir}/tracepath" @@ -86,6 +64,15 @@ def test_bad(self, input_, id_, occurrence): FILES_${PN}-ninfod = "${base_sbindir}/ninfod ${sysconfdir}/init.d/ninfod.sh" ''', }, + ], + ) + 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.vars.filessetting.hidden']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ { 'oelint_adv_test.bb': ''' @@ -112,3 +99,34 @@ 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.vars.filessetting.hidden']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + ''' + SPLITPKGS = "${PN}-ping ${PN}-arping ${PN}-tracepath \ + ${PN}-clockdiff ${PN}-tftpd ${PN}-rdisc \ + ${@bb.utils.contains('PACKAGECONFIG', 'rarpd', '${PN}-rarpd', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', '${PN}-traceroute6 ${PN}-ninfod', '', d)}" + PACKAGES += "${SPLITPKGS}" + ALLOW_EMPTY_${PN} = "1" + RDEPENDS_${PN} += "${SPLITPKGS}" + FILES_${PN} = "" + FILES_${PN}-ping = "${base_bindir}/ping.${BPN}" + FILES_${PN}-arping = "${base_bindir}/arping" + FILES_${PN}-tracepath = "${base_bindir}/tracepath" + FILES_${PN}-traceroute6 = "${base_bindir}/traceroute6" + FILES_${PN}-clockdiff = "${base_bindir}/clockdiff" + FILES_${PN}-tftpd = "${bindir} ${base_bindir}/tftpd" + FILES_${PN}-rarpd = "${base_sbindir}/rarpd ${systemd_unitdir}/system/rarpd@.service" + FILES_${PN}-rdisc = "${base_sbindir}/rdisc" + FILES_${PN}-ninfod = "${base_sbindir}/ninfod ${sysconfdir}/init.d/ninfod.sh" + ''', + }, + ], + ) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) diff --git a/tests/test_class_oelint_vars_inconspaces.py b/tests/test_class_oelint_vars_inconspaces.py index 2cd00639..6bfe8a8e 100644 --- a/tests/test_class_oelint_vars_inconspaces.py +++ b/tests/test_class_oelint_vars_inconspaces.py @@ -13,10 +13,6 @@ class TestClassOelintVarsInconSpaces(TestBaseClass): 'oelint_adv_test.bb': 'VAR += " ffjjj"', }, - { - 'oelint_adv_test.bb': - 'VAR_append = "fhhh"', - }, { 'oelint_adv_test.bb': 'VAR:append = "fhhh"', @@ -35,16 +31,25 @@ def test_bad(self, input_, id_, occurrence): self.check_for_id(self._create_args(input_), id_, occurrence) @pytest.mark.parametrize('id_', ['oelint.vars.inconspaces']) - @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('occurrence', [1]) @pytest.mark.parametrize('input_', [ { 'oelint_adv_test.bb': - 'VAR += "ffjjj"', + 'VAR_append = "fhhh"', }, + ], + ) + 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.vars.inconspaces']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ { 'oelint_adv_test.bb': - 'VAR_append = " fhhh"', + 'VAR += "ffjjj"', }, { 'oelint_adv_test.bb': @@ -78,3 +83,16 @@ 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.vars.inconspaces']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + 'VAR_append = " fhhh"', + }, + ], + ) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) diff --git a/tests/test_class_oelint_vars_insaneskip.py b/tests/test_class_oelint_vars_insaneskip.py index b663d8c4..2fab6a74 100644 --- a/tests/test_class_oelint_vars_insaneskip.py +++ b/tests/test_class_oelint_vars_insaneskip.py @@ -11,33 +11,42 @@ class TestClassOelintVarsInsaneSkip(TestBaseClass): [ { 'oelint_adv_test.bb': - 'INSANE_SKIP_${PN} = "a"', + 'INSANE_SKIP:${PN} = "a"', }, { 'oelint_adv_test.bb': - 'INSANE_SKIP_bla = "a"', + 'INSANE_SKIP:bla = "a"', }, { 'oelint_adv_test.bb': - 'INSANE_SKIP_bla_class-native = "a"', + 'INSANE_SKIP:bla:class-native = "a"', }, + + ], + ) + def test_bad(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_), id_, occurrence) + + @pytest.mark.parametrize('id_', ['oelint.vars.insaneskip']) + @pytest.mark.parametrize('occurrence', [1]) + @pytest.mark.parametrize('input_', + [ { 'oelint_adv_test.bb': - 'INSANE_SKIP:${PN} = "a"', + 'INSANE_SKIP_${PN} = "a"', }, { 'oelint_adv_test.bb': - 'INSANE_SKIP:bla = "a"', + 'INSANE_SKIP_bla = "a"', }, { 'oelint_adv_test.bb': - 'INSANE_SKIP:bla:class-native = "a"', + 'INSANE_SKIP_bla_class-native = "a"', }, - ], ) - 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.vars.insaneskip']) @pytest.mark.parametrize('occurrence', [0]) diff --git a/tests/test_class_oelint_vars_listappend.py b/tests/test_class_oelint_vars_listappend.py index 4c80a94c..601ce6fd 100644 --- a/tests/test_class_oelint_vars_listappend.py +++ b/tests/test_class_oelint_vars_listappend.py @@ -15,15 +15,15 @@ class TestClassOelintVarsListAppend(TestBaseClass): }, { 'oelint_adv_test.bb': - 'FILES_${PN}-tracepath_append = "${base_bindir}"', + 'FILES:${PN}-tracepath:append = "${base_bindir}"', }, { 'oelint_adv_test.bb': - 'RDEPENDS_${PN} .= "bar"', + 'RDEPENDS:${PN} .= "bar"', }, { 'oelint_adv_test.bb': - 'DEPENDS_prepend = "xyz"', + 'DEPENDS:prepend = "xyz"', }, { 'oelint_adv_test.bb': @@ -35,6 +35,7 @@ def test_bad(self, input_, id_, occurrence): self.check_for_id(self._create_args(input_), id_, occurrence) @pytest.mark.parametrize('id_', ['oelint.vars.listappend']) + @pytest.mark.parametrize('occurrence', [1]) @pytest.mark.parametrize('input_', [ { @@ -59,42 +60,135 @@ def test_bad(self, 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.vars.listappend']) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + 'PACKAGES =. "foo"', + }, + { + 'oelint_adv_test.bb': + 'FILES:${PN}-tracepath:append = "${base_bindir}"', + }, + { + 'oelint_adv_test.bb': + 'RDEPENDS:${PN} .= "bar"', + }, + { + 'oelint_adv_test.bb': + 'DEPENDS:prepend = "xyz"', + }, + { + 'oelint_adv_test.bb': + 'SRC_URI .= "file://abc"', + }, + ], + ) def test_fix(self, input_, id_): self.fix_and_check(self._create_args_fix(input_), id_) - @ pytest.mark.parametrize('id_', ['oelint.vars.listappend']) - @ pytest.mark.parametrize('occurrence', [0]) - @ pytest.mark.parametrize('input_', - [ - { - 'oelint_adv_test.bb': - 'PACKAGES =. "foo "', - }, - { - 'oelint_adv_test.bb': - 'FILES_${PN}-tracepath_append = " ${base_bindir}"', - }, - { - 'oelint_adv_test.bb': - 'RDEPENDS_${PN} .= " bar"', - }, - { - 'oelint_adv_test.bb': - 'DEPENDS_prepend = "xyz "', - }, - { - 'oelint_adv_test.bb': - 'SRC_URI .= " file://abc"', - }, - { - 'oelint_adv_test.bb': - 'FILESPATH_prepend := "${THISDIR}/file:"', - }, - { - 'oelint_adv_test.bb': - 'FILESEXTRAPATHS_prepend := "${THISDIR}/file:"', - }, - ], - ) + @pytest.mark.parametrize('id_', ['oelint.vars.listappend']) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + 'PACKAGES =. "foo"', + }, + { + 'oelint_adv_test.bb': + 'FILES_${PN}-tracepath_append = "${base_bindir}"', + }, + { + 'oelint_adv_test.bb': + 'RDEPENDS_${PN} .= "bar"', + }, + { + 'oelint_adv_test.bb': + 'DEPENDS_prepend = "xyz"', + }, + { + 'oelint_adv_test.bb': + 'SRC_URI .= "file://abc"', + }, + ], + ) + def test_fix_old(self, input_, id_): + self.fix_and_check(self._create_args_fix(input_, ['--release=dunfell']), id_) + + @pytest.mark.parametrize('id_', ['oelint.vars.listappend']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + 'PACKAGES =. "foo "', + }, + { + 'oelint_adv_test.bb': + 'FILES:${PN}-tracepath:append = " ${base_bindir}"', + }, + { + 'oelint_adv_test.bb': + 'RDEPENDS:${PN} .= " bar"', + }, + { + 'oelint_adv_test.bb': + 'DEPENDS:prepend = "xyz "', + }, + { + 'oelint_adv_test.bb': + 'SRC_URI .= " file://abc"', + }, + { + 'oelint_adv_test.bb': + 'FILESPATH:prepend := "${THISDIR}/file:"', + }, + { + 'oelint_adv_test.bb': + 'FILESEXTRAPATHS:prepend := "${THISDIR}/file:"', + }, + ], + ) def test_good(self, input_, id_, occurrence): self.check_for_id(self._create_args(input_), id_, occurrence) + + @pytest.mark.parametrize('id_', ['oelint.vars.listappend']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + 'PACKAGES =. "foo "', + }, + { + 'oelint_adv_test.bb': + 'FILES_${PN}-tracepath_append = " ${base_bindir}"', + }, + { + 'oelint_adv_test.bb': + 'RDEPENDS_${PN} .= " bar"', + }, + { + 'oelint_adv_test.bb': + 'DEPENDS_prepend = "xyz "', + }, + { + 'oelint_adv_test.bb': + 'SRC_URI .= " file://abc"', + }, + { + 'oelint_adv_test.bb': + 'FILESPATH_prepend := "${THISDIR}/file:"', + }, + { + 'oelint_adv_test.bb': + 'FILESEXTRAPATHS_prepend := "${THISDIR}/file:"', + }, + ], + ) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) diff --git a/tests/test_class_oelint_vars_misspell.py b/tests/test_class_oelint_vars_misspell.py index c4e44374..535a1f7f 100644 --- a/tests/test_class_oelint_vars_misspell.py +++ b/tests/test_class_oelint_vars_misspell.py @@ -45,7 +45,7 @@ def test_bad_unknown(self, input_, id_, occurrence): [ { 'oelint_adv_test.bb': - 'RDEPENDS_${PN} = "foo"', + 'RDEPENDS:${PN} = "foo"', }, { 'oelint_adv_test.bb': @@ -72,7 +72,7 @@ def test_bad_unknown(self, input_, id_, occurrence): 'oelint_adv_test.bb': ''' PACKAGES += "${PN}-foo" - INITSCRIPT_PARAMS_${PN}-foo = "bar" + INITSCRIPT_PARAMS:${PN}-foo = "bar" ''', }, { @@ -123,6 +123,26 @@ def test_bad_unknown(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.vars.mispell']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + 'RDEPENDS_${PN} = "foo"', + }, + { + 'oelint_adv_test.bb': + ''' + PACKAGES += "${PN}-foo" + INITSCRIPT_PARAMS_${PN}-foo = "bar" + ''', + }, + ], + ) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) + @pytest.mark.parametrize('id_', ['oelint.vars.mispell.unknown']) @pytest.mark.parametrize('occurrence', [0]) @pytest.mark.parametrize('input_', diff --git a/tests/test_class_oelint_vars_notneededspace.py b/tests/test_class_oelint_vars_notneededspace.py index 8c34facb..e8baef82 100644 --- a/tests/test_class_oelint_vars_notneededspace.py +++ b/tests/test_class_oelint_vars_notneededspace.py @@ -50,11 +50,20 @@ def test_fix(self, input_, id_): 'oelint_adv_test.bb': 'VAR += "a"', }, + ], + ) + def test_good(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_), id_, occurrence) + + @pytest.mark.parametrize('id_', ['oelint.vars.notneededspace']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ { 'oelint_adv_test.bb': 'VAR_append = " a"', }, ], ) - def test_good(self, input_, id_, occurrence): - self.check_for_id(self._create_args(input_), id_, occurrence) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) diff --git a/tests/test_class_oelint_vars_specific.py b/tests/test_class_oelint_vars_specific.py index 9cd767a1..d818cf6f 100644 --- a/tests/test_class_oelint_vars_specific.py +++ b/tests/test_class_oelint_vars_specific.py @@ -5,6 +5,37 @@ class TestClassOelintVarsSpecific(TestBaseClass): + @pytest.mark.parametrize('id_', ['oelint.vars.specific']) + @pytest.mark.parametrize('occurrence', [1]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + 'A:append:fooarch = " abc"', + }, + { + 'oelint_adv_test.bb': + 'B:bararch += "abc"', + }, + { + 'oelint_adv_test.bb': + ''' + COMPATIBLE_MACHINE = "xyz" + A:append:fooarch = " abc" + ''', + }, + { + 'oelint_adv_test.bb': + ''' + COMPATIBLE_MACHINE = "xyz" + B:bararch += "abc" + ''', + }, + ], + ) + def test_bad(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_), id_, occurrence) + @pytest.mark.parametrize('id_', ['oelint.vars.specific']) @pytest.mark.parametrize('occurrence', [1]) @pytest.mark.parametrize('input_', @@ -33,7 +64,91 @@ class TestClassOelintVarsSpecific(TestBaseClass): }, ], ) - def test_bad(self, 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.vars.specific']) + @pytest.mark.parametrize('occurrence', [0]) + @pytest.mark.parametrize('input_', + [ + { + 'oelint_adv_test.bb': + ''' + COMPATIBLE_MACHINE = "foo" + A:append:fooarch = " abc" + COMPATIBLE_MACHINE += "|bar" + B:bararch += "abc" + PACKAGES =+ "${PN}-httpd ${PN}-syslog ${PN}-mdev ${PN}-udhcpd ${PN}-udhcpc ${PN}-hwclock" + FILES:${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www" + FILES:${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf* ${sysconfdir}/syslog.conf* ${systemd_unitdir}/system/syslog.service ${sysconfdir}/default/busybox-syslog" + FILES:${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/mdev/*" + FILES:${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd" + FILES:${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc" + FILES:${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh" + DO_IPv4 := "${@bb.utils.contains('DISTRO_FEATURES', 'ipv4', 1, 0, d)}" + DO_IPv6 := "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 1, 0, d)}" + SRC_URI:append:libc-musl = " file://musl.cfg " + SRC_URI[tarball.md5sum] = "0a367e19cdfd157e8258d87f893ee516" + SRC_URI[tarball.sha256sum] = "97648636e579462296478e0218e65e4bc1e9cd69089a3b1aeb810bff7621efb7" + PACKAGES += "${PN}-foo myrecipe-foo" + USERADD_PARAM:myrecipe-foo = "--bar --baz" + SRC_URI = "\\ + git://foo.org/baz.git;name=super \\ + git://foo.org/bar.git;name=ultra \\ + " + SRC_URI += "git://foo.org/${BPN}.git;name=${PN}" + SRCREV_super = "2a76ac0ff0e702a7f553b6d7135a1089e9c3b469" + SRCREV_ultra = "7533c21ba6c06a513eaa9500a06ae780249b9834" + PACKAGECONFIG_class-nativesdk ??= "${PACKAGECONFIG_class-native}" + PACKAGES =+ "libpulsecore libpulsecommon libpulse libpulse-simple libpulse-mainloop-glib \\ + pulseaudio-server pulseaudio-misc ${@bb.utils.contains('PACKAGECONFIG', 'dbus', 'pulseaudio-module-console-kit', '', d)}" + DEPENDS:pulseaudio-server = "foo-bar" + DEPENDS:clang = "Unknown" + DEPENDS:linux = "Linux" + DEPENDS:darwin = "Darwin" + DEPENDS:mingw32 = "Windows" + A:oelint = "foo" + ''', + }, + { + 'oelint_adv_test.bb': + ''' + PACKAGE_BEFORE_PN =. "extra-pkg" + FILES:extra-pkg = "${base_bindir}" + ''', + }, + { + 'oelint_adv_test.bb': + ''' + PACKAGE_BEFORE_PN =. "extra-pkg" + FILES:extra-pkg = "${base_bindir}" + ''', + }, + { + 'oelint_adv_test.bbappend': + ''' + COMPATIBLE_MACHINE = "xyz" + A:append:fooarch = " abc" + ''', + }, + { + 'oelint_adv_test.bbappend': + ''' + COMPATIBLE_MACHINE = "xyz" + B:bararch += "abc" + ''', + }, + { + 'oelint_adv_test.bb': + 'B:poky += "abc"', + }, + { + 'oelint_adv_test.bb': + 'B:nodistro += "abc"', + }, + ], + ) + def test_good(self, input_, id_, occurrence): self.check_for_id(self._create_args(input_), id_, occurrence) @pytest.mark.parametrize('id_', ['oelint.vars.specific']) @@ -107,15 +222,7 @@ def test_bad(self, input_, id_, occurrence): B_bararch += "abc" ''', }, - { - 'oelint_adv_test.bb': - 'B:poky += "abc"', - }, - { - 'oelint_adv_test.bb': - 'B:nodistro += "abc"', - }, ], ) - def test_good(self, input_, id_, occurrence): - self.check_for_id(self._create_args(input_), id_, occurrence) + def test_good_old(self, input_, id_, occurrence): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), id_, occurrence) diff --git a/tests/test_inlinesuppressions.py b/tests/test_inlinesuppressions.py index 6d2dcae9..1979b892 100644 --- a/tests/test_inlinesuppressions.py +++ b/tests/test_inlinesuppressions.py @@ -48,7 +48,7 @@ def test_inlinesuppressions_single(self, input_): 'oelint adv-test.bb': ''' # nooelint: oelint.vars.someother - INSANE_SKIP_${PN} = "foo" + INSANE_SKIP:${PN} = "foo" ''', } ], @@ -56,6 +56,21 @@ def test_inlinesuppressions_single(self, input_): def test_inlinesuppressions_single_notmatching(self, input_): self.check_for_id(self._create_args(input_), 'oelint.vars.insaneskip', 1) + + @pytest.mark.parametrize('input_', + [ + { + 'oelint adv-test.bb': + ''' + # nooelint: oelint.vars.someother + INSANE_SKIP_${PN} = "foo" + ''', + } + ], + ) + def test_inlinesuppressions_single_notmatching_old(self, input_): + self.check_for_id(self._create_args(input_, ['--release=dunfell']), + 'oelint.vars.insaneskip', 1) @pytest.mark.parametrize('input_', [ diff --git a/tests/test_user_interface.py b/tests/test_user_interface.py index 62ff0cc9..aacc5ce9 100644 --- a/tests/test_user_interface.py +++ b/tests/test_user_interface.py @@ -591,7 +591,7 @@ def test_messageformat_1(self, input_): 'oelint adv-test.bb': ''' VAR = "1" - INSANE_SKIP_${PN} = "foo" + INSANE_SKIP:${PN} = "foo" ''', }, ], @@ -605,6 +605,26 @@ def test_messageformat_2(self, input_): issues = [x[1] for x in run(_args)] assert (any([x for x in issues if 'oelint.vars.insaneskip:error:' in x])) + @pytest.mark.parametrize('input_', + [ + { + 'oelint adv-test.bb': + ''' + VAR = "1" + INSANE_SKIP_${PN} = "foo" + ''', + }, + ], + ) + def test_messageformat_2_old(self, input_): + # local imports only + from oelint_adv.__main__ import run + + _args = self._create_args( + input_, extraopts=['--messageformat="{id}:{severity}:{msg}"', '--release=dunfell']) + issues = [x[1] for x in run(_args)] + assert (any([x for x in issues if 'oelint.vars.insaneskip:error:' in x])) + @pytest.mark.parametrize('input_', [ {