From cd83a2438156827bd7a3c2b5dfd2d952ce01e538 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Mon, 26 Jun 2017 03:08:41 -0700 Subject: [PATCH] [merge] only try to read/create multilink files when --merge is specified Summary: Thanks to the logging introduced in D5293334 (or because of, depending on your liking of spam), I noticed that there lots of errors being logged of the form Couldn't read multilink file '/home/jul/infer/infer/tests/codetoanalyze/cpp/errors/infer-out/attributes/d0/multilink.txt': /home/jul/infer/infer/tests/codetoanalyze/cpp/errors/infer-out/attributes/d0/multilink.txt: No such file or directory I don't think it makes sense to care about multilink files except when `--merge` is specified. Also introduced a .mli and self-documented a function. Reviewed By: akotulski Differential Revision: D5310129 fbshipit-source-id: c3a6276 --- infer/src/backend/InferAnalyze.re | 2 +- infer/src/backend/mergeCapture.ml | 6 ++---- infer/src/backend/mergeCapture.mli | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 infer/src/backend/mergeCapture.mli diff --git a/infer/src/backend/InferAnalyze.re b/infer/src/backend/InferAnalyze.re index d4663b2b8..dec4bed8b 100644 --- a/infer/src/backend/InferAnalyze.re +++ b/infer/src/backend/InferAnalyze.re @@ -132,7 +132,7 @@ let main makefile => { BuiltinDefn.init (); RegisterCheckers.register (); switch Config.modified_targets { - | Some file => MergeCapture.modified_file file + | Some file => MergeCapture.record_modified_targets_from_file file | None => () }; switch Config.cluster_cmdline { diff --git a/infer/src/backend/mergeCapture.ml b/infer/src/backend/mergeCapture.ml index e8b7d572e..5225483ed 100644 --- a/infer/src/backend/mergeCapture.ml +++ b/infer/src/backend/mergeCapture.ml @@ -15,8 +15,6 @@ module F = Format (** Module to merge the results of capture for different buck targets. *) -let use_multilinks = true - (** Flag to control whether the timestamp of symbolic links is used to determine whether a captured directory needs to be merged. *) let check_timestamp_of_symlinks = true @@ -27,7 +25,7 @@ let infer_deps () = Filename.concat Config.results_dir Config.buck_infer_deps_fi let modified_targets = ref String.Set.empty -let modified_file file = +let record_modified_targets_from_file file = match Utils.read_file file with | Ok targets -> modified_targets := List.fold ~f:String.Set.add ~init:String.Set.empty targets @@ -118,7 +116,7 @@ let rec slink ~stats ~skiplevels src dst = items end else if skiplevels > 0 then () - else if use_multilinks && Filename.check_suffix dst ".attr" + else if Config.merge && Filename.check_suffix dst ".attr" then add_multilink_attr ~stats src dst else create_link ~stats src dst diff --git a/infer/src/backend/mergeCapture.mli b/infer/src/backend/mergeCapture.mli new file mode 100644 index 000000000..e042cb9c4 --- /dev/null +++ b/infer/src/backend/mergeCapture.mli @@ -0,0 +1,14 @@ +(* + * Copyright (c) 2017 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + *) + +open! IStd + +val record_modified_targets_from_file : string -> unit + +val merge_captured_targets : unit -> unit