diff options
author | Peter Andersson <[email protected]> | 2011-04-28 22:49:06 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2011-04-28 22:49:18 +0200 |
commit | 9051df48646573dbb740b16396bf9b55be288525 (patch) | |
tree | b53b8fb8fefecabacbc4eb75a3c6132f1795b365 /lib/test_server/src/test_server_ctrl.erl | |
parent | 3e815447cafbcb704bac1fac3d195e94def7080f (diff) | |
parent | b2591419882ee3b070c5da532597efc15d3a0535 (diff) | |
download | otp-9051df48646573dbb740b16396bf9b55be288525.tar.gz otp-9051df48646573dbb740b16396bf9b55be288525.tar.bz2 otp-9051df48646573dbb740b16396bf9b55be288525.zip |
Merge branch 'peppe/common_test/r14b03_tickets' into dev
* peppe/common_test/r14b03_tickets:
Have test_server locate the source code file for a test suite module if it's not in the same directory as the beam file.
Fix error in vts mode, making it impossible to execute suites with test case groups.
Fix problem with merging ticket branch.
Fix problems with timetrap handling in common_test: 1. ct:timetrap(infinity) not supported. 2. Previous set timetrap for a test case is not cancelled by new one.
Document the new init_per_testcase return value.
Make it possible to fail test case by returning {fail,Reason} from init_per_testcase.
Fix problem with merging a ticket branch.
Fix issues related to test case groups: 1. Allow empty group to be specified without generating an error. 2. Sort out potential problem with unnecessary call to delete_subs/2.
Add test case for suite with empty group.
Improve validation of test events.
Fix failing tests on Windows.
Make it possible to refresh the top level index page at the start of a test run.
Fix problem with CT hook start error causing IO to be sent to wrong group leader process.
Do minor updates of the ts test framework.
Correct failing test cases.
OTP-9233
OTP-9210
OTP-9195
OTP-9161
OTP-9160
OTP-9159
OTP-9138
Diffstat (limited to 'lib/test_server/src/test_server_ctrl.erl')
-rw-r--r-- | lib/test_server/src/test_server_ctrl.erl | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl index 30d7314058..de9b962dfc 100644 --- a/lib/test_server/src/test_server_ctrl.erl +++ b/lib/test_server/src/test_server_ctrl.erl @@ -1812,6 +1812,9 @@ start_log_file() -> ok = file:make_dir(PrivDir), put(test_server_priv_dir,PrivDir++"/"), print_timestamp(13,"Suite started at "), + + LogInfo = [{topdir,Dir},{rundir,lists:flatten(TestDir)}], + test_server_sup:framework_call(report, [loginfo,LogInfo]), ok. make_html_link(LinkName, Target, Explanation) -> @@ -1925,7 +1928,6 @@ html_convert_modules(TestSpec, _Config) -> copy_html_files(get(test_server_dir), get(test_server_log_dir_base)). %% Retrieve a list of modules out of the test spec. - html_isolate_modules(List) -> html_isolate_modules(List, sets:new()). html_isolate_modules([], Set) -> sets:to_list(Set); @@ -1939,37 +1941,56 @@ html_isolate_modules([{Mod,_Case,_Args}|Cases], Set) -> html_isolate_modules(Cases, sets:add_element(Mod, Set)). %% Given a list of modules, convert each module's source code to HTML. - html_convert_modules([Mod|Mods]) -> case code:which(Mod) of Path when is_list(Path) -> SrcFile = filename:rootname(Path) ++ ".erl", - DestDir = get(test_server_dir), - Name = atom_to_list(Mod), - DestFile = filename:join(DestDir, downcase(Name) ++ ?src_listing_ext), - html_possibly_convert(SrcFile, DestFile), - html_convert_modules(Mods); - _Other -> ok + FoundSrcFile = + case file:read_file_info(SrcFile) of + {ok,SInfo} -> + {SrcFile,SInfo}; + {error,_} -> + ModInfo = Mod:module_info(compile), + case proplists:get_value(source, ModInfo) of + undefined -> + undefined; + OtherSrcFile -> + case file:read_file_info(OtherSrcFile) of + {ok,SInfo} -> + {OtherSrcFile,SInfo}; + {error,_} -> + undefined + end + end + end, + case FoundSrcFile of + undefined -> + html_convert_modules(Mods); + {SrcFile1,SrcFileInfo} -> + DestDir = get(test_server_dir), + Name = atom_to_list(Mod), + DestFile = filename:join(DestDir, + downcase(Name)++?src_listing_ext), + html_possibly_convert(SrcFile1, SrcFileInfo, DestFile), + html_convert_modules(Mods) + end; + _Other -> + html_convert_modules(Mods) end; html_convert_modules([]) -> ok. %% Convert source code to HTML if possible and needed. - -html_possibly_convert(Src, Dest) -> - case file:read_file_info(Src) of - {ok,SInfo} -> - case file:read_file_info(Dest) of - {error,_Reason} -> % no dest file - erl2html2:convert(Src, Dest); - {ok,DInfo} when DInfo#file_info.mtime < SInfo#file_info.mtime -> - erl2html2:convert(Src, Dest); - {ok,_DInfo} -> ok % dest file up to date - end; - {error,_Reason} -> ok % no source code found +html_possibly_convert(Src, SrcInfo, Dest) -> + case file:read_file_info(Dest) of + {error,_Reason} -> % no dest file + erl2html2:convert(Src, Dest); + {ok,DestInfo} when DestInfo#file_info.mtime < SrcInfo#file_info.mtime -> + erl2html2:convert(Src, Dest); + {ok,_DestInfo} -> + ok % dest file up to date end. %% Copy all HTML files in InDir to OutDir. - copy_html_files(InDir, OutDir) -> Files = filelib:wildcard(filename:join(InDir, "*" ++ ?src_listing_ext)), lists:foreach(fun (Src) -> copy_html_file(Src, OutDir) end, Files). |