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