Giter Club home page Giter Club logo

Comments (3)

ulfalizer avatar ulfalizer commented on May 20, 2024 1

Closing for now. Open another issue (or reopen this one, if that's possible) if you have other questions.

from kconfiglib.

ulfalizer avatar ulfalizer commented on May 20, 2024

Hello,

If you want to check that each value set in a defconfig file matches the final value the symbol gets, then you could do the following, adapted from merge_config.py:

...
kconf.load_config(defconfig_file_to_check)

# Print warnings for symbols whose actual value doesn't match the assigned
# value
for sym in kconf.defined_syms:
    # Was the symbol assigned to?
    if sym.user_value is not None:
        # Tristate values are represented as 0, 1, 2. Having them as
        # "n", "m", "y" is more convenient here, so convert.
        if sym.type in (BOOL, TRISTATE):
            user_value = TRI_TO_STR[sym.user_value]
        else:
            user_value = sym.user_value

        if user_value != sym.str_value:
            print('warning: {} was assigned the value "{}" but got the '
                  'value "{}" -- check dependencies'
                  .format(sym.name, user_value, sym.str_value))

This works fine for defconfig files, because you always expect the final value to match the assigned value in those (look up make savedefconfig -- they're a kind of "minimal" .config from which the full .config is derived). It might get a bit more iffy for old "full" .config files.

If you want to do a batch job over multiple defconfig files in the kernel, take a look at how the test_defconfig() test is implemented in the test suite. The list_undefined.py script might give you some ideas too.

from kconfiglib.

webknjaz avatar webknjaz commented on May 20, 2024

Thanks for the pointers :) I'll try

from kconfiglib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.