History log of /libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/io/FileOutputStreamTest.java
Revision Date Author Comments
27604018f783bf6354a13870b3e7785edca69b5f 28-Sep-2016 Paul Duffin <paulduffin@google.com> Detect and fix resource leakages in tests

Tests that test those classes that use CloseGuard to detect
reosurce leakages are switched to use TestCaseWithRules and
ResourceLeakageDetector.getRule() to detect any resource
leakages and the leaks fixed.

A number of tests could not be fixed due to bugs in the core
classes so a new DisableResourceLeakageDetection annotation was
added as part of this change. A method annotated with that does
not perform resource leakage detection. The affected tests were
annotated with a description and a reference to an associated
bug.

This uses try-with-resources to aid in closing resources. While
that does provide some benefits it is all too easy to change the
behavior of the test unless care is taken. To avoid that it is
important not to merge it with an existing try block such as
those which follow the following pattern:
try {... fail()} catch(..) {}
Merging them could result in the test catching and ignoring
exceptions thrown during the creation of the resource which is
almost certainly not what the test was intending.

Test: Tested with vogar and CTS
Bug: 31542223
Change-Id: Id32bb40fe04eb9719d7e6cd367abb53118b21832
b7b2b8be079b63a1473e25580eefa1566e69be1d 05-Aug-2015 Narayan Kamath <narayan@google.com> FileOutputStreamTest : Change position expectations for appendable channels.

Such channels / OutputStreams are (by definition) positioned at the end
of the file.

Change-Id: I4069f2b43cbcd4ee67d6397b3d4711cebeff0ee9
96905cbea69f50b8bab0e3d6e9d25fcae151bdb4 19-Feb-2014 Narayan Kamath <narayan@google.com> Fix remaining file related CTS Test failures.

Most failures were because tests were trying to
open files relative to the current working directory,
instead of in a temp directory.

FileTest was failing because it didn't construct
paths correctly. It would add an additional separator
char even if the path already ended with one.

bug:14895550
bug:14893836
bug:14893333

(cherry picked from commit e10c61bb13373b95ba857cc3af60f94b9941ab9e)

Change-Id: I083f6d5713fd55e44b7e14a9bef7ec136fac3ce4
19745ce89add193c0e13c18979a3c9fb25bee475 18-Feb-2014 Narayan Kamath <narayan@google.com> DO NOT MERGE Fix another set of file related tests.

- Get rid of Support_PlatformFile, use File.createTempFile
instead.
- Replace numerous uses of "user.dir" / "user.home" etc. with
File.createTempFile
- Replace calls to Process / chmod with Libcore.os.chmod. The
calls wouldn't have worked anyway, since chmod on android
doesn't understand the incremental (+w, -x) syntax.

(cherry picked from commit 2b7c83942a5e28c53698232182193d5118028e6c)

Bug: 13763685
Bug: 13763900

Change-Id: Ic6944568bbee6a548da6dcb4364b882636f2959f
d269032233558c65d93782c97b8cadfbb77b6672 19-Feb-2014 Narayan Kamath <narayan@google.com> Fix remaining file related CTS Test failures.

Most failures were because tests were trying to
open files relative to the current working directory,
instead of in a temp directory.

FileTest was failing because it didn't construct
paths correctly. It would add an additional separator
char even if the path already ended with one.

Change-Id: Ie90aed84f81275924558e9dba43d71748dbb4076
e10c61bb13373b95ba857cc3af60f94b9941ab9e 19-Feb-2014 Narayan Kamath <narayan@google.com> Fix remaining file related CTS Test failures.

Most failures were because tests were trying to
open files relative to the current working directory,
instead of in a temp directory.

FileTest was failing because it didn't construct
paths correctly. It would add an additional separator
char even if the path already ended with one.

Change-Id: Ie90aed84f81275924558e9dba43d71748dbb4076
2b7c83942a5e28c53698232182193d5118028e6c 18-Feb-2014 Narayan Kamath <narayan@google.com> Fix another set of file related tests.

- Get rid of Support_PlatformFile, use File.createTempFile
instead.
- Replace numerous uses of "user.dir" / "user.home" etc. with
File.createTempFile
- Replace calls to Process / chmod with Libcore.os.chmod. The
calls wouldn't have worked anyway, since chmod on android
doesn't understand the incremental (+w, -x) syntax.

Change-Id: Ic6944568bbee6a548da6dcb4364b882636f2959f
ab762bb740405d0fefcccf4a0899a234f995be13 15-Nov-2013 Narayan Kamath <narayan@google.com> Move tests from tests/api to harmony-tests. (Take 2)

This reverts commit d5e281743e55e1daa297fd8043b2d9b6e8e1bed2.

The makefile issue that caused the original build break
has been resolved.
d5e281743e55e1daa297fd8043b2d9b6e8e1bed2 15-Nov-2013 Narayan Kamath <narayan@google.com> Revert "Move tests from tests/api to harmony-tests."

This reverts commit 81bf28ad31131815d0a36a43a0eca3c29aefdfcd.

Breaks build

Change-Id: I3f1562921ffe8fdbec36971dd65db398c27c92db
81bf28ad31131815d0a36a43a0eca3c29aefdfcd 15-Nov-2013 Narayan Kamath <narayan@google.com> Move tests from tests/api to harmony-tests.

The vast majority of cleaned up harmony tests
are now in harmony-tests/src/test/org/apache/harmony/tests/

Change-Id: I56c2e484ff434b5618cf6751d602ae9f0db96b30