Received: by 10.223.185.116 with SMTP id b49csp8236973wrg; Thu, 1 Mar 2018 20:46:52 -0800 (PST) X-Google-Smtp-Source: AG47ELu1RSfXP0uyrF/61M7ZuKcn0l37mQdiveueNlRBE5xqCEWZomSlQMlxkG0Kh6/b+zo0X1bS X-Received: by 2002:a17:902:8289:: with SMTP id y9-v6mr4121790pln.242.1519966012585; Thu, 01 Mar 2018 20:46:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519966012; cv=none; d=google.com; s=arc-20160816; b=Hp82AX+Xy9XtTufkO2RSl/DU2RjA6FnR4WD3SJWzv9rDSCVjYxDznbdmINtdmMTZCu T2vHiUNu14GHFB5n/4pLzoFkHIjWMJU51I3rgKlQd+488fneYlNMatdB8k0FeerVBGQE 2rIK832hhkig9lKPF/dp7UWMBNT4w/9rd+M90E0ipfv21i7XJeONhvpm6jKZz6QorRhi B14A66wFacA5WEWp0WBSHvjpLRvhy2lxfvMmEOONchAsBlylX5DkAFyGrP6XWMFFLCIs NDk+LQeyqJk5KTn8kT4TZWPfdhNTZNNwz5UenCZV2MfxWraMea9oAFl37KCRSzkJ85rq 9xoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=7fvugWdUquotL2GEcYy828ZTy3AAO7xoQZl6/cwUdO0=; b=B8RnEf0+Xso8L/vMh6ZavAaLz0qUtq1xbxuCMr/NDipduQGy5asst2QqC9O8sUmEd8 ao1xd1qXag6g+SHhvIUkyj/cDjmzL/K8KvC7h1TS11fWr07VpdlkTSYpAt1n8dga77DP W6uRI50hlYh95OcTvWjcJarxiNVYnqSXorSmWWAVOTQoa2FIQoiqrzU9xd6EEGJQD/gX 57xLM1kNhk+en3hPP34X5RrXFF11BnMYVG+3nHGE5m6zdO290ETHpGj0w5BoaxcskehJ mcziUnnL9nqXfOc6rXxP/D2UqZLd9aHSQBX7D0JO1zz6i5hGbcybeWwrPcUnrY+9UuWG 8OAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=oz11s9HA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be3-v6si1146367plb.581.2018.03.01.20.46.37; Thu, 01 Mar 2018 20:46:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=oz11s9HA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1165061AbeCBEez (ORCPT + 99 others); Thu, 1 Mar 2018 23:34:55 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:53225 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164994AbeCBEds (ORCPT ); Thu, 1 Mar 2018 23:33:48 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w224WURB022085; Fri, 2 Mar 2018 13:32:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w224WURB022085 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1519965151; bh=7fvugWdUquotL2GEcYy828ZTy3AAO7xoQZl6/cwUdO0=; h=From:To:Cc:Subject:Date:From; b=oz11s9HAws+p/rKqN50GlMWNl3axZuvQnP7p9+IZPQxQrpktAP27KFIh+MKL3jNXY SQFEhzC8uOt55ukR1uU02vEeGHe3gSDHvOsyoJwDVdXKHtJbGAdN2nAicH22OTAV4q 410O+H0YLioLKo9yBZyYuOJcCGw8ERzsjmxLpwuPw6l7vD3T3r0kyLuE0U1qMoPOWj 18nR6fnqdi4jGao+LwsVBjstLJO3MLZuSMQjdQolX41RKacWadFl5446vfJMIoHdLC 2nr0BvUadWo74+dLA1V0Vy49CmjF0744UWcBMU6YpNlIN9x3RPcYL5YbF1GqK8pDT+ rH0x1Q8vFwI7g== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Michal Marek , Ulf Magnusson , Randy Dunlap , "Luis R . Rodriguez" , Masahiro Yamada , Tony Luck , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, Fenghua Yu Subject: [PATCH v2 00/11] Add Kconfig unit tests Date: Fri, 2 Mar 2018 13:31:50 +0900 Message-Id: <1519965121-12017-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I am applying various cleanups to Kconfig these days. However, I fear regressions. I have been thinking of unit-tests. There are various cryptic parts in Kconfig and corner cases where it is difficult to notice breakage. If unit-tests cover those, I will be able to apply changes more confidently. This series introduces a unit-tests. The framework is written based on pytest. Also, this is written in Python 3. Python 2 will retire in 2020. So, I believe new python tools should be written in Python 3. This is my Python 3 and pytest versions. $ python3 --version Python 3.5.2 $ python3 -m pytest --version This is pytest version 3.4.1, imported from /home/masahiro/.local/lib/python3.5/site-packages/pytest.py How to use? ----------- Please make sure Python3 and pytest are installed on your system. Then, run "make testconfig" The result looks like as follows: $ make testconfig python3 -B -m pytest ./scripts/kconfig/tests \ -o cache_dir=/home/masahiro/workspace/bsp/linux-yamada/scripts/kconfig/tests/.cache \ ================================= test session starts ================================= platform linux -- Python 3.5.2, pytest-3.4.1, py-1.5.2, pluggy-0.6.0 -- /usr/bin/python3 cachedir: scripts/kconfig/tests/.cache rootdir: /home/masahiro/workspace/bsp/linux-yamada/scripts/kconfig/tests, inifile: pytest.ini collected 14 items scripts/kconfig/tests/auto_submenu/__init__.py::test PASSED [ 7%] scripts/kconfig/tests/choice/__init__.py::test_oldask0 PASSED [ 14%] scripts/kconfig/tests/choice/__init__.py::test_oldask1 PASSED [ 21%] scripts/kconfig/tests/choice/__init__.py::test_allyes PASSED [ 28%] scripts/kconfig/tests/choice/__init__.py::test_allmod PASSED [ 35%] scripts/kconfig/tests/choice/__init__.py::test_allno PASSED [ 42%] scripts/kconfig/tests/choice/__init__.py::test_alldef PASSED [ 50%] scripts/kconfig/tests/choice_value_with_m_dep/__init__.py::test PASSED [ 57%] scripts/kconfig/tests/err_recursive_inc/__init__.py::test PASSED [ 64%] scripts/kconfig/tests/inter_choice/__init__.py::test PASSED [ 71%] scripts/kconfig/tests/new_choice_with_dep/__init__.py::test PASSED [ 78%] scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py::test PASSED [ 85%] scripts/kconfig/tests/rand_nested_choice/__init__.py::test PASSED [ 92%] scripts/kconfig/tests/warn_recursive_dep/__init__.py::test PASSED [100%] Changes in v2: - Add backward compatibility for PYTHON - Add 'randconfig' support - Add docstring - Fix various style errors detected by 'pep8' and 'pep257' - coding style clean-up based on PEP8, PEP257 - shorten directory name 'auto_submenu_creation' -> 'auto_submenu' - coding style clean-up based on PEP8, PEP257 - coding style clean-up based on PEP8, PEP257 - coding style clean-up based on PEP8, PEP257 - coding style clean-up based on PEP8, PEP257 - Newly added - Newly added - Fix missing end quote - coding style clean-up based on PEP8, PEP257 - coding style clean-up based on PEP8, PEP257 Masahiro Yamada (11): kbuild: define PYTHON2 and PYTHON3 variables instead of PYTHON kconfig: unittest: add framework for Kconfig unit testing kconfig: unittest: add basic 'choice' tests kconfig: unittest: test automatic submenu creation kconfig: unittest: test if new symbols in choice are asked kconfig: unittest: check unneeded "is not set" with unmet dependency kconfig: unittest: check visibility of tri-choice values in y choice kconfig: unittest: test defconfig when two choices interact kconfig: unittest: test randconfig for choice in choice kconfig: unittest: test if recursive dependencies are detected kconfig: unittest: test if recursive inclusion is detected Makefile | 5 +- arch/ia64/Makefile | 2 +- scripts/kconfig/Makefile | 8 + scripts/kconfig/tests/auto_submenu/Kconfig | 50 ++++ scripts/kconfig/tests/auto_submenu/__init__.py | 12 + scripts/kconfig/tests/auto_submenu/expected_stdout | 10 + scripts/kconfig/tests/choice/Kconfig | 54 ++++ scripts/kconfig/tests/choice/__init__.py | 40 +++ .../kconfig/tests/choice/alldef_expected_config | 5 + .../kconfig/tests/choice/allmod_expected_config | 9 + scripts/kconfig/tests/choice/allno_expected_config | 5 + .../kconfig/tests/choice/allyes_expected_config | 9 + .../kconfig/tests/choice/oldask0_expected_stdout | 10 + scripts/kconfig/tests/choice/oldask1_config | 2 + .../kconfig/tests/choice/oldask1_expected_stdout | 15 ++ .../kconfig/tests/choice_value_with_m_dep/Kconfig | 20 ++ .../tests/choice_value_with_m_dep/__init__.py | 15 ++ .../kconfig/tests/choice_value_with_m_dep/config | 2 + .../tests/choice_value_with_m_dep/expected_config | 3 + .../tests/choice_value_with_m_dep/expected_stdout | 4 + scripts/kconfig/tests/conftest.py | 291 +++++++++++++++++++++ scripts/kconfig/tests/err_recursive_inc/Kconfig | 1 + .../kconfig/tests/err_recursive_inc/Kconfig.inc | 1 + .../kconfig/tests/err_recursive_inc/__init__.py | 10 + .../tests/err_recursive_inc/expected_stderr | 4 + scripts/kconfig/tests/inter_choice/Kconfig | 24 ++ scripts/kconfig/tests/inter_choice/__init__.py | 14 + scripts/kconfig/tests/inter_choice/defconfig | 1 + scripts/kconfig/tests/inter_choice/expected_config | 4 + scripts/kconfig/tests/new_choice_with_dep/Kconfig | 37 +++ .../kconfig/tests/new_choice_with_dep/__init__.py | 14 + scripts/kconfig/tests/new_choice_with_dep/config | 3 + .../tests/new_choice_with_dep/expected_stdout | 10 + .../kconfig/tests/no_write_if_dep_unmet/Kconfig | 14 + .../tests/no_write_if_dep_unmet/__init__.py | 19 ++ scripts/kconfig/tests/no_write_if_dep_unmet/config | 1 + .../tests/no_write_if_dep_unmet/expected_config | 5 + scripts/kconfig/tests/pytest.ini | 6 + scripts/kconfig/tests/rand_nested_choice/Kconfig | 33 +++ .../kconfig/tests/rand_nested_choice/__init__.py | 16 ++ .../tests/rand_nested_choice/expected_stdout0 | 2 + .../tests/rand_nested_choice/expected_stdout1 | 4 + .../tests/rand_nested_choice/expected_stdout2 | 5 + scripts/kconfig/tests/warn_recursive_dep/Kconfig | 62 +++++ .../kconfig/tests/warn_recursive_dep/__init__.py | 9 + .../tests/warn_recursive_dep/expected_stderr | 30 +++ 46 files changed, 897 insertions(+), 3 deletions(-) create mode 100644 scripts/kconfig/tests/auto_submenu/Kconfig create mode 100644 scripts/kconfig/tests/auto_submenu/__init__.py create mode 100644 scripts/kconfig/tests/auto_submenu/expected_stdout create mode 100644 scripts/kconfig/tests/choice/Kconfig create mode 100644 scripts/kconfig/tests/choice/__init__.py create mode 100644 scripts/kconfig/tests/choice/alldef_expected_config create mode 100644 scripts/kconfig/tests/choice/allmod_expected_config create mode 100644 scripts/kconfig/tests/choice/allno_expected_config create mode 100644 scripts/kconfig/tests/choice/allyes_expected_config create mode 100644 scripts/kconfig/tests/choice/oldask0_expected_stdout create mode 100644 scripts/kconfig/tests/choice/oldask1_config create mode 100644 scripts/kconfig/tests/choice/oldask1_expected_stdout create mode 100644 scripts/kconfig/tests/choice_value_with_m_dep/Kconfig create mode 100644 scripts/kconfig/tests/choice_value_with_m_dep/__init__.py create mode 100644 scripts/kconfig/tests/choice_value_with_m_dep/config create mode 100644 scripts/kconfig/tests/choice_value_with_m_dep/expected_config create mode 100644 scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout create mode 100644 scripts/kconfig/tests/conftest.py create mode 100644 scripts/kconfig/tests/err_recursive_inc/Kconfig create mode 100644 scripts/kconfig/tests/err_recursive_inc/Kconfig.inc create mode 100644 scripts/kconfig/tests/err_recursive_inc/__init__.py create mode 100644 scripts/kconfig/tests/err_recursive_inc/expected_stderr create mode 100644 scripts/kconfig/tests/inter_choice/Kconfig create mode 100644 scripts/kconfig/tests/inter_choice/__init__.py create mode 100644 scripts/kconfig/tests/inter_choice/defconfig create mode 100644 scripts/kconfig/tests/inter_choice/expected_config create mode 100644 scripts/kconfig/tests/new_choice_with_dep/Kconfig create mode 100644 scripts/kconfig/tests/new_choice_with_dep/__init__.py create mode 100644 scripts/kconfig/tests/new_choice_with_dep/config create mode 100644 scripts/kconfig/tests/new_choice_with_dep/expected_stdout create mode 100644 scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig create mode 100644 scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py create mode 100644 scripts/kconfig/tests/no_write_if_dep_unmet/config create mode 100644 scripts/kconfig/tests/no_write_if_dep_unmet/expected_config create mode 100644 scripts/kconfig/tests/pytest.ini create mode 100644 scripts/kconfig/tests/rand_nested_choice/Kconfig create mode 100644 scripts/kconfig/tests/rand_nested_choice/__init__.py create mode 100644 scripts/kconfig/tests/rand_nested_choice/expected_stdout0 create mode 100644 scripts/kconfig/tests/rand_nested_choice/expected_stdout1 create mode 100644 scripts/kconfig/tests/rand_nested_choice/expected_stdout2 create mode 100644 scripts/kconfig/tests/warn_recursive_dep/Kconfig create mode 100644 scripts/kconfig/tests/warn_recursive_dep/__init__.py create mode 100644 scripts/kconfig/tests/warn_recursive_dep/expected_stderr -- 2.7.4