Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Side by Side Diff: sandbox/linux/seccomp-bpf/bpf_tests.h

Issue 240613003: Revert of Add seccomp sandbox for non-SFI NaCl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_BPF_TESTS_H__ 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_BPF_TESTS_H__
6 #define SANDBOX_LINUX_SECCOMP_BPF_BPF_TESTS_H__ 6 #define SANDBOX_LINUX_SECCOMP_BPF_BPF_TESTS_H__
7 7
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 26 matching lines...) Expand all
37 // BPF_TEST() takes a C++ data type as an optional fourth parameter. If 37 // BPF_TEST() takes a C++ data type as an optional fourth parameter. If
38 // present, this sets up a variable that can be accessed as "BPF_AUX". This 38 // present, this sets up a variable that can be accessed as "BPF_AUX". This
39 // variable will be passed as an argument to the "policy" function. Policies 39 // variable will be passed as an argument to the "policy" function. Policies
40 // would typically use it as an argument to SandboxBPF::Trap(), if they want to 40 // would typically use it as an argument to SandboxBPF::Trap(), if they want to
41 // communicate data between the BPF_TEST() and a Trap() function. 41 // communicate data between the BPF_TEST() and a Trap() function.
42 #define BPF_TEST(test_case_name, test_name, policy, aux...) \ 42 #define BPF_TEST(test_case_name, test_name, policy, aux...) \
43 BPF_DEATH_TEST(test_case_name, test_name, DEATH_SUCCESS(), policy, aux) 43 BPF_DEATH_TEST(test_case_name, test_name, DEATH_SUCCESS(), policy, aux)
44 44
45 // Assertions are handled exactly the same as with a normal SANDBOX_TEST() 45 // Assertions are handled exactly the same as with a normal SANDBOX_TEST()
46 #define BPF_ASSERT SANDBOX_ASSERT 46 #define BPF_ASSERT SANDBOX_ASSERT
47 #define BPF_ASSERT_EQ(x, y) BPF_ASSERT((x) == (y))
48 #define BPF_ASSERT_NE(x, y) BPF_ASSERT((x) != (y))
49 #define BPF_ASSERT_LT(x, y) BPF_ASSERT((x) < (y))
50 #define BPF_ASSERT_GT(x, y) BPF_ASSERT((x) > (y))
51 #define BPF_ASSERT_LE(x, y) BPF_ASSERT((x) <= (y))
52 #define BPF_ASSERT_GE(x, y) BPF_ASSERT((x) >= (y))
53 47
54 // The "Aux" type is optional. We use an "empty" type by default, so that if 48 // The "Aux" type is optional. We use an "empty" type by default, so that if
55 // the caller doesn't provide any type, all the BPF_AUX related data compiles 49 // the caller doesn't provide any type, all the BPF_AUX related data compiles
56 // to nothing. 50 // to nothing.
57 template <class Aux = int[0]> 51 template <class Aux = int[0]>
58 class BPFTests : public UnitTests { 52 class BPFTests : public UnitTests {
59 public: 53 public:
60 typedef Aux AuxType; 54 typedef Aux AuxType;
61 55
62 class TestArgs { 56 class TestArgs {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 107 }
114 } 108 }
115 109
116 private: 110 private:
117 DISALLOW_IMPLICIT_CONSTRUCTORS(BPFTests); 111 DISALLOW_IMPLICIT_CONSTRUCTORS(BPFTests);
118 }; 112 };
119 113
120 } // namespace sandbox 114 } // namespace sandbox
121 115
122 #endif // SANDBOX_LINUX_SECCOMP_BPF_BPF_TESTS_H__ 116 #endif // SANDBOX_LINUX_SECCOMP_BPF_BPF_TESTS_H__
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698