mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-15 22:31:47 -04:00
perf test dso-data: Correctly free test file in read test
The DSO data read test opens a file but as dsos__exit is used the test file isn't closed. This causes the subsequent subtests in don't fork (-F) mode to fail as one more than expected file descriptor is open. Signed-off-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20250318043151.137973-4-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
@@ -114,6 +114,17 @@ static int dso__data_fd(struct dso *dso, struct machine *machine)
|
||||
return fd;
|
||||
}
|
||||
|
||||
static void dsos__delete(struct dsos *dsos)
|
||||
{
|
||||
for (unsigned int i = 0; i < dsos->cnt; i++) {
|
||||
struct dso *dso = dsos->dsos[i];
|
||||
|
||||
dso__data_close(dso);
|
||||
unlink(dso__name(dso));
|
||||
}
|
||||
dsos__exit(dsos);
|
||||
}
|
||||
|
||||
static int test__dso_data(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
|
||||
{
|
||||
struct machine machine;
|
||||
@@ -172,7 +183,7 @@ static int test__dso_data(struct test_suite *test __maybe_unused, int subtest __
|
||||
}
|
||||
|
||||
dso__put(dso);
|
||||
dsos__exit(&machine.dsos);
|
||||
dsos__delete(&machine.dsos);
|
||||
unlink(file);
|
||||
return 0;
|
||||
}
|
||||
@@ -222,17 +233,6 @@ static int dsos__create(int cnt, int size, struct dsos *dsos)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dsos__delete(struct dsos *dsos)
|
||||
{
|
||||
for (unsigned int i = 0; i < dsos->cnt; i++) {
|
||||
struct dso *dso = dsos->dsos[i];
|
||||
|
||||
dso__data_close(dso);
|
||||
unlink(dso__name(dso));
|
||||
}
|
||||
dsos__exit(dsos);
|
||||
}
|
||||
|
||||
static int set_fd_limit(int n)
|
||||
{
|
||||
struct rlimit rlim;
|
||||
|
||||
Reference in New Issue
Block a user