test-unit-name.c revision e1ba963fdf13f4057b9089e0c732e6c1eb69901e
/*-*- 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
Copyright 2014 Ronny Chevalier
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) {
int r;
r = manager_new(SYSTEMD_USER, true, &m);
puts("manager_new: Permission denied. Skipping test.");
return EXIT_TEST_SKIP;
}
assert_se(r == 0);
{ \
char *e; \
_cleanup_free_ char *t = NULL; \
else \
}
/* general tests */
/* normal unit */
/* templated */
manager_free(m);
return 0;
}
static void test_unit_instance_is_valid(void) {
}
static void test_unit_prefix_is_valid(void) {
}
static void test_unit_name_change_suffix(void) {
char *r;
assert_se(r);
free(r);
assert_se(r);
free(r);
}
static void test_unit_name_build(void) {
char *r;
assert_se(r);
free(r);
assert_se(r);
free(r);
assert_se(r);
free(r);
}
static void test_unit_name_is_instance(void) {
}
static void test_build_subslice(void) {
char *a;
char *b;
free(a);
free(b);
free(a);
free(b);
}
static void test_unit_name_to_instance(void) {
char *instance;
int r;
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r < 0);
}
static void test_unit_name_escape(void) {
_cleanup_free_ char *r;
r = unit_name_escape("ab+-c.a/bc@foo.service");
assert_se(r);
}
int rc = 0;
return rc;
}