Allow a wider legitimate audience to use TemporaryFile and
TemporaryDir by moving them from android-base/test_utils.h to
android-base/file.h.
Test: compile
Bug: 119313545
Change-Id: Ie558c5873ce5b3937914918b6bfb427e5b61d0da
Move the fd() function to be private since it should not have been
exposed in the first place.
Fix the way logging_test uses CapturedXXX.
Adding this because the new isolated testing doesn't print errors to
stderr so the ASSERT_ EXPECT_ messages can get swallowed. Also, it's easier
to reuse a CapturedXXX object in a test with these functions.
Test: New unit tests pass.
Change-Id: I38b113fc184146ce434802f80a9b7997fa83e78a
Some tests may create a File* by calling fdopen() on the temp file's
fd. We should release the ownership of fd in this case to avoid the
double close.
Bug: 65430057
Test: libbase unit tests pass
Change-Id: I54fcce2029f9a574f53afdbdda737ee58620c73a
Tests running in app context can't access /data/local/tmp,
so try current directory if /data/local/tmp is not accessible.
Bug: http://b/18790309
Test: run unit test in app context and shell context.
Change-Id: If66fe8f0ac3edb3a32a2a2a50a524364f818a58b
* Get it building on Win32 by implementing mkstemp() and mkdtemp().
* Run StringPrintf %z test on Windows because it passes because we build
with __USE_MINGW_ANSI_STDIO which implements %z.
Change-Id: Ia01f94e8258503381a1df6d3da6e40de59e57125
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
~ Rewrote mkdirs to be in C++ style.
~ Replaced adb_dir{start,stop} with std::string params and (r)find.
+ Added test for mkdirs.
Also make base/test_utils.h public and support temporary directories
as well as files.
Change-Id: I6fcbdc5e0099f3359d3aac6b00c436f250ca1329
Tests using files from /proc still fail on Windows (obviously), but
all tests are passing when run in Wine.
Change-Id: Ie4c3ba65b642202f8fcaec73332a53bee6115fba
ART already had a flavor of this, but it was specialized for their use
case a bit.
Note that the logging.* tests are currently disabled for the device
because there is no good way to capture the output of liblog. We can
make something that will execute logcat and then then scan the output,
but that's messy. Since we know it at least works on the host, we can
add better device tests later.
Change-Id: I47acd87a3312c0a5285b03f9c8dadef0c669f06a