Add missing #include of eintr_wrapper.h to auto_testfile.h. Since it's

Linux-specific, shuffle the files around a bit.

(The implementation is actually POSIX-specific, but it's currently only used
on Linux.)

R=blundell@chromium.org

Review URL: https://breakpad.appspot.com/804002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1240 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mark@chromium.org 2013-12-03 19:01:17 +00:00
parent 036dec3ecc
commit 8a0b196e22
4 changed files with 16 additions and 19 deletions

View file

@ -36,7 +36,7 @@
#include "breakpad_googletest_includes.h"
#include "client/linux/minidump_writer/cpu_set.h"
#include "common/tests/auto_testfile.h"
#include "common/linux/tests/auto_testfile.h"
using namespace google_breakpad;

View file

@ -33,7 +33,7 @@
#include "client/linux/minidump_writer/line_reader.h"
#include "breakpad_googletest_includes.h"
#include "common/tests/auto_testfile.h"
#include "common/linux/tests/auto_testfile.h"
using namespace google_breakpad;

View file

@ -36,7 +36,7 @@
#include "client/linux/minidump_writer/proc_cpuinfo_reader.h"
#include "breakpad_googletest_includes.h"
#include "common/tests/auto_testfile.h"
#include "common/linux/tests/auto_testfile.h"
using namespace google_breakpad;

View file

@ -28,25 +28,24 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Utility class for creating a temporary file for unit tests
// that is deleted in the destructor. Only supported on Posix systems.
#ifndef GOOGLE_BREAKPAD_COMMON_TESTS_AUTO_TESTFILE
#define GOOGLE_BREAKPAD_COMMON_TESTS_AUTO_TESTFILE
// that is deleted in the destructor.
#ifndef GOOGLE_BREAKPAD_COMMON_LINUX_TESTS_AUTO_TESTFILE
#define GOOGLE_BREAKPAD_COMMON_LINUX_TESTS_AUTO_TESTFILE
#include <unistd.h>
#include <sys/types.h>
#include <string>
#include "breakpad_googletest_includes.h"
#include "common/linux/eintr_wrapper.h"
#include "common/tests/auto_tempdir.h"
namespace google_breakpad {
#ifdef _WIN32
#error "This header cannot be used on Windows"
#else
class AutoTestFile {
public:
public:
// Create a new empty test file.
// test_prefix: (input) test-specific prefix, can't be NULL.
explicit AutoTestFile(const char* test_prefix) {
@ -89,13 +88,13 @@ public:
return fd_;
}
private:
private:
void Init(const char* test_prefix) {
fd_ = -1;
char path_templ[PATH_MAX];
int ret = snprintf(path_templ, sizeof(path_templ),
TEMPDIR "/%s-unittest.XXXXXX",
test_prefix);
TEMPDIR "/%s-unittest.XXXXXX",
test_prefix);
if (ret >= static_cast<int>(sizeof(path_templ)))
return;
@ -107,8 +106,8 @@ private:
}
void WriteText(const char* text, size_t text_len) {
int r = HANDLE_EINTR(write(fd_, text, text_len));
if (r != static_cast<int>(text_len)) {
ssize_t r = HANDLE_EINTR(write(fd_, text, text_len));
if (r != static_cast<ssize_t>(text_len)) {
close(fd_);
fd_ = -1;
return;
@ -120,8 +119,6 @@ private:
int fd_;
};
#endif // !_WIN32
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_COMMON_TESTS_AUTO_TESTFILE
#endif // GOOGLE_BREAKPAD_COMMON_LINUX_TESTS_AUTO_TESTFILE