[systemd-commits] 2 commits - man/systemd-detect-virt.xml src/libsystemd src/test
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Sun Oct 12 15:31:30 PDT 2014
man/systemd-detect-virt.xml | 37 ++++++++++++++-----------------
src/libsystemd/sd-bus/test-bus-cleanup.c | 22 +++++++++++++++---
src/test/test-engine.c | 2 -
src/test/test-sched-prio.c | 2 -
4 files changed, 38 insertions(+), 25 deletions(-)
New commits:
commit 654c2d478f50ffbb367dbdc3745f795fcc34574b
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Oct 12 17:27:53 2014 -0500
man: join tables in systemd-detect-virt(1)
I think it is more readable and nicer if everything is in
one table.
Also, describe what the return value, since it seems awkward to
describe the change in behaviour with --quiet before describing
what the default is.
diff --git a/man/systemd-detect-virt.xml b/man/systemd-detect-virt.xml
index eed0fe0..d8e881c 100644
--- a/man/systemd-detect-virt.xml
+++ b/man/systemd-detect-virt.xml
@@ -61,7 +61,14 @@
execution in a virtualized environment. It identifies
the virtualization technology and can distinguish full
VM virtualization from container
- virtualization.</para>
+ virtualization. <filename>systemd-detect-virt</filename>
+ exits with a return value of 0 (success) if a
+ virtualization technology is detected, and non-zero
+ (error) otherwise. By default any type of
+ virtualization is detected, and the options
+ <option>--container</option> and <option>--vm</option>
+ can be used to limit what types of virtualization are
+ detected.</para>
<para>When executed without <option>--quiet</option>
will print a short identifier for the detected
@@ -69,18 +76,23 @@
are currently identified:</para>
<table>
- <title>Known VM virtualization technologies (i.e. full hardware virtualization)</title>
- <tgroup cols='2' align='left' colsep='1' rowsep='1'>
+ <title>Known virtualization technologies (both
+ VM, i.e. full hardware virtualization,
+ and container, i.e. shared kernel virtualization)</title>
+ <tgroup cols='3' align='left' colsep='1' rowsep='1'>
+ <colspec colname="type" />
<colspec colname="id" />
<colspec colname="product" />
<thead>
<row>
+ <entry>Type</entry>
<entry>ID</entry>
- <entry>VM Product</entry>
+ <entry>Product</entry>
</row>
</thead>
<tbody>
<row>
+ <entry morerows="8">VM</entry>
<entry><varname>qemu</varname></entry>
<entry>QEMU software virtualization</entry>
</row>
@@ -125,23 +137,8 @@
<entry>User-mode Linux</entry>
</row>
- </tbody>
- </tgroup>
- </table>
-
- <table>
- <title>Known container virtualization technologies (i.e. shared kernel virtualization)</title>
- <tgroup cols='2' align='left' colsep='1' rowsep='1'>
- <colspec colname="id" />
- <colspec colname="product" />
- <thead>
- <row>
- <entry>ID</entry>
- <entry>Container Product</entry>
- </row>
- </thead>
- <tbody>
<row>
+ <entry morerows="5">container</entry>
<entry><varname>openvz</varname></entry>
<entry>OpenVZ/Virtuozzo</entry>
</row>
commit 8d1d1bf20a1a6175decff979f6b95d831e0b3fc8
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Oct 12 16:05:49 2014 -0400
tests: fix some tests to pass in koji
FAIL: test-engine
=================
Cannot find cgroup mount point: No such file or directory
Assertion 'r >= 0' failed at ../src/test/test-engine.c:46, function main(). Aborting.
FAIL: test-sched-prio
=====================
Cannot find cgroup mount point: No such file or directory
Assertion 'r >= 0' failed at ../src/test/test-sched-prio.c:42, function main(). Aborting.
FAIL: test-bus-cleanup
======================
Assertion 'sd_bus_open_system(&bus) >= 0' failed at ../src/libsystemd/sd-bus/test-bus-cleanup.c:40, function test_bus_open(). Aborting.
after new: refcount 1
diff --git a/src/libsystemd/sd-bus/test-bus-cleanup.c b/src/libsystemd/sd-bus/test-bus-cleanup.c
index e36a69f..f586880 100644
--- a/src/libsystemd/sd-bus/test-bus-cleanup.c
+++ b/src/libsystemd/sd-bus/test-bus-cleanup.c
@@ -34,11 +34,18 @@ static void test_bus_new(void) {
printf("after new: refcount %u\n", REFCNT_GET(bus->n_ref));
}
-static void test_bus_open(void) {
+static int test_bus_open(void) {
_cleanup_bus_unref_ sd_bus *bus = NULL;
+ int r;
- assert_se(sd_bus_open_system(&bus) >= 0);
+ r = sd_bus_open_system(&bus);
+ if (r == -ECONNREFUSED || r == -ENOENT)
+ return r;
+
+ assert_se(r >= 0);
printf("after open: refcount %u\n", REFCNT_GET(bus->n_ref));
+
+ return 0;
}
static void test_bus_new_method_call(void) {
@@ -70,11 +77,20 @@ static void test_bus_new_signal(void) {
}
int main(int argc, char **argv) {
+ int r;
+
log_parse_environment();
log_open();
test_bus_new();
- test_bus_open();
+ r = test_bus_open();
+ if (r < 0) {
+ log_info("Failed to connect to bus, skipping tests.");
+ return EXIT_TEST_SKIP;
+ }
+
test_bus_new_method_call();
test_bus_new_signal();
+
+ return EXIT_SUCCESS;
}
diff --git a/src/test/test-engine.c b/src/test/test-engine.c
index 1b71416..6acd394 100644
--- a/src/test/test-engine.c
+++ b/src/test/test-engine.c
@@ -39,7 +39,7 @@ int main(int argc, char *argv[]) {
/* prepare the test */
assert_se(set_unit_path(TEST_DIR) >= 0);
r = manager_new(SYSTEMD_USER, true, &m);
- if (r == -EPERM || r == -EACCES || r == -EADDRINUSE || r == -EHOSTDOWN) {
+ if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT)) {
printf("Skipping test: manager_new: %s", strerror(-r));
return EXIT_TEST_SKIP;
}
diff --git a/src/test/test-sched-prio.c b/src/test/test-sched-prio.c
index 2f559b0..6b3128d 100644
--- a/src/test/test-sched-prio.c
+++ b/src/test/test-sched-prio.c
@@ -35,7 +35,7 @@ int main(int argc, char *argv[]) {
/* prepare the test */
assert_se(set_unit_path(TEST_DIR) >= 0);
r = manager_new(SYSTEMD_USER, true, &m);
- if (r == -EPERM || r == -EACCES || r == -EADDRINUSE || r == -EHOSTDOWN) {
+ if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT)) {
printf("Skipping test: manager_new: %s", strerror(-r));
return EXIT_TEST_SKIP;
}
More information about the systemd-commits
mailing list