tools/unittests/test_cmatch.py

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

File Facts

System
Linux kernel
Corpus path
tools/unittests/test_cmatch.py
Extension
.py
Size
28294 bytes
Lines
823
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

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

struct tx_pkt_info {
                    struct_group(tx_overhead,
                            struct tx_sop_header sop;
                            struct tx_segment_header seg;
                    );
                    struct tx_eop_header eop;
                    u16 pkt_len;
                    u16 seq_num;
            };
        """
        expected = """
            struct tx_pkt_info {
                    struct tx_sop_header sop;
                    struct tx_segment_header seg;
                    struct tx_eop_header eop;
                    u16 pkt_len;
                    u16 seq_num;
            };
        """

        result = self.apply_transforms("struct", line)
        self.assertLogicallyEqual(result, expected)

    def test_struct_group_attr(self):
        """
        Test two struct_group_attr using patterns from fs/smb/client/cifspdu.h.
        """
        line = """
            typedef struct smb_com_open_rsp {
                struct smb_hdr hdr;     /* wct = 34 BB */
                __u8 AndXCommand;
                __u8 AndXReserved;
                __le16 AndXOffset;
                __u8 OplockLevel;
                __u16 Fid;
                __le32 CreateAction;
                struct_group_attr(common_attributes,,
                    __le64 CreationTime;
                    __le64 LastAccessTime;
                    __le64 LastWriteTime;
                    __le64 ChangeTime;
                    __le32 FileAttributes;
                );
                __le64 AllocationSize;
                __le64 EndOfFile;
                __le16 FileType;
                __le16 DeviceState;
                __u8 DirectoryFlag;
                __u16 ByteCount;        /* bct = 0 */
            } OPEN_RSP;
            typedef struct {
                struct_group_attr(common_attributes,,
                    __le64 CreationTime;
                    __le64 LastAccessTime;
                    __le64 LastWriteTime;
                    __le64 ChangeTime;
                    __le32 Attributes;
                );
                __u32 Pad1;
                __le64 AllocationSize;
                __le64 EndOfFile;
                __le32 NumberOfLinks;
                __u8 DeletePending;
                __u8 Directory;
                __u16 Pad2;
                __le32 EASize;
                __le32 FileNameLength;
                union {
                    char __pad;
                    DECLARE_FLEX_ARRAY(char, FileName);

Annotation

Implementation Notes