diff options
author | Peter Andersson <[email protected]> | 2013-04-17 16:18:57 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2013-04-17 16:18:57 +0200 |
commit | abf2f3c8042becaec9ff2eceb95ac54d95216b54 (patch) | |
tree | e11872a1f888ab9ad7bcbdbc49a50aa181dc1804 | |
parent | 6df14788a8b62de478d636a4412ec94ebe136713 (diff) | |
parent | a61dd35475f4fb7ba94dab5d547cb98bdefb7862 (diff) | |
download | otp-abf2f3c8042becaec9ff2eceb95ac54d95216b54.tar.gz otp-abf2f3c8042becaec9ff2eceb95ac54d95216b54.tar.bz2 otp-abf2f3c8042becaec9ff2eceb95ac54d95216b54.zip |
Merge branch 'peppe/common_test/log_cache2' into maint
* peppe/common_test/log_cache2:
Bug fixes in Common Test log cache
-rw-r--r-- | lib/common_test/src/ct_logs.erl | 37 | ||||
-rw-r--r-- | lib/common_test/test/ct_test_support.erl | 3 |
2 files changed, 18 insertions, 22 deletions
diff --git a/lib/common_test/src/ct_logs.erl b/lib/common_test/src/ct_logs.erl index 2e9c714ba2..79db1ae65c 100644 --- a/lib/common_test/src/ct_logs.erl +++ b/lib/common_test/src/ct_logs.erl @@ -1011,7 +1011,7 @@ make_last_run_index(StartTime) -> make_last_run_index1(StartTime,IndexName) -> Logs1 = - case filelib:wildcard([$*|?logdir_ext],".",erl_prim_loader) of + case filelib:wildcard([$*|?logdir_ext]) of [Log] -> % first test [Log]; Logs -> @@ -1653,7 +1653,7 @@ make_all_runs_index(When) -> end end, - Dirs = filelib:wildcard(logdir_prefix()++"*.*",".",erl_prim_loader), + Dirs = filelib:wildcard(logdir_prefix()++"*.*"), DirsSorted = (catch sort_all_runs(Dirs)), LogCacheInfo = get_cache_data(UseCache), @@ -1681,12 +1681,11 @@ make_all_runs_index(When) -> if UseCache == disabled -> ok; true -> update_all_runs_in_cache(AllRunsData) end, - %% write all_runs log file - file:write_file(AbsName, - unicode:characters_to_binary( - Header++Index++ - all_runs_index_footer())) + ok = file:write_file(AbsName, + unicode:characters_to_binary( + Header++Index++ + all_runs_index_footer())) end, notify_and_unlock_file(AbsName), if When == start -> ok; @@ -1717,10 +1716,10 @@ make_all_runs_from_cache(AbsName, Dirs, LogCache) -> %% update cache with result update_all_runs_in_cache(AllRunsData,LogCache), %% write all_runs log file - file:write_file(AbsName, - unicode:characters_to_binary( - Header++Index++ - all_runs_index_footer())). + ok = file:write_file(AbsName, + unicode:characters_to_binary( + Header++Index++ + all_runs_index_footer())). update_all_runs_in_cache(AllRunsData) -> case get(ct_log_cache) of @@ -2059,8 +2058,7 @@ make_all_suites_index(When) when is_atom(When) -> end end, - LogDirs = filelib:wildcard(logdir_prefix()++".*/*"++?logdir_ext,".", - erl_prim_loader), + LogDirs = filelib:wildcard(logdir_prefix()++".*/*"++?logdir_ext), LogCacheInfo = get_cache_data(UseCache), @@ -2097,7 +2095,7 @@ make_all_suites_index(NewTestData = {_TestName,DirName}) -> %% {LastLogDir,Summary,URIs},OldDirs}|...] {AbsIndexName,LogDirData} = ct_util:get_testdata(test_index), - + CtRunDirPos = length(filename:split(AbsIndexName)), CtRunDir = filename:join(lists:sublist(filename:split(DirName), CtRunDirPos)), @@ -2199,7 +2197,7 @@ sort_and_filter_logdirs(Dirs) -> %% sort and filter directories (no cache) sort_and_filter_logdirs1([Dir|Dirs],Groups) -> TestName = filename:rootname(filename:basename(Dir)), - case filelib:wildcard(filename:join(Dir,"run.*"),".",erl_prim_loader) of + case filelib:wildcard(filename:join(Dir,"run.*")) of RunDirs = [_|_] -> Groups1 = sort_and_filter_logdirs2(TestName,RunDirs,Groups), sort_and_filter_logdirs1(Dirs,Groups1); @@ -2494,7 +2492,7 @@ insert_new_test_data({NewTestName,NewTestDir}, NewLabel, AllTestLogDirs) -> [LastLogDir|OldDirs]} | lists:keydelete(NewTestName, 1, AllTestLogDirs)]; false -> - [{NewTestName,NewLabel,[],{NewTestDir,{0,0,0,0}},undefined} | + [{NewTestName,NewLabel,[],{NewTestDir,{0,0,0,0},undefined},[]} | AllTestLogDirs] end, lists:keysort(1, AllTestLogDirs1). @@ -2502,7 +2500,6 @@ insert_new_test_data({NewTestName,NewTestDir}, NewLabel, AllTestLogDirs) -> make_all_suites_ix_temp1([{TestName,Label,Missing,LastLogDirData,OldDirs}|Rest], Result, TotSucc, TotFail, UserSkip, AutoSkip, TotNotBuilt) -> - case make_one_ix_entry_temp(TestName, LastLogDirData, Label, {true,OldDirs}, Missing) of {Result1,Succ,Fail,USkip,ASkip,NotBuilt,_URIs} -> @@ -2601,8 +2598,7 @@ try_cleanup(CTRunDir) -> %% ensure we're removing the ct_run directory case lists:reverse(filename:split(CTRunDir)) of [[$c,$t,$_,$r,$u,$n,$.|_]|_] -> - case filelib:wildcard(filename:join(CTRunDir,"ct_run.*"),".", - erl_prim_loader) of + case filelib:wildcard(filename:join(CTRunDir,"ct_run.*")) of [] -> % "double check" rm_dir(CTRunDir); _ -> @@ -2712,8 +2708,7 @@ notify_and_unlock_file(File) -> %%% @doc %%% get_run_dirs(Dir) -> - case filelib:wildcard(filename:join(Dir, "run.[1-2]*"),".", - erl_prim_loader) of + case filelib:wildcard(filename:join(Dir, "run.[1-2]*")) of [] -> false; RunDirs -> diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl index d053fa4e09..6bcac12326 100644 --- a/lib/common_test/test/ct_test_support.erl +++ b/lib/common_test/test/ct_test_support.erl @@ -250,11 +250,12 @@ run(Opts0, Config) when is_list(Opts0) -> Opts0 end end, ->>>>>>> peppe/common_test/log_cache + %% use ct interface CtRunTestResult=run_ct_run_test(Opts,Config), %% use run_test interface (simulated) ExitStatus=run_ct_script_start(Opts,Config), + check_result(CtRunTestResult,ExitStatus,Opts). run_ct_run_test(Opts,Config) -> |