/***
This file is part of systemd.
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 <unistd.h>
#include "alloc-util.h"
#include "fd-util.h"
#include "macro.h"
#include "mount-util.h"
#include "path-util.h"
#include "rm-rf.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
}
static void test_path(void) {
{
}
}
char *p;
puts(p);
free(p);
puts(p);
free(p);
puts(p);
free(p);
}
static void test_prefixes(void) {
unsigned i;
char s[PATH_MAX];
bool b;
i = 0;
PATH_FOREACH_PREFIX_MORE(s, "/a/b/c/d") {
log_error("---%s---", s);
}
i = 1;
PATH_FOREACH_PREFIX(s, "/a/b/c/d") {
log_error("---%s---", s);
}
i = 0;
PATH_FOREACH_PREFIX_MORE(s, "////a////b////c///d///////")
i = 1;
PATH_FOREACH_PREFIX(s, "////a////b////c///d///////")
PATH_FOREACH_PREFIX(s, "////")
assert_not_reached("Wut?");
b = false;
PATH_FOREACH_PREFIX_MORE(s, "////") {
assert_se(!b);
b = true;
}
assert_se(b);
PATH_FOREACH_PREFIX(s, "")
assert_not_reached("wut?");
b = false;
PATH_FOREACH_PREFIX_MORE(s, "") {
assert_se(!b);
b = true;
}
}
static void test_path_join(void) {
_cleanup_free_ char *z = NULL; \
}
}
static void test_fsck_exists(void) {
/* Ensure we use a sane default for PATH. */
unsetenv("PATH");
/* fsck.minix is provided by util-linux and will probably exist. */
}
static void test_make_relative(void) {
char *result;
_cleanup_free_ char *z = NULL; \
}
test("//extra/////slashes///won't////fool///anybody//", "////extra///slashes////are/just///fine///", "../../../are/just/fine");
}
static void test_strv_resolve(void) {
char **d;
assert_se(p);
}
}
static void test_path_startswith(void) {
}
_cleanup_free_ char *s = NULL;
const char *t;
assert_se(s = prefix_root(r, p));
t = prefix_roota(r, p);
assert_se(t);
}
static void test_prefix_root(void) {
}
static void test_path_is_mount_point(void) {
int fd;
* layouts:
*
* <tmp>/file1, <tmp>/file2
* <tmp>/link1 -> file1, <tmp>/link2 -> file2
* <tmp>/dir1/
* <tmp>/dirlink1 -> dir1
* <tmp>/dir2/
*/
/* file mountpoints */
/* directory mountpoints */
/* file in subdirectory mountpoints */
/* these tests will only work as root */
/* files */
/* capture results in vars, to avoid dangling mounts on failure */
/* dirs */
/* its parent is a mount point, but not /file itself */
} else
printf("Skipping bind mount file test: %m\n");
}
test_path();
test_find_binary(argv[0]);
return 0;
}