tools/unittests/test_kdoc_parser.py

Source file repositories/reference/linux-study-clean/tools/unittests/test_kdoc_parser.py

File Facts

System
Linux kernel
Corpus path
tools/unittests/test_kdoc_parser.py
Extension
.py
Size
16045 bytes
Lines
561
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

int function3(char *arg1) { return 0; };
        EXPORT_SYMBOL(function3);
    """

    EXPECTED = [{
        'name': 'function3',
        'type': 'function',
        'declaration_start_line': 2,

        'sections_start_lines': {
            'Description': 4,
            'Return': 7,
        },
        'sections': {
            'Description': 'Does nothing\n\n',
            'Return': '\nalways return 0.\n'
        },

        'sections_start_lines': {
            'Description': 4,
            'Return': 7,
        },

        'parameterdescs': {'arg1': '@arg1 does nothing\n'},
        'parameterlist': ['arg1'],
        'parameterdesc_start_lines': {'arg1': 3},
        'parametertypes': {'arg1': 'char *arg1'},

        'other_stuff': {
            'func_macro': False,
            'functiontype': 'int',
            'purpose': 'Exported function',
            'typedef': False
        },
    }]

    EXPORTS = {"function3"}

    def test_parse_pass(self):
        """
        Test if export_symbol is properly handled.
        """
        self.run_test(self.SOURCE, self.EXPECTED, self.EXPORTS)

    @unittest.expectedFailure
    def test_no_exports(self):
        """
        Test if export_symbol is properly handled.
        """
        self.run_test(self.SOURCE, [], {})

    @unittest.expectedFailure
    def test_with_empty_expected(self):
        """
        Test if export_symbol is properly handled.
        """
        self.run_test(self.SOURCE, [], self.EXPORTS)

    @unittest.expectedFailure
    def test_with_unfilled_expected(self):
        """
        Test if export_symbol is properly handled.
        """
        self.run_test(self.SOURCE, [{}], self.EXPORTS)

    @unittest.expectedFailure
    def test_with_default_expected(self):
        """
        Test if export_symbol is properly handled.
        """

Annotation

Implementation Notes