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

Issue 10878033: Simplified unit testing of sandboxing code. (Closed)

Created:
8 years, 3 months ago by Markus (顧孟勤)
Modified:
8 years, 3 months ago
CC:
chromium-reviews, agl, jln+watch_chromium.org
Visibility:
Public.

Description

Simplified unit testing of sandboxing code. We now have helper methods that run all tests inside their own processes. And we have another set of helpers that ensure we actually set a sandboxing policy and don't forget to start the sandbox prior to running the tests. Also simplified the handling of unexpected failure and termination of the sandbox'd process. TODO: we still don't have a good story for testing fatal errors. We will eventually need some form of exit tests. BUG=n/a TEST=sandbox_linux_unittests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=153555

Patch Set 1 #

Total comments: 12

Patch Set 2 : Addressed reviewer's comments #

Total comments: 15

Patch Set 3 : Fixed issues with how we use the gtest API #

Total comments: 6

Patch Set 4 : Refactored BPF_TEST macro and automatically start the sandbox for all tests #

Total comments: 3

Patch Set 5 : Changed "const" for "clang" #

Patch Set 6 : Add missing parameter that suppresses benign error messages #

Unified diffs Side-by-side diffs Delta from patch set Stats (+439 lines, -229 lines) Patch
M sandbox/linux/sandbox_linux.gypi View 1 2 3 3 chunks +6 lines, -0 lines 0 comments Download
M sandbox/linux/seccomp-bpf/Makefile View 1 chunk +1 line, -1 line 0 comments Download
A sandbox/linux/seccomp-bpf/bpf_tests.h View 1 2 3 4 1 chunk +56 lines, -0 lines 0 comments Download
A sandbox/linux/seccomp-bpf/bpf_tests.cc View 1 2 3 1 chunk +35 lines, -0 lines 0 comments Download
A sandbox/linux/seccomp-bpf/die.h View 1 1 chunk +47 lines, -0 lines 0 comments Download
A sandbox/linux/seccomp-bpf/die.cc View 1 1 chunk +66 lines, -0 lines 0 comments Download
M sandbox/linux/seccomp-bpf/sandbox_bpf.h View 1 5 chunks +8 lines, -44 lines 0 comments Download
M sandbox/linux/seccomp-bpf/sandbox_bpf.cc View 1 2 3 4 5 25 chunks +49 lines, -42 lines 0 comments Download
M sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc View 1 2 3 9 chunks +41 lines, -131 lines 0 comments Download
M sandbox/linux/seccomp-bpf/util.cc View 2 chunks +2 lines, -2 lines 0 comments Download
A + sandbox/linux/tests/main.cc View 1 chunk +2 lines, -0 lines 0 comments Download
A sandbox/linux/tests/unit_tests.h View 1 2 3 1 chunk +54 lines, -0 lines 0 comments Download
M sandbox/linux/tests/unit_tests.cc View 1 2 3 1 chunk +72 lines, -9 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
Markus (顧孟勤)
8 years, 3 months ago (2012-08-23 22:20:02 UTC) #1
jln (very slow on Chromium)
Looks mostly good! We can simplify die.h further to use a macro only where we ...
8 years, 3 months ago (2012-08-23 22:53:09 UTC) #2
jln (very slow on Chromium)
https://chromiumcodereview.appspot.com/10878033/diff/1/sandbox/linux/seccomp-bpf/bpf_tests.h File sandbox/linux/seccomp-bpf/bpf_tests.h (right): https://chromiumcodereview.appspot.com/10878033/diff/1/sandbox/linux/seccomp-bpf/bpf_tests.h#newcode34 sandbox/linux/seccomp-bpf/bpf_tests.h:34: } \ Please add a else branch here: // ...
8 years, 3 months ago (2012-08-24 00:24:07 UTC) #3
jln (very slow on Chromium)
https://chromiumcodereview.appspot.com/10878033/diff/1/sandbox/linux/seccomp-bpf/bpf_tests.h File sandbox/linux/seccomp-bpf/bpf_tests.h (right): https://chromiumcodereview.appspot.com/10878033/diff/1/sandbox/linux/seccomp-bpf/bpf_tests.h#newcode11 sandbox/linux/seccomp-bpf/bpf_tests.h:11: #include <vector> I think those includes are no longer ...
8 years, 3 months ago (2012-08-24 00:49:06 UTC) #4
jln (very slow on Chromium)
Before this latest revision, we had a medium bug: sandbox tests could only fail by ...
8 years, 3 months ago (2012-08-24 04:00:32 UTC) #5
jln (very slow on Chromium)
https://chromiumcodereview.appspot.com/10878033/diff/6002/sandbox/linux/tests/unit_tests.cc File sandbox/linux/tests/unit_tests.cc (right): https://chromiumcodereview.appspot.com/10878033/diff/6002/sandbox/linux/tests/unit_tests.cc#newcode61 sandbox/linux/tests/unit_tests.cc:61: HANDLE_EINTR(waitpid(pid, &status, 0)); On 2012/08/24 04:00:32, Julien Tinnes wrote: ...
8 years, 3 months ago (2012-08-24 04:02:43 UTC) #6
jln (very slow on Chromium)
https://chromiumcodereview.appspot.com/10878033/diff/6002/sandbox/linux/tests/unit_tests.cc File sandbox/linux/tests/unit_tests.cc (right): https://chromiumcodereview.appspot.com/10878033/diff/6002/sandbox/linux/tests/unit_tests.cc#newcode58 sandbox/linux/tests/unit_tests.cc:58: EXPECT_EQ(msg.size(), 0u) << std::string(msg.begin(), msg.end()); Currently, this will result ...
8 years, 3 months ago (2012-08-24 04:06:42 UTC) #7
jln (very slow on Chromium)
Ok, this time it's the last round of remarks :) https://chromiumcodereview.appspot.com/10878033/diff/6002/sandbox/linux/tests/unit_tests.cc File sandbox/linux/tests/unit_tests.cc (right): https://chromiumcodereview.appspot.com/10878033/diff/6002/sandbox/linux/tests/unit_tests.cc#newcode58 ...
8 years, 3 months ago (2012-08-24 04:26:21 UTC) #8
jln (very slow on Chromium)
I have sent you a diff for unit_tests.cc
8 years, 3 months ago (2012-08-24 04:40:40 UTC) #9
Markus (顧孟勤)
On 2012/08/24 04:40:40, Julien Tinnes wrote: > I have sent you a diff for unit_tests.cc ...
8 years, 3 months ago (2012-08-24 17:34:28 UTC) #10
jln (very slow on Chromium)
Note: this discusses unit_tests.cc there are 2 previous non addressed comments in other files. This ...
8 years, 3 months ago (2012-08-24 18:30:07 UTC) #11
jln (very slow on Chromium)
https://chromiumcodereview.appspot.com/10878033/diff/2003/sandbox/linux/seccomp-bpf/bpf_tests.h File sandbox/linux/seccomp-bpf/bpf_tests.h (right): https://chromiumcodereview.appspot.com/10878033/diff/2003/sandbox/linux/seccomp-bpf/bpf_tests.h#newcode40 sandbox/linux/seccomp-bpf/bpf_tests.h:40: void (*test())() const { return test_; } It doesn't ...
8 years, 3 months ago (2012-08-24 23:05:14 UTC) #12
jln (very slow on Chromium)
On 2012/08/24 23:05:14, Julien Tinnes wrote: > https://chromiumcodereview.appspot.com/10878033/diff/2003/sandbox/linux/seccomp-bpf/bpf_tests.h > File sandbox/linux/seccomp-bpf/bpf_tests.h (right): > > https://chromiumcodereview.appspot.com/10878033/diff/2003/sandbox/linux/seccomp-bpf/bpf_tests.h#newcode40 ...
8 years, 3 months ago (2012-08-24 23:11:16 UTC) #13
jln (very slow on Chromium)
LGTM Please: - amend the commit message, it's one giant line currently - Don't forget ...
8 years, 3 months ago (2012-08-24 23:16:47 UTC) #14
Markus (顧孟勤)
PTAL. And yes, I have officially gone crazy
8 years, 3 months ago (2012-08-25 00:20:28 UTC) #15
jln (very slow on Chromium)
On 2012/08/25 00:20:28, Markus (顧孟勤) wrote: > PTAL. And yes, I have officially gone crazy ...
8 years, 3 months ago (2012-08-27 18:00:02 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/markus@chromium.org/10878033/11005
8 years, 3 months ago (2012-08-27 19:49:20 UTC) #17
commit-bot: I haz the power
8 years, 3 months ago (2012-08-27 22:09:38 UTC) #18
Change committed as 153555

Powered by Google App Engine
This is Rietveld 408576698