OLD | NEW |
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 #include <errno.h> | 5 #include <errno.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "sandbox/linux/seccomp-bpf/codegen.h" | 11 #include "sandbox/linux/seccomp-bpf/codegen.h" |
12 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 12 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
13 #include "sandbox/linux/tests/unit_tests.h" | 13 #include "sandbox/linux/tests/unit_tests.h" |
14 | 14 |
15 namespace playground2 { | 15 namespace sandbox { |
16 | 16 |
17 class SandboxUnittestHelper : public Sandbox { | 17 class SandboxUnittestHelper : public SandboxBPF { |
18 public: | 18 public: |
19 typedef Sandbox::Program Program; | 19 typedef SandboxBPF::Program Program; |
20 }; | 20 }; |
21 | 21 |
22 // We want to access some of the private methods in the code generator. We | 22 // We want to access some of the private methods in the code generator. We |
23 // do so by defining a "friend" that makes these methods public for us. | 23 // do so by defining a "friend" that makes these methods public for us. |
24 class CodeGenUnittestHelper : public CodeGen { | 24 class CodeGenUnittestHelper : public CodeGen { |
25 public: | 25 public: |
26 void FindBranchTargets(const Instruction& instructions, | 26 void FindBranchTargets(const Instruction& instructions, |
27 BranchTargets *branch_targets) { | 27 BranchTargets *branch_targets) { |
28 CodeGen::FindBranchTargets(instructions, branch_targets); | 28 CodeGen::FindBranchTargets(instructions, branch_targets); |
29 } | 29 } |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 assembly.append(reinterpret_cast<char *>(&insn.code), sizeof(insn.code)); | 437 assembly.append(reinterpret_cast<char *>(&insn.code), sizeof(insn.code)); |
438 assembly.append(reinterpret_cast<char *>(&insn.k), sizeof(insn.k)); | 438 assembly.append(reinterpret_cast<char *>(&insn.k), sizeof(insn.k)); |
439 } | 439 } |
440 SANDBOX_ASSERT(source == assembly); | 440 SANDBOX_ASSERT(source == assembly); |
441 } | 441 } |
442 | 442 |
443 SANDBOX_TEST(CodeGen, All) { | 443 SANDBOX_TEST(CodeGen, All) { |
444 ForAllPrograms(CompileAndCompare); | 444 ForAllPrograms(CompileAndCompare); |
445 } | 445 } |
446 | 446 |
447 } // namespace playground2 | 447 } // namespace sandbox |
OLD | NEW |