test-unit-name.c revision 93c474725c0fb2530f093c106de0bce956544d29
/*-*- 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 "specifier.h"
#include "util.h"
#include "macro.h"
#include "path-util.h"
#include "test-helper.h"
static void test_unit_name_is_valid(void) {
}
static void test_u_n_r_i_one(const char *pattern, const char *repl, const char *expected, int ret) {
_cleanup_free_ char *t = NULL;
}
static void test_u_n_r_i(void) {
puts("-------------------------------------------------");
}
_cleanup_free_ char *t = NULL;
if (t) {
_cleanup_free_ char *k = NULL;
assert_se(unit_name_to_path(t, &k) == 0);
}
}
static void test_u_n_f_p(void) {
puts("-------------------------------------------------");
}
static void test_u_n_f_p_i_one(const char *pattern, const char *path, const char *suffix, const char *expected, int ret) {
_cleanup_free_ char *t = NULL;
if (t) {
assert_se(unit_name_to_instance(t, &k) > 0);
assert_se(unit_name_path_unescape(k, &v) == 0);
}
}
static void test_u_n_f_p_i(void) {
puts("-------------------------------------------------");
}
_cleanup_free_ char *p = NULL;
}
static void test_u_n_t_p(void) {
}
_cleanup_free_ char *t = NULL;
if (t) {
_cleanup_free_ char *k = NULL;
}
}
static void test_u_n_m(void) {
puts("-------------------------------------------------");
test_u_n_m_one("_____##@;;;,,,##----.....service", "_____\\x23\\x23@\\x3b\\x3b\\x3b\\x2c\\x2c\\x2c\\x23\\x23----.....service", 1);
}
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 *t;
free(t);
free(t);
}
static void test_unit_name_build(void) {
char *t;
free(t);
free(t);
free(t);
}
static void test_slice_name_is_valid(void) {
}
static void test_build_subslice(void) {
char *a;
char *b;
free(a);
free(b);
free(a);
free(b);
}
_cleanup_free_ char *s = NULL;
}
static void test_build_parent_slice(void) {
}
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);
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);
}
_cleanup_free_ char *f = NULL;
}
static void test_unit_name_template(void) {
}
_cleanup_free_ char *p = NULL;
}
static void test_unit_name_path_unescape(void) {
}
int rc = 0;
test_u_n_r_i();
test_u_n_f_p();
test_u_n_m();
test_u_n_t_p();
return rc;
}