4 * Lib BabelTrace - Common function to all tests
6 * Copyright 2012 - Yannick Brosseau <yannick.brosseau@gmail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; under version 2 of the License.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include <babeltrace/context.h>
23 #include <babeltrace/iterator.h>
24 #include <babeltrace/compat/dirent.h>
25 #include <babeltrace/compat/limits.h>
28 struct bt_context
*create_context_with_path(const char *path
)
30 struct bt_context
*ctx
;
33 ctx
= bt_context_create();
38 ret
= bt_context_add_trace(ctx
, path
, "ctf", NULL
, NULL
, NULL
);
46 void recursive_rmdir(const char *path
)
49 DIR *dir
= opendir(path
);
56 while ((entry
= readdir(dir
))) {
58 char filename
[PATH_MAX
];
60 if (snprintf(filename
, sizeof(filename
), "%s/%s",
61 path
, entry
->d_name
) <= 0) {
65 if (stat(filename
, &st
)) {
69 if (S_ISREG(st
.st_mode
)) {
70 unlinkat(bt_dirfd(dir
), entry
->d_name
, 0);
This page took 0.030828 seconds and 4 git commands to generate.