diff options
author | Peter Andersson <[email protected]> | 2013-04-24 14:58:06 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2013-04-24 14:58:06 +0200 |
commit | 9b4b5fd1f57819c6a3c04c563b88c0b04caba5fa (patch) | |
tree | 43e60893b6a98e159745e6405e91bac9927ffed4 /lib/common_test/src/ct_logs.erl | |
parent | c3e3b87163abebd37f1b1ef40742634ea43dfba3 (diff) | |
parent | 5e0617242fe313a6eb3ce57b71eb4a3855de2c66 (diff) | |
download | otp-9b4b5fd1f57819c6a3c04c563b88c0b04caba5fa.tar.gz otp-9b4b5fd1f57819c6a3c04c563b88c0b04caba5fa.tar.bz2 otp-9b4b5fd1f57819c6a3c04c563b88c0b04caba5fa.zip |
Merge branch 'peppe/common_test/ts_logfile_problems' into maint
* peppe/common_test/ts_logfile_problems:
Fix error with refreshing logs when html util files are missing
Add correct footer to last run index page
Make test_server close log files properly and include correct footer
Diffstat (limited to 'lib/common_test/src/ct_logs.erl')
-rw-r--r-- | lib/common_test/src/ct_logs.erl | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/lib/common_test/src/ct_logs.erl b/lib/common_test/src/ct_logs.erl index 1f8160ff03..f5355bfefe 100644 --- a/lib/common_test/src/ct_logs.erl +++ b/lib/common_test/src/ct_logs.erl @@ -200,12 +200,19 @@ clear_stylesheet(TC) -> %%%----------------------------------------------------------------- %%% @spec get_log_dir() -> {ok,Dir} | {error,Reason} get_log_dir() -> - call({get_log_dir,false}). + get_log_dir(false). %%%----------------------------------------------------------------- %%% @spec get_log_dir(ReturnAbsName) -> {ok,Dir} | {error,Reason} get_log_dir(ReturnAbsName) -> - call({get_log_dir,ReturnAbsName}). + case call({get_log_dir,ReturnAbsName}) of + {error,does_not_exist} when ReturnAbsName == true -> + {ok,filename:absname(".")}; + {error,does_not_exist} -> + {ok,"."}; + Result -> + Result + end. %%%----------------------------------------------------------------- %%% make_last_run_index() -> ok @@ -552,7 +559,6 @@ log_timestamp({MS,S,US}) -> logger(Parent, Mode, Verbosity) -> register(?MODULE,self()), - %%! Below is a temporary workaround for the limitation of %%! max one test run per second. %%! ---> @@ -984,12 +990,11 @@ print_style_error(Fd,StyleSheet,Reason) -> print_style(Fd,undefined). close_ctlog(Fd) -> - io:format(Fd,"\n</pre>\n",[]), - io:format(Fd,footer(),[]), + io:format(Fd, "\n</pre>\n", []), + io:format(Fd, [xhtml("<br><br>\n", "<br /><br />\n") | footer()], []), file:close(Fd). - %%%----------------------------------------------------------------- %%% Make an index page for the last run make_last_run_index(StartTime) -> @@ -1043,7 +1048,7 @@ make_last_run_index1(StartTime,IndexName) -> 0, 0, 0, 0, 0, Missing), %% write current Totals to file, later to be used in all_runs log write_totals_file(?totals_name,Label,Logs1,Totals), - Index = [Index0|index_footer()], + Index = [Index0|last_run_index_footer()], case force_write_file(IndexName, unicode:characters_to_binary(Index)) of ok -> @@ -1452,17 +1457,30 @@ header1(Title, SubTitle, TableCols) -> "</center>\n", SubTitleHTML,"\n"]. -index_footer() -> - ["</table>\n" +last_run_index_footer() -> + AllRuns = filename:join("../",?all_runs_name), + TestIndex = filename:join("../",?index_name), + ["</table>\n", + xhtml("<br><hr><p>\n", "<br /><hr /><p>\n"), + "<a href=\"", uri(AllRuns), + "\">Test run history\n</a> | ", + "<a href=\"", uri(TestIndex), + "\">Top level test index\n</a>\n</p>\n", "</center>\n" | footer()]. +all_suites_index_footer() -> + ["</table>\n", + "</center>\n", + xhtml("<br><br>\n", "<br /><br />\n") | footer()]. + all_runs_index_footer() -> - ["</tbody>\n</table>\n" - "</center>\n" | footer()]. + ["</tbody>\n</table>\n", + "</center>\n", + xhtml("<br><br>\n", "<br /><br />\n") | footer()]. footer() -> ["<center>\n", - xhtml("<br><br>\n<hr>\n", "<br /><br />\n"), + xhtml("<hr>\n", ""), xhtml("<p><font size=\"-1\">\n", "<div class=\"copyright\">"), "Copyright © ", year(), " <a href=\"http://www.erlang.org\">Open Telecom Platform</a>", @@ -1474,7 +1492,6 @@ footer() -> "</body>\n" "</html>\n"]. - body_tag() -> CTPath = code:lib_dir(common_test), TileFile = filename:join(filename:join(CTPath,"priv"),"tile1.jpg"), @@ -2376,7 +2393,7 @@ make_all_suites_index2(IndexName, AllTestLogDirs) -> make_all_suites_index3(AllTestLogDirs, all_suites_index_header(), 0, 0, 0, 0, 0, [], []), - Index = [Index0|index_footer()], + Index = [Index0|all_suites_index_footer()], case force_write_file(IndexName, unicode:characters_to_binary(Index)) of ok -> {ok,TempData}; @@ -2482,7 +2499,7 @@ make_all_suites_ix_temp(AbsIndexName, NewTestData, Label, AllTestLogDirs) -> Index0 = make_all_suites_ix_temp1(AllTestLogDirs1, all_suites_index_header(IndexDir), 0, 0, 0, 0, 0), - Index = [Index0|index_footer()], + Index = [Index0|all_suites_index_footer()], case force_write_file(AbsIndexName, unicode:characters_to_binary(Index)) of ok -> ok; |