am 5d804006: Merge "adb/base win32 tests: fix comment and open() flags"

* commit '5d8040060515128f2bee9b4759d0618b90c4d70c':
  adb/base win32 tests: fix comment and open() flags
This commit is contained in:
Elliott Hughes 2015-09-01 22:10:57 +00:00 committed by Android Git Automerger
commit 1428640f5c
2 changed files with 8 additions and 7 deletions

View file

@ -31,10 +31,11 @@
#include "base/test_utils.h" #include "base/test_utils.h"
// All of these tests fail on Windows because they use the C Runtime open(), // All of these tests fail on Windows because they use the C Runtime open(),
// but the adb_io APIs expect file descriptors from adb_open(). Also, the // but the adb_io APIs expect file descriptors from adb_open(). This could
// android::base file APIs use the C Runtime which uses CR/LF translation by // theoretically be fixed by making adb_read()/adb_write() fallback to using
// default (changeable with _setmode()), but the adb_io APIs use adb_read() // read()/write() if an unrecognized fd is used, and by making adb_open() return
// and adb_write() which do no translation. // fds far from the range that open() returns. But all of that might defeat the
// purpose of the tests.
TEST(io, ReadFdExactly_whole) { TEST(io, ReadFdExactly_whole) {
const char expected[] = "Foobar"; const char expected[] = "Foobar";

View file

@ -37,9 +37,9 @@ int mkstemp(char* template_name) {
return -1; return -1;
} }
// Use open() to match the close() that TemporaryFile's destructor does. // Use open() to match the close() that TemporaryFile's destructor does.
// Note that on Windows, this does CR/LF translation and _setmode() should // Use O_BINARY to match base file APIs.
// be used to change that if appropriate. return open(template_name, O_CREAT | O_EXCL | O_RDWR | O_BINARY,
return open(template_name, O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR); S_IRUSR | S_IWUSR);
} }
char* mkdtemp(char* template_name) { char* mkdtemp(char* template_name) {