diff options
author | Siri Hansen <[email protected]> | 2013-02-04 17:35:23 +0100 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2013-02-04 18:09:34 +0100 |
commit | eccb4b5b7d7a7a3aa7bb8f7e541a9d8c4257ca9f (patch) | |
tree | bfa03f0e5d9babbdb1b7ee9e7de51c313c823560 /lib/test_server/src/test_server_h.erl | |
parent | f84427d53db9843227adda945fb10ed19fc762b8 (diff) | |
download | otp-eccb4b5b7d7a7a3aa7bb8f7e541a9d8c4257ca9f.tar.gz otp-eccb4b5b7d7a7a3aa7bb8f7e541a9d8c4257ca9f.tar.bz2 otp-eccb4b5b7d7a7a3aa7bb8f7e541a9d8c4257ca9f.zip |
[test_server] Don't write unicode strings to latin1 log files
The unicode update of test_server for R16A introduced a few potential
errors when logging to files. Sometimes ~tp or ~ts was used for
formatting also when writing to files that were not opened with the
{encoding,utf8} option. If then the argument contained unicode
characters above 255, the file descriptor would crash. This has been
corrected by the following modifications:
* Since the 'unexpected_io' log file is used only when the test case
HTML file is not available (e.g. between test cases), this file is
now also a HTML file and as other test_server HTML logs it is always
UTF-8 encoded
* Since it is possible to change which information is going to which
log file (with test_server_ctrl:set_levels/3), we do not have full
control over which information is written to which file. This means
that any printout could be written to the 'major' log file
(suite.log), which was earlier encoded as latin1. To avoid crashing
this file descriptor due to unicode strings, the 'major' log file is
now also encoded in UTF-8 (possible incopatibility).
* The cross_cover.info file is no longer a text file which can be read
with file:consult/1, instead it is written as a pure binary file
using term_to_binary when writing and binary_to_term when reading.
* The encoding of the file named 'last_name', which only content is
the path to the last run.<timestamp> directory, is now dependent on
the file name mode of the VM. If file names are expected to be
unicode, then the 'last_name' file is UTF-8 encoded, else it is
latin1 encoded.
Also, ~tp is changed back to ~p unless it is somehow likely that the
argument includes strings. It is not obvious that this is the correct
thing to do, but some decission had to be taken...
Diffstat (limited to 'lib/test_server/src/test_server_h.erl')
-rw-r--r-- | lib/test_server/src/test_server_h.erl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/test_server/src/test_server_h.erl b/lib/test_server/src/test_server_h.erl index c624947306..24063ddb10 100644 --- a/lib/test_server/src/test_server_h.erl +++ b/lib/test_server/src/test_server_h.erl @@ -142,7 +142,7 @@ report_receiver(_, _) -> none. tag({M,F,A}) when is_atom(M), is_atom(F), is_integer(A) -> io:format(user, "~n=TESTCASE: ~w:~w/~w", [M,F,A]); tag(Testcase) -> - io:format(user, "~n=TESTCASE: ~tp", [Testcase]). + io:format(user, "~n=TESTCASE: ~p", [Testcase]). tag_event(Event) -> {calendar:local_time(), Event}. |