]>
git.proxmox.com Git - mirror_lxc.git/blob - src/tests/lxcpath.c
3 * Copyright © 2012 Serge Hallyn <serge.hallyn@ubuntu.com>.
4 * Copyright © 2012 Canonical Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include <lxc/lxccontainer.h>
24 #include <sys/types.h>
30 #define MYNAME "lxctest1"
32 #define TSTERR(x) do { \
33 fprintf(stderr, "%d: %s\n", __LINE__, x); \
38 struct lxc_container
*c
;
42 c
= lxc_container_new(MYNAME
, NULL
);
44 TSTERR("create using default path");
47 p1
= c
->get_config_path(c
);
48 p2
= c
->config_file_name(c
);
49 if (!p1
|| !p2
|| strncmp(p1
, p2
, strlen(p1
))) {
50 TSTERR("Bad result for path names");
55 #define FPATH "/boo/lxctest1/config"
56 if (!c
->set_config_path(c
, "/boo")) {
57 TSTERR("Error setting custom path");
60 p1
= c
->get_config_path(c
);
61 p2
= c
->config_file_name(c
);
62 if (strcmp(p1
, CPATH
) || strcmp(p2
, FPATH
)) {
63 TSTERR("Bad result for path names after set_config_path()");
68 c
= lxc_container_new(MYNAME
, CPATH
);
70 TSTERR("create using custom path");
74 p1
= c
->get_config_path(c
);
75 p2
= c
->config_file_name(c
);
76 if (strcmp(p1
, CPATH
) || strcmp(p2
, FPATH
)) {
77 TSTERR("Bad result for path names after create with custom path");