Merge pull request 3821 from davide125/fix-tests
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 1 Aug 2016 02:01:43 +0000 (22:01 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 1 Aug 2016 02:06:09 +0000 (22:06 -0400)
1  2 
src/test/test-condition.c
test/udev-test.pl

@@@ -142,9 -143,14 +143,14 @@@ static void test_condition_test_host(vo
          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)) {
++        if (id128_is_valid(hostname))
+                 log_notice("hostname is an id128, skipping test");
 -        } else {
++        else {
+                 condition = condition_new(CONDITION_HOST, hostname, false, false);
+                 assert_se(condition_test(condition));
+                 condition_free(condition);
+         }
  }
  
  static void test_condition_test_architecture(void) {
@@@ -1535,11 -1535,18 +1535,18 @@@ if (!($<==0)) 
          exit($EXIT_TEST_SKIP);
  }
  
 -    print "Running in a chroot, skipping the test.\n";
 -    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();