1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 18:55:40 +03:00

Merge pull request 3821 from davide125/fix-tests

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-07-31 22:01:43 -04:00
commit ce5fcc695e
4 changed files with 25 additions and 6 deletions

View File

@ -25,6 +25,7 @@
#include "audit-util.h"
#include "condition.h"
#include "hostname-util.h"
#include "id128-util.h"
#include "ima-util.h"
#include "log.h"
#include "macro.h"
@ -142,9 +143,14 @@ static void test_condition_test_host(void) {
hostname = gethostname_malloc();
assert_se(hostname);
condition = condition_new(CONDITION_HOST, hostname, false, false);
assert_se(condition_test(condition));
condition_free(condition);
/* if hostname looks like an id128 then skip testing it */
if (id128_is_valid(hostname))
log_notice("hostname is an id128, skipping test");
else {
condition = condition_new(CONDITION_HOST, hostname, false, false);
assert_se(condition_test(condition));
condition_free(condition);
}
}
static void test_condition_test_architecture(void) {

View File

@ -33,6 +33,7 @@
#include "test-helper.h"
#include "unit.h"
#include "util.h"
#include "virt.h"
typedef void (*test_function_t)(Manager *m);
@ -111,6 +112,10 @@ static void test_exec_privatetmp(Manager *m) {
}
static void test_exec_privatedevices(Manager *m) {
if (detect_container() > 0) {
log_notice("testing in container, skipping private device tests");
return;
}
test(m, "exec-privatedevices-yes.service", 0, CLD_EXITED);
test(m, "exec-privatedevices-no.service", 0, CLD_EXITED);
}

View File

@ -40,6 +40,7 @@
#include "stdio-util.h"
#include "string-util.h"
#include "terminal-util.h"
#include "test-helper.h"
#include "util.h"
#include "virt.h"
@ -357,7 +358,7 @@ int main(int argc, char *argv[]) {
(void) parse_pid(argv[1], &pid);
test_get_process_comm(pid);
} else {
test_get_process_comm(1);
TEST_REQ_RUNNING_SYSTEMD(test_get_process_comm(1));
test_get_process_comm(getpid());
}

View File

@ -1535,11 +1535,18 @@ if (!($<==0)) {
exit($EXIT_TEST_SKIP);
}
# skip the test when running in a chroot
system("systemd-detect-virt", "-r", "-q");
if ($? >> 8 == 0) {
print "Running in a chroot, skipping the test.\n";
exit($EXIT_TEST_SKIP);
}
# skip the test when running in a container
system("systemd-detect-virt", "-c", "-q");
if ($? >> 8 == 0) {
print "Running in a container, skipping the test.\n";
exit($EXIT_TEST_SKIP);
print "Running in a container, skipping the test.\n";
exit($EXIT_TEST_SKIP);
}
udev_setup();