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

Side by Side Diff: util/test/multiprocess_exec.cc

Issue 615923004: Convert COMPILE_ASSERT to static_assert (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: fixes Created 6 years, 2 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
« no previous file with comments | « util/stdlib/strlcpy_test.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 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 argv_.push_back(command_.c_str()); 65 argv_.push_back(command_.c_str());
66 for (const std::string& argument : arguments_) { 66 for (const std::string& argument : arguments_) {
67 argv_.push_back(argument.c_str()); 67 argv_.push_back(argument.c_str());
68 } 68 }
69 argv_.push_back(NULL); 69 argv_.push_back(NULL);
70 } 70 }
71 71
72 void MultiprocessExec::MultiprocessChild() { 72 void MultiprocessExec::MultiprocessChild() {
73 // Make sure that stdin, stdout, and stderr are FDs 0, 1, and 2, respectively. 73 // Make sure that stdin, stdout, and stderr are FDs 0, 1, and 2, respectively.
74 // All FDs above this will be closed. 74 // All FDs above this will be closed.
75 COMPILE_ASSERT(STDIN_FILENO == 0, stdin_must_be_fd_0); 75 static_assert(STDIN_FILENO == 0, "stdin must be fd 0");
76 COMPILE_ASSERT(STDOUT_FILENO == 1, stdout_must_be_fd_1); 76 static_assert(STDOUT_FILENO == 1, "stdout must be fd 1");
77 COMPILE_ASSERT(STDERR_FILENO == 2, stderr_must_be_fd_2); 77 static_assert(STDERR_FILENO == 2, "stderr must be fd 2");
78 78
79 // Move the read pipe to stdin. 79 // Move the read pipe to stdin.
80 int read_fd = ReadPipeFD(); 80 int read_fd = ReadPipeFD();
81 ASSERT_NE(read_fd, STDIN_FILENO); 81 ASSERT_NE(read_fd, STDIN_FILENO);
82 ASSERT_NE(read_fd, STDOUT_FILENO); 82 ASSERT_NE(read_fd, STDOUT_FILENO);
83 ASSERT_EQ(STDIN_FILENO, fileno(stdin)); 83 ASSERT_EQ(STDIN_FILENO, fileno(stdin));
84 84
85 int rv = fpurge(stdin); 85 int rv = fpurge(stdin);
86 ASSERT_EQ(0, rv) << ErrnoMessage("fpurge"); 86 ASSERT_EQ(0, rv) << ErrnoMessage("fpurge");
87 87
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 IGNORE_EINTR(close(STDOUT_FILENO)); 136 IGNORE_EINTR(close(STDOUT_FILENO));
137 HANDLE_EINTR(dup2(dup_orig_stdout_fd, STDOUT_FILENO)); 137 HANDLE_EINTR(dup2(dup_orig_stdout_fd, STDOUT_FILENO));
138 IGNORE_EINTR(close(dup_orig_stdout_fd)); 138 IGNORE_EINTR(close(dup_orig_stdout_fd));
139 139
140 forbid_return.Disarm(); 140 forbid_return.Disarm();
141 FAIL() << ErrnoMessage("execv") << ": " << argv_[0]; 141 FAIL() << ErrnoMessage("execv") << ": " << argv_[0];
142 } 142 }
143 143
144 } // namespace test 144 } // namespace test
145 } // namespace crashpad 145 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/stdlib/strlcpy_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698