test-unit-name.c revision f78e6385dc4cee0a1f399c4c89ebf823c108d447
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2012 Lennart Poettering
Copyright 2013 Zbigniew Jędrzejewski-Szmek
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include "manager.h"
#include "unit.h"
#include "unit-name.h"
#include "unit-printf.h"
#include "install.h"
#include "specifier.h"
#include "util.h"
#include "macro.h"
#include "test-helper.h"
static void test_replacements(void) {
{ \
_cleanup_free_ char *t = \
puts(t); \
}
puts("-------------------------------------------------");
{ \
_cleanup_free_ char *k, *t = \
puts(t); \
k = unit_name_to_path(t); \
puts(k); \
}
puts("-------------------------------------------------");
{ \
_cleanup_free_ char *t = \
puts(t); \
}
puts("-------------------------------------------------");
{ \
_cleanup_free_ char *k, *t; \
puts(t); \
}
expect("/home");
expect("foobar-meh...waldi.service");
expect("_____####----.....service");
expect("_____##@;;;,,,##----.....service");
}
static int test_unit_printf(void) {
Manager *m;
int r;
r = manager_new(SYSTEMD_USER, &m);
puts("manager_new: Permission denied. Skipping test.");
return EXIT_TEST_SKIP;
}
assert(r == 0);
{ \
char *e; \
_cleanup_free_ char *t; \
else \
}
/* general tests */
/* normal unit */
/* templated */
manager_free(m);
return 0;
}
int rc = 0;
return rc;
}