summaryrefslogtreecommitdiffstats
path: root/sandbox/linux
diff options
context:
space:
mode:
authorjln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-30 21:12:00 +0000
committerjln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-30 21:12:00 +0000
commit45d4802d66f33c80144d8e2dd48d1f5772dd04a0 (patch)
treeef1a0dddb9ea26713c8514eae9e7047421ede191 /sandbox/linux
parentfd0a773a19c92b94a59b9207f4cc9b154f54a144 (diff)
downloadchromium_src-45d4802d66f33c80144d8e2dd48d1f5772dd04a0.zip
chromium_src-45d4802d66f33c80144d8e2dd48d1f5772dd04a0.tar.gz
chromium_src-45d4802d66f33c80144d8e2dd48d1f5772dd04a0.tar.bz2
sandbox_linux_unittests: fail if the kernel does not support BPF.
If the kernel does not support seccomp-bpf, sandbox_linux_unittests will fail. BUG=236716 Review URL: https://chromiumcodereview.appspot.com/14601002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197466 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/linux')
-rw-r--r--sandbox/linux/seccomp-bpf/bpf_tests.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/sandbox/linux/seccomp-bpf/bpf_tests.h b/sandbox/linux/seccomp-bpf/bpf_tests.h
index 680ece601..71574d5 100644
--- a/sandbox/linux/seccomp-bpf/bpf_tests.h
+++ b/sandbox/linux/seccomp-bpf/bpf_tests.h
@@ -9,6 +9,8 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include "base/third_party/valgrind/valgrind.h"
+#include "build/build_config.h"
#include "sandbox/linux/tests/unit_tests.h"
#include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
@@ -92,6 +94,13 @@ class BpfTests : public UnitTests {
arg->test()(arg->aux_);
} else {
+ // Only Android should be in the case where kernel support is not always
+ // available. Valgrind instrumentation will also prevent our tests from
+ // working.
+#if !defined(OS_ANDROID) && !defined(RUNNING_ON_VALGRIND)
+ const bool seccomp_bpf_is_supported = false;
+ BPF_ASSERT(seccomp_bpf_is_supported);
+#endif // !defined(OS_ANDROID) && !defined(RUNNING_ON_VALGRIND)
// Call the compiler and verify the policy. That's the least we can do,
// if we don't have kernel support.
playground2::Sandbox sandbox;