Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:03 -0000
From:      Enji Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r345759 - projects/capsicum-test/contrib/capsicum-test
Message-ID:  <201903312318.x2VNICvp070401@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sun Mar 31 23:18:12 2019
New Revision: 345759
URL: https://svnweb.freebsd.org/changeset/base/345759

Log:
  Apply suggestions
  
  * Sort preprocessor define blocks.
  * Reword messages when skipping due to missing prereqs.
  Requested by: emaste (https://github.com/google/capsicum-test/pull/42)
  * Remove diagnostic `std::cerr`'s, since the root-cause for the checks not
    working before was found and addressed in D19765.

Modified:
  projects/capsicum-test/contrib/capsicum-test/capsicum-test-main.cc

Modified: projects/capsicum-test/contrib/capsicum-test/capsicum-test-main.cc
==============================================================================
--- projects/capsicum-test/contrib/capsicum-test/capsicum-test-main.cc	Sun Mar 31 21:34:58 2019	(r345758)
+++ projects/capsicum-test/contrib/capsicum-test/capsicum-test-main.cc	Sun Mar 31 23:18:12 2019	(r345759)
@@ -1,9 +1,9 @@
 #include <sys/types.h>
-#ifdef __linux__
+#if defined(__FreeBSD__)
+#include <sys/sysctl.h>
+#elif defined(__linux__)
 #include <sys/vfs.h>
 #include <linux/magic.h>
-#elif defined(__FreeBSD__)
-#include <sys/sysctl.h>
 #endif
 #include <ctype.h>
 #include <errno.h>
@@ -47,10 +47,8 @@ class SetupEnvironment : public ::testing::Environment
     trap_enotcap_enabled_len = sizeof(trap_enotcap_enabled);
 
     if (feature_present("security_capabilities") == 0) {
-      GTEST_SKIP() << "Tests require a CAPABILITIES enabled kernel";
-    } else {
-      std::cerr << "Running on a CAPABILITIES enabled kernel - OK!"
-                << std::endl;
+      GTEST_SKIP() << "Skipping tests because capsicum support is not "
+                   << "enabled in the kernel.";
     }
     const char *oid = "kern.trap_enotcap";
     rc = sysctlbyname(oid, &trap_enotcap_enabled, &trap_enotcap_enabled_len,
@@ -61,8 +59,6 @@ class SetupEnvironment : public ::testing::Environment
     if (trap_enotcap_enabled) {
       GTEST_SKIP() << "Sysctl " << oid << " enabled. "
                    << "Skipping tests to avoid non-determinism with results";
-    } else {
-      std::cerr << "Sysctl " << oid << " not enabled - OK!" << std::endl;
     }
 #endif /* FreeBSD */
 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903312318.x2VNICvp070401>