File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed
tools/testing/selftests/bpf/prog_tests Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,15 @@ BTF_ID(struct, S)
47
47
BTF_ID (union , U )
48
48
BTF_ID (func , func )
49
49
50
+ BTF_SET_START (test_set )
51
+ BTF_ID (typedef , S )
52
+ BTF_ID (typedef , T )
53
+ BTF_ID (typedef , U )
54
+ BTF_ID (struct , S )
55
+ BTF_ID (union , U )
56
+ BTF_ID (func , func )
57
+ BTF_SET_END (test_set )
58
+
50
59
static int
51
60
__resolve_symbol (struct btf * btf , int type_id )
52
61
{
@@ -116,12 +125,40 @@ int test_resolve_btfids(void)
116
125
*/
117
126
for (j = 0 ; j < ARRAY_SIZE (test_lists ); j ++ ) {
118
127
test_list = test_lists [j ];
119
- for (i = 0 ; i < ARRAY_SIZE (test_symbols ) && ! ret ; i ++ ) {
128
+ for (i = 0 ; i < ARRAY_SIZE (test_symbols ); i ++ ) {
120
129
ret = CHECK (test_list [i ] != test_symbols [i ].id ,
121
130
"id_check" ,
122
131
"wrong ID for %s (%d != %d)\n" ,
123
132
test_symbols [i ].name ,
124
133
test_list [i ], test_symbols [i ].id );
134
+ if (ret )
135
+ return ret ;
136
+ }
137
+ }
138
+
139
+ /* Check BTF_SET_START(test_set) IDs */
140
+ for (i = 0 ; i < test_set .cnt ; i ++ ) {
141
+ bool found = false;
142
+
143
+ for (j = 0 ; j < ARRAY_SIZE (test_symbols ); j ++ ) {
144
+ if (test_symbols [j ].id != test_set .ids [i ])
145
+ continue ;
146
+ found = true;
147
+ break ;
148
+ }
149
+
150
+ ret = CHECK (!found , "id_check" ,
151
+ "ID %d not found in test_symbols\n" ,
152
+ test_set .ids [i ]);
153
+ if (ret )
154
+ break ;
155
+
156
+ if (i > 0 ) {
157
+ ret = CHECK (test_set .ids [i - 1 ] > test_set .ids [i ],
158
+ "sort_check" ,
159
+ "test_set is not sorted\n" );
160
+ if (ret )
161
+ break ;
125
162
}
126
163
}
127
164
You can’t perform that action at this time.
0 commit comments