]> err.no Git - systemd/commitdiff
test/test-functions: add check_qemu() and check_nspawn() functions
authorHarald Hoyer <harald@redhat.com>
Fri, 25 May 2012 16:31:58 +0000 (18:31 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 29 May 2012 07:23:37 +0000 (09:23 +0200)
test/test-functions

index 84ce1e9475a85aa8af87d278e0dc03b5862ba49c..5fdf0a18bd72679662cf5dc8ab82cad45ca76d9c 100644 (file)
@@ -574,22 +574,21 @@ inst_libdir_file() {
     fi
 }
 
+check_qemu() {
+    command -v qemu-kvm &>/dev/null && [[ -c /dev/kvm ]]
+}
+
+check_nspawn() {
+    [[ -d /sys/fs/cgroup/systemd ]]
+}
+
+
 do_test() {
     if [[ $UID != "0" ]]; then
         echo "TEST: $TEST_DESCRIPTION [SKIPPED]: not root" >&2
         exit 0
     fi
 
-    if ! command -v qemu-kvm &>/dev/null; then
-        echo "TEST: $TEST_DESCRIPTION [SKIPPED]: no qemu-kvm found" >&2
-        exit 0
-    fi
-
-    if ! [[ -c /dev/kvm ]]; then
-        echo "TEST: $TEST_DESCRIPTION [SKIPPED]: /dev/kvm not found" >&2
-        exit 0
-    fi
-
 # Detect lib paths
     [[ $libdir ]] || for libdir in /lib64 /lib; do
         [[ -d $libdir ]] && libdirs+=" $libdir" && break