aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2018-06-02 14:22:37 -0400
committerAlexei Starovoitov <ast@kernel.org>2018-06-02 14:22:37 -0400
commit25c1013e0464340aeb090a11c6d0b154bc52afd7 (patch)
treee567188ab587107f05d7faebe771de2e50ff241a /tools
parentb4b21a05b8fe7288087691e993c913a41fd6eb4b (diff)
parent8175383f2320dbc1b4e803d857ed499ed3e76199 (diff)
Merge branch 'btf-fixes'
Martin KaFai Lau says: ==================== ==================== Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/test_btf.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_btf.c b/tools/testing/selftests/bpf/test_btf.c
index 35064df688c1..3619f3023088 100644
--- a/tools/testing/selftests/bpf/test_btf.c
+++ b/tools/testing/selftests/bpf/test_btf.c
@@ -1179,6 +1179,29 @@ static struct btf_raw_test raw_tests[] = {
1179}, 1179},
1180 1180
1181{ 1181{
1182 .descr = "array test. t->size != 0\"",
1183 .raw_types = {
1184 /* int */ /* [1] */
1185 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1186 /* int[16] */ /* [2] */
1187 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ARRAY, 0, 0), 1),
1188 BTF_ARRAY_ENC(1, 1, 16),
1189 BTF_END_RAW,
1190 },
1191 .str_sec = "",
1192 .str_sec_size = sizeof(""),
1193 .map_type = BPF_MAP_TYPE_ARRAY,
1194 .map_name = "array_test_map",
1195 .key_size = sizeof(int),
1196 .value_size = sizeof(int),
1197 .key_type_id = 1,
1198 .value_type_id = 1,
1199 .max_entries = 4,
1200 .btf_load_err = true,
1201 .err_str = "size != 0",
1202},
1203
1204{
1182 .descr = "int test. invalid int_data", 1205 .descr = "int test. invalid int_data",
1183 .raw_types = { 1206 .raw_types = {
1184 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_INT, 0, 0), 4), 1207 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_INT, 0, 0), 4),
@@ -1219,6 +1242,28 @@ static struct btf_raw_test raw_tests[] = {
1219 .err_str = "Invalid btf_info", 1242 .err_str = "Invalid btf_info",
1220}, 1243},
1221 1244
1245{
1246 .descr = "fwd test. t->type != 0\"",
1247 .raw_types = {
1248 /* int */ /* [1] */
1249 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1250 /* fwd type */ /* [2] */
1251 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_FWD, 0, 0), 1),
1252 BTF_END_RAW,
1253 },
1254 .str_sec = "",
1255 .str_sec_size = sizeof(""),
1256 .map_type = BPF_MAP_TYPE_ARRAY,
1257 .map_name = "fwd_test_map",
1258 .key_size = sizeof(int),
1259 .value_size = sizeof(int),
1260 .key_type_id = 1,
1261 .value_type_id = 1,
1262 .max_entries = 4,
1263 .btf_load_err = true,
1264 .err_str = "type != 0",
1265},
1266
1222}; /* struct btf_raw_test raw_tests[] */ 1267}; /* struct btf_raw_test raw_tests[] */
1223 1268
1224static const char *get_next_str(const char *start, const char *end) 1269static const char *get_next_str(const char *start, const char *end)