test-path.c revision ca909b846976c98159a12973034bdb6ba8ba2d65
/***
This file is part of systemd.
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 <stdbool.h>
#include "unit.h"
#include "manager.h"
#include "util.h"
#include "macro.h"
#include "strv.h"
#include "mkdir.h"
#include "rm-rf.h"
typedef void (*test_function_t)(Manager *m);
static int setup_test(Manager **m) {
"directorynotempty", "makedirectory");
char **test_path;
int r;
assert_se(m);
return -EXIT_TEST_SKIP;
}
assert_se(r >= 0);
_cleanup_free_ char *p = NULL;
assert_se(p);
}
*m = tmp;
return 0;
}
static void shutdown_test(Manager *m) {
assert_se(m);
manager_free(m);
}
static void check_stop_unlink(Manager *m, Unit *unit, const char *test_path, const char *service_name) {
assert_se(m);
if (!service_name) {
} else
/* We process events until the service related to the path has been successfully started */
usec_t n;
int r;
assert_se(r >= 0);
printf("%s: state = %s; result = %s \n",
/* But we timeout if the service has not been started in the allocated time */
n = now(CLOCK_MONOTONIC);
}
}
}
static void test_path_exists(Manager *m) {
const char *test_path = "/tmp/test-path_exists";
assert_se(m);
}
static void test_path_existsglob(Manager *m) {
const char *test_path = "/tmp/test-path_existsglobFOOBAR";
assert_se(m);
}
static void test_path_changed(Manager *m) {
const char *test_path = "/tmp/test-path_changed";
FILE *f;
assert_se(m);
assert_se(f);
fclose(f);
}
static void test_path_modified(Manager *m) {
const char *test_path = "/tmp/test-path_modified";
assert_se(m);
assert_se(f);
fputs("test", f);
}
static void test_path_unit(Manager *m) {
const char *test_path = "/tmp/test-path_unit";
assert_se(m);
}
static void test_path_directorynotempty(Manager *m) {
const char *test_path = "/tmp/test-path_directorynotempty/";
assert_se(m);
/* MakeDirectory default to no */
}
static void test_path_makedirectory_directorymode(Manager *m) {
const char *test_path = "/tmp/test-path_makedirectory/";
struct stat s;
assert_se(m);
/* Check if the directory has been created */
/* Check the mode we specified with DirectoryMode=0744 */
}
test_function_t tests[] = {
NULL,
};
log_open();
int r;
/* We create a clean environment for each test */
r = setup_test(&m);
if (r < 0)
return -r;
(*test)(m);
shutdown_test(m);
}
return 0;
}