Commit | Line | Data |
---|---|---|
aa968dde YB |
1 | /* |
2 | * common.c | |
3 | * | |
4 | * Lib BabelTrace - Common function to all tests | |
5 | * | |
6 | * Copyright 2012 - Yannick Brosseau <yannick.brosseau@gmail.com> | |
7 | * | |
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. | |
11 | * | |
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. | |
16 | * | |
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. | |
20 | */ | |
aa968dde YB |
21 | |
22 | #include <babeltrace/context.h> | |
23 | #include <babeltrace/iterator.h> | |
24 | ||
25 | struct bt_context *create_context_with_path(const char *path) | |
26 | { | |
27 | struct bt_context *ctx; | |
28 | int ret; | |
29 | ||
30 | ctx = bt_context_create(); | |
31 | if (!ctx) { | |
32 | return NULL; | |
33 | } | |
34 | ||
35 | ret = bt_context_add_trace(ctx, path, "ctf", NULL, NULL, NULL); | |
36 | if (ret < 0) { | |
37 | bt_context_put(ctx); | |
38 | return NULL; | |
39 | } | |
40 | return ctx; | |
41 | } |