From 852eae7d41abed9051f72d0ba72bfb854cfb6fcb Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Thu, 2 Nov 2017 20:36:41 +0100 Subject: Clean up .kconfig tests Kinda silly to test if they're separate since a long time, but can do that easily too with some reorganization. --- testsuite.py | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'testsuite.py') diff --git a/testsuite.py b/testsuite.py index 156a640..3afa66a 100644 --- a/testsuite.py +++ b/testsuite.py @@ -1261,27 +1261,18 @@ g verify_value("IGNOREME", "y") - print("Testing Kconfig separation") - - c1 = Kconfig("Kconfiglib/tests/Kmisc", warn=False) - c2 = Kconfig("Kconfiglib/tests/Kmisc", warn=False) - - c1_undef, c1_bool, c1_choice, c1_menu, c1_comment = c1.syms["BOOL"], \ - c1.syms["NOT_DEFINED_1"], get_choices(c1)[0], get_menus(c1)[0], \ - get_comments(c1)[0] - c2_undef, c2_bool, c2_choice, c2_menu, c2_comment = c2.syms["BOOL"], \ - c2.syms["NOT_DEFINED_1"], get_choices(c2)[0], get_menus(c2)[0], \ - get_comments(c2)[0] - - verify((c1_undef is not c2_undef) and (c1_bool is not c2_bool) and - (c1_choice is not c2_choice) and (c1_menu is not c2_menu) and - (c1_comment is not c2_comment) and - (c1_undef.kconfig is c1) and (c2_undef.kconfig is c2) and - (c1_bool.kconfig is c1) and (c2_bool.kconfig is c2) and - (c1_choice.kconfig is c1) and (c2_choice.kconfig is c2) and - (c1_menu.kconfig is c1) and (c2_menu.kconfig is c2) and - (c1_comment.kconfig is c1) and (c2_comment.kconfig is c2), - "Config instance state separation or .config is broken") + print("Testing Kconfig fetching and separation") + + for c in Kconfig("Kconfiglib/tests/Kmisc", warn=False), \ + Kconfig("Kconfiglib/tests/Kmisc", warn=False): + for item in c.syms["BOOL"], \ + c.syms["BOOL"].nodes[0], \ + c.named_choices["OPTIONAL"], \ + c.named_choices["OPTIONAL"].nodes[0], \ + c.syms["MENU_HOOK"].nodes[0].next, \ + c.syms["COMMENT_HOOK"].nodes[0].next: + verify(item.kconfig is c, + ".kconfig not properly set for " + repr(item)) print("Testing imply semantics") -- cgit v1.2.3