[test determinator] Remove .llvm suffixes before matching the names

Reviewed By: skcho

Differential Revision: D18223663

fbshipit-source-id: eb141f4e3
master
Dulma Churchill 5 years ago committed by Facebook Github Bot
parent 2358c7b529
commit da5b319e67

@ -201,19 +201,39 @@ let java_test_to_run () =
if Typ.Procname.Set.is_empty intersection then acc else label :: acc ) if Typ.Procname.Set.is_empty intersection then acc else label :: acc )
let remove_llvm_suffix_native_symbols native_symbols =
let remove_llvm_suffix_native_symbol native_symbol =
let remove_llvm_suffix name =
(* The first dot of .llvm.... is the first dot after the name,
because neither names nor mangled names can have dots. *)
match String.lsplit2 name ~on:'.' with
| Some (name_no_suffix, _) ->
name_no_suffix
| None ->
name
in
let native_symbol_name = remove_llvm_suffix native_symbol.Clang_profiler_samples_t.name in
let native_symbol_mangled_name =
Option.map ~f:remove_llvm_suffix native_symbol.Clang_profiler_samples_t.mangled_name
in
{Clang_profiler_samples_t.name= native_symbol_name; mangled_name= native_symbol_mangled_name}
in
List.map ~f:remove_llvm_suffix_native_symbol native_symbols
let match_profiler_samples_affected_methods native_symbols affected_methods = let match_profiler_samples_affected_methods native_symbols affected_methods =
let match_samples_method affected_method = let match_samples_method affected_method =
let match_sample_method affected_method native_symbol = let match_sample_method affected_method native_symbol =
match affected_method with match affected_method with
| Some (ClangProc.CFunction {name}) -> | Some (ClangProc.CFunction {name= affected_function_name}) ->
String.equal name native_symbol.Clang_profiler_samples_t.name String.equal affected_function_name native_symbol.Clang_profiler_samples_t.name
| Some (ClangProc.ObjcMethod {mangled_name}) -> | Some (ClangProc.ObjcMethod {mangled_name= affected_method_mangled_name}) ->
String.equal mangled_name native_symbol.Clang_profiler_samples_t.name String.equal affected_method_mangled_name native_symbol.Clang_profiler_samples_t.name
| Some (ClangProc.ObjcBlock {mangled_name}) -> ( | Some (ClangProc.ObjcBlock {mangled_name= affected_block_mangled_name}) -> (
match native_symbol.Clang_profiler_samples_t.mangled_name with match native_symbol.Clang_profiler_samples_t.mangled_name with
| Some native_sym_mangled_name -> | Some native_symbol_mangled_name ->
(* Assuming mangled name is there for blocks *) (* Assuming mangled name is there for blocks *)
String.equal native_sym_mangled_name mangled_name String.equal native_symbol_mangled_name affected_block_mangled_name
| None -> | None ->
false ) false )
| _ -> | _ ->
@ -238,7 +258,9 @@ let clang_test_to_run ~clang_range_map ~source_file () =
else else
List.fold profiler_samples ~init:[] List.fold profiler_samples ~init:[]
~f:(fun acc ({test; native_symbols} : Clang_profiler_samples_t.profiler_sample) -> ~f:(fun acc ({test; native_symbols} : Clang_profiler_samples_t.profiler_sample) ->
if match_profiler_samples_affected_methods native_symbols affected_methods then test :: acc let native_symbols_no_suffix = remove_llvm_suffix_native_symbols native_symbols in
if match_profiler_samples_affected_methods native_symbols_no_suffix affected_methods then
test :: acc
else acc ) else acc )

@ -57,7 +57,7 @@
"field4": {}, "field4": {},
"native_symbols": [ "native_symbols": [
{ {
"name": "-[Person printName]" "name": "-[Person printName].llvm.145683357567"
}, },
{ {
"name": "exampleMethod3" "name": "exampleMethod3"

Loading…
Cancel
Save