Permalink
Browse files

Remove remaining third-party:core references in test/

Reviewed By: kmeht

Differential Revision: D10286946

fbshipit-source-id: bfc93c36834a426f46040206afc38f6dadeffc03
  • Loading branch information...
vassilmladenov authored and hhvm-bot committed Oct 11, 2018
1 parent 1bdb687 commit bca11f77847842d5c272847bd3f56e764c8df083
@@ -1,4 +1,4 @@
open Hh_core
open Core_kernel
module Tools = struct
@@ -48,15 +48,15 @@ type config = {
(** Invoke a subprocess on the harness's repo with its environment. *)
let exec_hh_client args harness =
Printf.eprintf "executing hh_client. Args: %s\n%!"
(String.concat ", " args);
(String.concat ~sep:", " args);
Process.exec_with_replacement_env harness.hh_client_path
~env:harness.test_env (args @ [Path.to_string harness.repo_dir])
let get_server_logs harness =
let process = exec_hh_client ["--logname"] harness in
match Process.read_and_wait_pid ~timeout:5 process with
| Ok {Process_types.stdout; _} ->
let log_path = Path.make (String.trim stdout) in
let log_path = Path.make (String.strip stdout) in
(try Some (Sys_utils.cat (Path.to_string log_path)) with
| Sys_error(m)
when Sys_utils.string_contains m "No such file or directory" ->
@@ -81,7 +81,7 @@ let get_recording_path harness =
(Path.make (Str.matched_group 1 logs)),
(Path.make (Str.matched_group 2 logs)))
end with
| Not_found ->
| Caml.Not_found ->
Printf.eprintf "recorder path or lock file not found\n%!";
Printf.eprintf "See also server logs: %s\n%!" logs;
None
@@ -8,7 +8,7 @@
*
*)
open Hh_core
open Core_kernel
open Integration_test_base_types
open Reordered_argument_collections
open ServerCommandTypes
@@ -172,16 +172,16 @@ let prepend_root x = root ^ x
let fail x =
print_endline x;
Printexc.(get_callstack 100 |> print_raw_backtrace stderr);
Caml.Printexc.(get_callstack 100 |> print_raw_backtrace stderr);
exit 1
(******************************************************************************(
* Utility functions to help format/throw errors for informative errors
)******************************************************************************)
let indent_string_with (indent : string) (error : string) : string =
indent ^ String.concat ("\n" ^ indent) Str.(split (regexp "\n") error)
indent ^ String.concat ~sep:("\n" ^ indent) Str.(split (regexp "\n") error)
let indent_strings_with (indent : string) (errors : string list) : string =
String.concat "" @@ List.map ~f:(indent_string_with indent) errors
String.concat ~sep:"" @@ List.map ~f:(indent_string_with indent) errors
let fail_on_none (error : string) optional_thing =
match optional_thing with
| None -> fail error
@@ -190,8 +190,8 @@ let assert_responded (error : string) loop_output =
fail_on_none error loop_output.persistent_client_response
let assertEqual expected got =
let expected = String.trim expected in
let got = String.trim got in
let expected = String.strip expected in
let got = String.strip got in
if expected <> got then fail
(Printf.sprintf "Expected:\n%s\nGot:\n%s\n" expected got)
@@ -525,7 +525,7 @@ let assert_coverage_levels loop_output expected =
in
let results_as_string =
List.map results coverage_levels_to_str_helper
|> List.sort ~cmp:compare |> List.append strings_of_stats
|> List.sort ~compare |> List.append strings_of_stats
|> list_to_string in
let expected_as_string = list_to_string expected in
assertEqual expected_as_string results_as_string
@@ -537,8 +537,8 @@ let assert_autocomplete loop_output expected =
in
let results = results |> List.map ~f:(fun x -> x.AutocompleteTypes.res_name) in
(* The autocomplete results out of hack are unsorted *)
let results_as_string = results |> List.sort ~cmp:compare |> list_to_string in
let expected_as_string = expected |> List.sort ~cmp:compare |> list_to_string in
let results_as_string = results |> List.sort ~compare |> list_to_string in
let expected_as_string = expected |> List.sort ~compare |> list_to_string in
assertEqual expected_as_string results_as_string
let assert_ide_autocomplete loop_output expected =
@@ -637,7 +637,7 @@ let assert_refactor loop_output expected =
let assert_ide_refactor loop_output expected =
let results = assert_response loop_output in
let results = Core_result.ok_or_failwith results in
let results = Result.ok_or_failwith results in
let results_as_string = ClientRefactor.patches_to_json_string results in
assertEqual expected results_as_string
@@ -1,3 +1,4 @@
open Core_kernel
module Test = Integration_test_base
open Integration_test_base_types
@@ -1,3 +1,4 @@
open Core_kernel
let entry = WorkerController.register_entry_point ~restore:(fun _ -> ())
let try_finalize f x finally y =
@@ -1,10 +1,12 @@
open Core_kernel
module Watchman_changes_comparator = struct
type t = Watchman.changes
let to_string changes =
let open Watchman in
let pushed_to_string = function
| Changed_merge_base (hg_rev, changes, clock) ->
let changes = String.concat ", " (SSet.elements changes) in
let changes = String.concat ~sep:", " (SSet.elements changes) in
Printf.sprintf "Changed_merge_base(%s, %s, %s)"
hg_rev
changes
@@ -20,7 +22,7 @@ module Watchman_changes_comparator = struct
| Files_changed s ->
Printf.sprintf
"Watchman_push files [%s]"
(String.concat ", " @@ SSet.elements s)
(String.concat ~sep:", " @@ SSet.elements s)
in
match changes with
| Watchman_unavailable ->
@@ -29,7 +31,7 @@ module Watchman_changes_comparator = struct
| Watchman_synchronous s ->
Printf.sprintf
"Watchman_synchronous [%s]"
(String.concat ", " @@ List.map pushed_to_string s)
(String.concat ~sep:", " @@ List.map ~f:pushed_to_string s)
let pushed_is_equal exp actual =
let open Watchman in
@@ -60,7 +62,7 @@ module Watchman_changes_comparator = struct
| Watchman_pushed exp, Watchman_pushed actual ->
pushed_is_equal exp actual
| Watchman_synchronous exp, Watchman_synchronous actual ->
List.for_all2 pushed_is_equal exp actual
List.for_all2_exn ~f:pushed_is_equal exp actual
| _ ->
false

0 comments on commit bca11f7

Please sign in to comment.