Commit 71db5e4b authored by jln@chromium.org's avatar jln@chromium.org

Linux sandbox unit test: log BPF support

Write whether or not the kernel supports seccomp BPF on stdout
when running unit tests.


Review URL: https://chromiumcodereview.appspot.com/10834075

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149233 0039d316-1c4b-4281-b951-d872f2087c98
parent 132e281a
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <ostream>
#include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
#include "sandbox/linux/seccomp-bpf/verifier.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -15,7 +17,15 @@ const int kExpectedReturnValue = 42;
TEST(SandboxBpf, CallSupports) {
// We check that we don't crash, but it's ok if the kernel doesn't
// support it.
Sandbox::supportsSeccompSandbox(-1);
bool seccomp_bpf_supported =
Sandbox::supportsSeccompSandbox(-1) == Sandbox::STATUS_AVAILABLE;
// We want to log whether or not seccomp BPF is actually supported
// since actual test coverage depends on it.
RecordProperty("SeccompBPFSupported",
seccomp_bpf_supported ? "true." : "false.");
std::cout << "Seccomp BPF supported: "
<< (seccomp_bpf_supported ? "true." : "false.")
<< "\n";
}
TEST(SandboxBpf, CallSupportsTwice) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment