Lines Matching +full:i +full:- +full:leak +full:- +full:current

1 // SPDX-License-Identifier: GPL-2.0
20 #define TEMPL "/tmp/perf-test-XXXXXX" in test_file()
23 int fd, i; in test_file() local
41 for (i = 0; i < size; i++) in test_file()
42 buf[i] = (unsigned char) ((int) i % 10); in test_file()
75 .offset = DSO__DATA_CACHE_SIZE - DSO__DATA_CACHE_SIZE % 10,
81 .offset = DSO__DATA_CACHE_SIZE - DSO__DATA_CACHE_SIZE % 10,
87 .offset = TEST_FILE_SIZE - 10,
93 .offset = TEST_FILE_SIZE - 10,
99 .offset = TEST_FILE_SIZE - 3,
121 size_t i; in test__dso_data() local
133 for (i = 0; i < ARRAY_SIZE(offsets); i++) { in test__dso_data()
134 struct test_data_offset *data = &offsets[i]; in test__dso_data()
139 size = dso__data_read_offset(dso, &machine, data->offset, in test__dso_data()
142 TEST_ASSERT_VAL("Wrong size", size == data->size); in test__dso_data()
143 TEST_ASSERT_VAL("Wrong data", !memcmp(buf, data->data, 10)); in test__dso_data()
162 size == (TEST_FILE_SIZE - 10)); in test__dso_data()
164 for (i = 0; i < (size_t)size; i++) in test__dso_data()
166 buf[i] == (i % 10)); in test__dso_data()
191 if (!strcmp(dent->d_name, ".") || in open_files_cnt()
192 !strcmp(dent->d_name, "..")) in open_files_cnt()
199 return nr - 1; in open_files_cnt()
206 int i; in dsos__create() local
211 for (i = 0; i < cnt; i++) { in dsos__create()
217 dsos[i] = dso__new(file); in dsos__create()
218 TEST_ASSERT_VAL("failed to get dso", dsos[i]); in dsos__create()
226 int i; in dsos__delete() local
228 for (i = 0; i < cnt; i++) { in dsos__delete()
229 struct dso *dso = dsos[i]; in dsos__delete()
231 unlink(dso->name); in dsos__delete()
243 return -1; in set_fd_limit()
255 int dso_cnt, limit, i, fd; in test__dso_data_cache() local
271 for (i = 0; i < (dso_cnt - 1); i++) { in test__dso_data_cache()
272 struct dso *dso = dsos[i]; in test__dso_data_cache()
281 if (i % 2) { in test__dso_data_cache()
292 TEST_ASSERT_VAL("dsos[0] is not open", dsos[0]->data.fd != -1); in test__dso_data_cache()
295 fd = dso__data_fd(dsos[i], &machine); in test__dso_data_cache()
299 TEST_ASSERT_VAL("failed to close dsos[0]", dsos[0]->data.fd == -1); in test__dso_data_cache()
304 /* Make sure we did not leak any file descriptor. */ in test__dso_data_cache()
316 ret = new_limit(--count); in new_limit()
338 * - create 3 dso objects in test__dso_data_reopen()
339 * - set process file descriptor limit to current in test__dso_data_reopen()
341 * - test that the first dso gets closed when we in test__dso_data_reopen()
374 TEST_ASSERT_VAL("failed to close dso_0", dso_0->data.fd == -1); in test__dso_data_reopen()
384 TEST_ASSERT_VAL("failed to close dso_1", dso_1->data.fd == -1); in test__dso_data_reopen()
390 /* Make sure we did not leak any file descriptor. */ in test__dso_data_reopen()