File 2302-common_test-Add-support-for-running-cover-local_only.patch of Package erlang
From f2b6259a43dca0eafa4813c5cf63186d3dba3a0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Mon, 11 Feb 2019 13:37:43 +0100
Subject: [PATCH 2/3] common_test: Add support for running cover:local_only/0
---
 lib/common_test/src/ct_cover.erl | 5 +++++
 lib/common_test/src/ct_run.erl   | 8 +++++++-
 lib/common_test/src/ct_util.hrl  | 1 +
 3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/common_test/src/ct_cover.erl b/lib/common_test/src/ct_cover.erl
index d286f20a4d..bcd98dcc58 100644
--- a/lib/common_test/src/ct_cover.erl
+++ b/lib/common_test/src/ct_cover.erl
@@ -262,6 +262,11 @@ get_app_info(App=#cover{app=Name}, [{src_files,Name,Src1}|Terms], Dir) ->
     Src = App#cover.src,
     get_app_info(App#cover{src=Src++Src1},Terms,Dir);
 
+get_app_info(App=#cover{app=none}, [{local_only,Bool}|Terms], Dir) ->
+    get_app_info(App, [{local_only,none,Bool}|Terms], Dir);
+get_app_info(App=#cover{app=Name}, [{local_only,Name,Bool}|Terms], Dir) ->
+    get_app_info(App#cover{local_only=Bool},Terms,Dir);
+
 get_app_info(App, [_|Terms], Dir) ->
     get_app_info(App, Terms, Dir);
 
diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl
index c9d406f1fd..960252a6fe 100644
--- a/lib/common_test/src/ct_run.erl
+++ b/lib/common_test/src/ct_run.erl
@@ -2345,18 +2345,24 @@ start_cover(Opts=#opts{coverspec=CovData,cover_stop=CovStop},LogDir) ->
      CovImport,
      _CovExport,
      #cover{app        = CovApp,
+            local_only = LocalOnly,
 	    level      = CovLevel,
 	    excl_mods  = CovExcl,
 	    incl_mods  = CovIncl,
 	    cross      = CovCross,
 	    src        = _CovSrc}} = CovData,
+    case LocalOnly of
+        true -> cover:local_only();
+        false -> ok
+    end,
     ct_logs:log("COVER INFO",
 		"Using cover specification file: ~ts~n"
 		"App: ~w~n"
+                "Local only: ~w~n"
 		"Cross cover: ~w~n"
 		"Including ~w modules~n"
 		"Excluding ~w modules",
-		[CovFile,CovApp,CovCross,
+		[CovFile,CovApp,LocalOnly,CovCross,
 		 length(CovIncl),length(CovExcl)]),
 
     %% Tell test_server to print a link in its coverlog
diff --git a/lib/common_test/src/ct_util.hrl b/lib/common_test/src/ct_util.hrl
index 039c8168ec..d5c93d05ba 100644
--- a/lib/common_test/src/ct_util.hrl
+++ b/lib/common_test/src/ct_util.hrl
@@ -62,6 +62,7 @@
 		   merge_tests=true}).
 
 -record(cover, {app=none,
+                local_only=false,
 		level=details,
 		excl_mods=[],
 		incl_mods=[],
-- 
2.16.4