<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello Sean,<br>
yes, I've added some tests that are not passing on that platform.
Could we disable them there?<br>
<br>
Thanks!<br>
- Marco.<br>
<br>
<div class="moz-cite-prefix">Il 05/07/2018 21:21, Sean Fertile ha
scritto:<br>
</div>
<blockquote type="cite"
cite="mid:OF11C2764D.4B6AC62B-ON002582C1.006FA1F0-002582C1.006FD68C@notes.na.collabserv.com">
<div class="socmaildefaultfont" dir="ltr"
style="font-family:Arial, Helvetica,
sans-serif;font-size:10.5pt">
<div dir="ltr">Hi Marco, </div>
<div dir="ltr"> </div>
<div dir="ltr">I believe this commit broke <a
href="http://lab.llvm.org:8011/builders/clang-ppc64be-linux"
moz-do-not-send="true">http://lab.llvm.org:8011/builders/clang-ppc64be-linux</a></div>
<div dir="ltr"> </div>
<div dir="ltr">Thanks</div>
<div dir="ltr">Sean</div>
<div dir="ltr"> </div>
<blockquote data-history-content-modified="1" dir="ltr"
style="border-left:solid #aaaaaa 2px; margin-left:5px;
padding-left:5px; direction:ltr; margin-right:0px">-----
Original message -----<br>
From: Marco Castelluccio via llvm-commits
<a class="moz-txt-link-rfc2396E" href="mailto:llvm-commits@lists.llvm.org"><llvm-commits@lists.llvm.org></a><br>
Sent by: "llvm-commits"
<a class="moz-txt-link-rfc2396E" href="mailto:llvm-commits-bounces@lists.llvm.org"><llvm-commits-bounces@lists.llvm.org></a><br>
To: <a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
Cc:<br>
Subject: [compiler-rt] r336365 - Make __gcov_flush flush
counters for all shared libraries<br>
Date: Thu, Jul 5, 2018 11:57 AM<br>
<div><font face="Default Monospace,Courier
New,Courier,monospace" size="2">Author: marco<br>
Date: Thu Jul 5 08:52:59 2018<br>
New Revision: 336365<br>
<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project?rev=336365&view=rev"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project?rev=336365&view=rev</a><br>
Log:<br>
Make __gcov_flush flush counters for all shared libraries<br>
<br>
Summary:<br>
This will make the behavior of __gcov_flush match the GCC
behavior.<br>
<br>
I would like to rename __gcov_flush to __llvm_gcov_flush
(in case of programs linking to libraries built with
different compilers), but I guess we can't for
compatibility reasons.<br>
<br>
Reviewers: davidxl<br>
<br>
Reviewed By: davidxl<br>
<br>
Subscribers: samsonov, vitalybuka, pcc, kcc, junbuml,
glider, fhahn, eugenis, dvyukov, davidxl, srhines, chh,
llvm-commits, #sanitizers<br>
<br>
Differential Revision: <a
href="https://reviews.llvm.org/D48538" target="_blank"
moz-do-not-send="true">https://reviews.llvm.org/D48538</a><br>
<br>
Added:<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func2.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush.c<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main.c.gcov<br>
compiler-rt/trunk/test/profile/instrprof-gcov-two-objects.test<br>
compiler-rt/trunk/test/profile/instrprof-shared-gcov-flush.test<br>
Modified:<br>
compiler-rt/trunk/lib/profile/GCDAProfiling.c<br>
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c<br>
compiler-rt/trunk/test/profile/instrprof-dlopen-dlclose-gcov.test<br>
<br>
Modified: compiler-rt/trunk/lib/profile/GCDAProfiling.c<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/GCDAProfiling.c?rev=336365&r1=336364&r2=336365&view=diff"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/GCDAProfiling.c?rev=336365&r1=336364&r2=336365&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/profile/GCDAProfiling.c
(original)<br>
+++ compiler-rt/trunk/lib/profile/GCDAProfiling.c Thu Jul
5 08:52:59 2018<br>
@@ -86,31 +86,76 @@ static uint64_t file_size = 0;<br>
static int new_file = 0;<br>
static int fd = -1;<br>
<br>
-/*<br>
- * A list of functions to write out the data.<br>
- */<br>
-typedef void (*writeout_fn)();<br>
+typedef void (*fn_ptr)();<br>
<br>
-struct writeout_fn_node {<br>
- writeout_fn fn;<br>
- struct writeout_fn_node *next;<br>
+typedef void* dynamic_object_id;<br>
+// The address of this variable identifies a given
dynamic object.<br>
+static dynamic_object_id current_id;<br>
+#define CURRENT_ID (¤t_id)<br>
+<br>
+struct fn_node {<br>
+ dynamic_object_id id;<br>
+ fn_ptr fn;<br>
+ struct fn_node* next;<br>
};<br>
<br>
-static struct writeout_fn_node *writeout_fn_head = NULL;<br>
-static struct writeout_fn_node *writeout_fn_tail = NULL;<br>
+struct fn_list {<br>
+ struct fn_node *head, *tail;<br>
+};<br>
<br>
/*<br>
- * A list of flush functions that our __gcov_flush()
function should call.<br>
+ * A list of functions to write out the data, shared
between all dynamic objects.<br>
*/<br>
-typedef void (*flush_fn)();<br>
+struct fn_list writeout_fn_list;<br>
<br>
-struct flush_fn_node {<br>
- flush_fn fn;<br>
- struct flush_fn_node *next;<br>
-};<br>
+/*<br>
+ * A list of flush functions that our __gcov_flush()
function should call, shared between all dynamic objects.<br>
+ */<br>
+struct fn_list flush_fn_list;<br>
+<br>
+static void fn_list_insert(struct fn_list* list, fn_ptr
fn) {<br>
+ struct fn_node* new_node = malloc(sizeof(struct
fn_node));<br>
+ new_node->fn = fn;<br>
+ new_node->next = NULL;<br>
+ new_node->id = CURRENT_ID;<br>
+<br>
+ if (!list->head) {<br>
+ list->head = list->tail = new_node;<br>
+ } else {<br>
+ list->tail->next = new_node;<br>
+ list->tail = new_node;<br>
+ }<br>
+}<br>
+<br>
+static void fn_list_remove(struct fn_list* list) {<br>
+ struct fn_node* curr = list->head;<br>
+ struct fn_node* prev = NULL;<br>
+ struct fn_node* next = NULL;<br>
+<br>
+ while (curr) {<br>
+ next = curr->next;<br>
+<br>
+ if (curr->id == CURRENT_ID) {<br>
+ if (curr == list->head) {<br>
+ list->head = next;<br>
+ }<br>
+<br>
+ if (curr == list->tail) {<br>
+ list->tail = prev;<br>
+ }<br>
+<br>
+ if (prev) {<br>
+ prev->next = next;<br>
+ }<br>
+<br>
+ free(curr);<br>
+ } else {<br>
+ prev = curr;<br>
+ }<br>
<br>
-static struct flush_fn_node *flush_fn_head = NULL;<br>
-static struct flush_fn_node *flush_fn_tail = NULL;<br>
+ curr = next;<br>
+ }<br>
+}<br>
<br>
static void resize_write_buffer(uint64_t size) {<br>
if (!new_file) return;<br>
@@ -403,6 +448,7 @@ void llvm_gcda_summary_info() {<br>
const uint32_t obj_summary_len = 9; /* Length for gcov
compatibility. */<br>
uint32_t i;<br>
uint32_t runs = 1;<br>
+ static uint32_t run_counted = 0; // We only want to
increase the run count once.<br>
uint32_t val = 0;<br>
uint64_t save_cur_pos = cur_pos;<br>
<br>
@@ -429,7 +475,9 @@ void llvm_gcda_summary_info() {<br>
<br>
read_32bit_value(); /* checksum, unused */<br>
read_32bit_value(); /* num, unused */<br>
- runs += read_32bit_value(); /* Add previous run count
to new counter. */<br>
+ uint32_t prev_runs = read_32bit_value();<br>
+ /* Add previous run count to new counter, if not
already counted before. */<br>
+ runs = run_counted ? prev_runs : prev_runs + 1;<br>
}<br>
<br>
cur_pos = save_cur_pos;<br>
@@ -447,6 +495,8 @@ void llvm_gcda_summary_info() {<br>
write_bytes("\0\0\0\xa3", 4); /* tag indicates 1
program */<br>
write_32bit_value(0); /* 0 length */<br>
<br>
+ run_counted = 1;<br>
+<br>
#ifdef DEBUG_GCDAPROFILING<br>
fprintf(stderr, "llvmgcda: %u runs\n", runs);<br>
#endif<br>
@@ -479,61 +529,34 @@ void llvm_gcda_end_file() {<br>
}<br>
<br>
COMPILER_RT_VISIBILITY<br>
-void llvm_register_writeout_function(writeout_fn fn) {<br>
- struct writeout_fn_node *new_node =
malloc(sizeof(struct writeout_fn_node));<br>
- new_node->fn = fn;<br>
- new_node->next = NULL;<br>
-<br>
- if (!writeout_fn_head) {<br>
- writeout_fn_head = writeout_fn_tail = new_node;<br>
- } else {<br>
- writeout_fn_tail->next = new_node;<br>
- writeout_fn_tail = new_node;<br>
- }<br>
+void llvm_register_writeout_function(fn_ptr fn) {<br>
+ fn_list_insert(&writeout_fn_list, fn);<br>
}<br>
<br>
COMPILER_RT_VISIBILITY<br>
void llvm_writeout_files(void) {<br>
- struct writeout_fn_node *curr = writeout_fn_head;<br>
+ struct fn_node *curr = writeout_fn_list.head;<br>
<br>
while (curr) {<br>
- curr->fn();<br>
+ if (curr->id == CURRENT_ID) {<br>
+ curr->fn();<br>
+ }<br>
curr = curr->next;<br>
}<br>
}<br>
<br>
COMPILER_RT_VISIBILITY<br>
void llvm_delete_writeout_function_list(void) {<br>
- while (writeout_fn_head) {<br>
- struct writeout_fn_node *node = writeout_fn_head;<br>
- writeout_fn_head = writeout_fn_head->next;<br>
- free(node);<br>
- }<br>
- <br>
- writeout_fn_head = writeout_fn_tail = NULL;<br>
+ fn_list_remove(&writeout_fn_list);<br>
}<br>
<br>
COMPILER_RT_VISIBILITY<br>
-void llvm_register_flush_function(flush_fn fn) {<br>
- struct flush_fn_node *new_node = malloc(sizeof(struct
flush_fn_node));<br>
- new_node->fn = fn;<br>
- new_node->next = NULL;<br>
-<br>
- if (!flush_fn_head) {<br>
- flush_fn_head = flush_fn_tail = new_node;<br>
- } else {<br>
- flush_fn_tail->next = new_node;<br>
- flush_fn_tail = new_node;<br>
- }<br>
+void llvm_register_flush_function(fn_ptr fn) {<br>
+ fn_list_insert(&flush_fn_list, fn);<br>
}<br>
<br>
-// __gcov_flush is hidden. When called in a .so file,<br>
-// it dumps profile data of the calling .so file.<br>
-// If a main program needs to dump profile data of each
linked<br>
-// .so files, it should use dlsym to find and call
llvm_gcov_flush.<br>
-COMPILER_RT_VISIBILITY<br>
void __gcov_flush() {<br>
- struct flush_fn_node *curr = flush_fn_head;<br>
+ struct fn_node* curr = flush_fn_list.head;<br>
<br>
while (curr) {<br>
curr->fn();<br>
@@ -541,25 +564,13 @@ void __gcov_flush() {<br>
}<br>
}<br>
<br>
-// llvm_gcov_flush is not hidden for a program to use
dlsym to<br>
-// find and call for any linked .so file.<br>
-void llvm_gcov_flush() {<br>
- __gcov_flush();<br>
-}<br>
-<br>
COMPILER_RT_VISIBILITY<br>
void llvm_delete_flush_function_list(void) {<br>
- while (flush_fn_head) {<br>
- struct flush_fn_node *node = flush_fn_head;<br>
- flush_fn_head = flush_fn_head->next;<br>
- free(node);<br>
- }<br>
-<br>
- flush_fn_head = flush_fn_tail = NULL;<br>
+ fn_list_remove(&flush_fn_list);<br>
}<br>
<br>
COMPILER_RT_VISIBILITY<br>
-void llvm_gcov_init(writeout_fn wfn, flush_fn ffn) {<br>
+void llvm_gcov_init(fn_ptr wfn, fn_ptr ffn) {<br>
static int atexit_ran = 0;<br>
<br>
if (wfn)<br>
<br>
Modified:
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c?rev=336365&r1=336364&r2=336365&view=diff"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c?rev=336365&r1=336364&r2=336365&view=diff</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c
(original)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c
Thu Jul 5 08:52:59 2018<br>
@@ -10,6 +10,12 @@ int main(int argc, char *argv[]) {<br>
return EXIT_FAILURE;<br>
}<br>
<br>
+ void (*func)(void) = (void (*)(void))dlsym(f1_handle,
"func");<br>
+ if (func == NULL) {<br>
+ fprintf(stderr, "unable to lookup symbol 'func':
%s\n", dlerror());<br>
+ return EXIT_FAILURE;<br>
+ }<br>
+<br>
dlerror();<br>
void *f2_handle = dlopen("func2.shared", RTLD_LAZY |
RTLD_GLOBAL);<br>
if (f2_handle == NULL) {<br>
@@ -17,31 +23,44 @@ int main(int argc, char *argv[]) {<br>
return EXIT_FAILURE;<br>
}<br>
<br>
- dlerror();<br>
- void (*gcov_flush)() = (void (*)())dlsym(f1_handle,
"__gcov_flush");<br>
- if (gcov_flush != NULL || dlerror() == NULL) {<br>
- fprintf(stderr, "__gcov_flush should not be visible
in func.shared'\n");<br>
+ void (*func2)(void) = (void (*)(void))dlsym(f2_handle,
"func2");<br>
+ if (func2 == NULL) {<br>
+ fprintf(stderr, "unable to lookup symbol 'func2':
%s\n", dlerror());<br>
+ return EXIT_FAILURE;<br>
+ }<br>
+ func2();<br>
+<br>
+#ifdef USE_LIB3<br>
+ void *f3_handle = dlopen("func3.shared", RTLD_LAZY |
RTLD_GLOBAL);<br>
+ if (f3_handle == NULL) {<br>
+ fprintf(stderr, "unable to open 'func3.shared':
%s\n", dlerror());<br>
+ return EXIT_FAILURE;<br>
+ }<br>
+<br>
+ void (*func3)(void) = (void (*)(void))dlsym(f3_handle,
"func3");<br>
+ if (func3 == NULL) {<br>
+ fprintf(stderr, "unable to lookup symbol 'func3':
%s\n", dlerror());<br>
return EXIT_FAILURE;<br>
}<br>
+ func3();<br>
+#endif<br>
<br>
dlerror();<br>
- void (*f1_flush)() = (void (*)())dlsym(f1_handle,
"llvm_gcov_flush");<br>
- if (f1_flush == NULL) {<br>
- fprintf(stderr, "unable to find llvm_gcov_flush in
func.shared': %s\n", dlerror());<br>
+ void (*gcov_flush1)() = (void (*)())dlsym(f1_handle,
"__gcov_flush");<br>
+ if (gcov_flush1 == NULL) {<br>
+ fprintf(stderr, "unable to find __gcov_flush in
func.shared': %s\n", dlerror());<br>
return EXIT_FAILURE;<br>
}<br>
- f1_flush();<br>
<br>
dlerror();<br>
- void (*f2_flush)() = (void (*)())dlsym(f2_handle,
"llvm_gcov_flush");<br>
- if (f2_flush == NULL) {<br>
- fprintf(stderr, "unable to find llvm_gcov_flush in
func2.shared': %s\n", dlerror());<br>
+ void (*gcov_flush2)() = (void (*)())dlsym(f2_handle,
"__gcov_flush");<br>
+ if (gcov_flush2 == NULL) {<br>
+ fprintf(stderr, "unable to find __gcov_flush in
func2.shared': %s\n", dlerror());<br>
return EXIT_FAILURE;<br>
}<br>
- f2_flush();<br>
<br>
- if (f1_flush == f2_flush) {<br>
- fprintf(stderr, "Same llvm_gcov_flush found in
func.shared and func2.shared\n");<br>
+ if (gcov_flush1 == gcov_flush2) {<br>
+ fprintf(stderr, "Same __gcov_flush found in
func.shared and func2.shared\n");<br>
return EXIT_FAILURE;<br>
}<br>
<br>
@@ -51,6 +70,17 @@ int main(int argc, char *argv[]) {<br>
return EXIT_FAILURE;<br>
}<br>
<br>
+ func();<br>
+<br>
+ int g1 = 0;<br>
+ int g2 = 0;<br>
+ int n = 10;<br>
+<br>
+ if (n % 5 == 0)<br>
+ g1++;<br>
+ else<br>
+ g2++;<br>
+<br>
return EXIT_SUCCESS;<br>
}<br>
<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,91 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-dlopen-dlclose-main.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-dlopen-dlclose-main.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-dlopen-dlclose-main.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: -: 1:#include <dlfcn.h><br>
+// CHECK-NEXT: -: 2:#include <stdio.h><br>
+// CHECK-NEXT: -: 3:#include <stdlib.h><br>
+// CHECK-NEXT: -: 4:<br>
+// CHECK-NEXT: -: 5:int main(int argc, char
*argv[]) {<br>
+// CHECK-NEXT: 1: 6: dlerror();<br>
+// CHECK-NEXT: 1: 7: void *f1_handle =
dlopen("func.shared", RTLD_LAZY | RTLD_GLOBAL);<br>
+// CHECK-NEXT: 1: 8: if (f1_handle == NULL) {<br>
+// CHECK-NEXT: #####: 9: fprintf(stderr, "unable
to open 'func.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 10: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 11: }<br>
+// CHECK-NEXT: -: 12:<br>
+// CHECK-NEXT: 1: 13: void (*func)(void) =
(void (*)(void))dlsym(f1_handle, "func");<br>
+// CHECK-NEXT: 1: 14: if (func == NULL) {<br>
+// CHECK-NEXT: #####: 15: fprintf(stderr, "unable
to lookup symbol 'func': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 16: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 17: }<br>
+// CHECK-NEXT: -: 18:<br>
+// CHECK-NEXT: 1: 19: dlerror();<br>
+// CHECK-NEXT: 1: 20: void *f2_handle =
dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL);<br>
+// CHECK-NEXT: 1: 21: if (f2_handle == NULL) {<br>
+// CHECK-NEXT: #####: 22: fprintf(stderr, "unable
to open 'func2.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 23: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 24: }<br>
+// CHECK-NEXT: -: 25:<br>
+// CHECK-NEXT: 1: 26: void (*func2)(void) =
(void (*)(void))dlsym(f2_handle, "func2");<br>
+// CHECK-NEXT: 1: 27: if (func2 == NULL) {<br>
+// CHECK-NEXT: #####: 28: fprintf(stderr, "unable
to lookup symbol 'func2': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 29: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 30: }<br>
+// CHECK-NEXT: 1: 31: func2();<br>
+// CHECK-NEXT: -: 32:<br>
+// CHECK-NEXT: -: 33:#ifdef USE_LIB3<br>
+// CHECK-NEXT: -: 34: void *f3_handle =
dlopen("func3.shared", RTLD_LAZY | RTLD_GLOBAL);<br>
+// CHECK-NEXT: -: 35: if (f3_handle == NULL) {<br>
+// CHECK-NEXT: -: 36: fprintf(stderr, "unable
to open 'func3.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: -: 37: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 38: }<br>
+// CHECK-NEXT: -: 39:<br>
+// CHECK-NEXT: -: 40: void (*func3)(void) =
(void (*)(void))dlsym(f3_handle, "func3");<br>
+// CHECK-NEXT: -: 41: if (func3 == NULL) {<br>
+// CHECK-NEXT: -: 42: fprintf(stderr, "unable
to lookup symbol 'func3': %s\n", dlerror());<br>
+// CHECK-NEXT: -: 43: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 44: }<br>
+// CHECK-NEXT: -: 45: func3();<br>
+// CHECK-NEXT: -: 46:#endif<br>
+// CHECK-NEXT: -: 47:<br>
+// CHECK-NEXT: 1: 48: dlerror();<br>
+// CHECK-NEXT: 1: 49: void (*gcov_flush1)() =
(void (*)())dlsym(f1_handle, "__gcov_flush");<br>
+// CHECK-NEXT: 1: 50: if (gcov_flush1 == NULL)
{<br>
+// CHECK-NEXT: #####: 51: fprintf(stderr, "unable
to find __gcov_flush in func.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 52: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 53: }<br>
+// CHECK-NEXT: -: 54:<br>
+// CHECK-NEXT: 1: 55: dlerror();<br>
+// CHECK-NEXT: 1: 56: void (*gcov_flush2)() =
(void (*)())dlsym(f2_handle, "__gcov_flush");<br>
+// CHECK-NEXT: 1: 57: if (gcov_flush2 == NULL)
{<br>
+// CHECK-NEXT: #####: 58: fprintf(stderr, "unable
to find __gcov_flush in func2.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 59: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 60: }<br>
+// CHECK-NEXT: -: 61:<br>
+// CHECK-NEXT: 1: 62: if (gcov_flush1 ==
gcov_flush2) {<br>
+// CHECK-NEXT: #####: 63: fprintf(stderr, "Same
__gcov_flush found in func.shared and func2.shared\n");<br>
+// CHECK-NEXT: #####: 64: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 65: }<br>
+// CHECK-NEXT: -: 66:<br>
+// CHECK-NEXT: 1: 67: dlerror();<br>
+// CHECK-NEXT: 1: 68: if (dlclose(f2_handle) !=
0) {<br>
+// CHECK-NEXT: #####: 69: fprintf(stderr, "unable
to close 'func2.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 70: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 71: }<br>
+// CHECK-NEXT: -: 72:<br>
+// CHECK-NEXT: 1: 73: func();<br>
+// CHECK-NEXT: -: 74:<br>
+// CHECK-NEXT: 1: 75: int g1 = 0;<br>
+// CHECK-NEXT: 1: 76: int g2 = 0;<br>
+// CHECK-NEXT: 1: 77: int n = 10;<br>
+// CHECK-NEXT: -: 78:<br>
+// CHECK-NEXT: 1: 79: if (n % 5 == 0)<br>
+// CHECK-NEXT: 1: 80: g1++;<br>
+// CHECK-NEXT: -: 81: else<br>
+// CHECK-NEXT: #####: 82: g2++;<br>
+// CHECK-NEXT: -: 83:<br>
+// CHECK-NEXT: 1: 84: return EXIT_SUCCESS;<br>
+// CHECK-NEXT: 1: 85:}<br>
+// CHECK-NEXT: -: 86:<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,91 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-dlopen-dlclose-main.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-dlopen-dlclose-main.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-dlopen-dlclose-main.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: -: 1:#include <dlfcn.h><br>
+// CHECK-NEXT: -: 2:#include <stdio.h><br>
+// CHECK-NEXT: -: 3:#include <stdlib.h><br>
+// CHECK-NEXT: -: 4:<br>
+// CHECK-NEXT: -: 5:int main(int argc, char
*argv[]) {<br>
+// CHECK-NEXT: 1: 6: dlerror();<br>
+// CHECK-NEXT: 1: 7: void *f1_handle =
dlopen("func.shared", RTLD_LAZY | RTLD_GLOBAL);<br>
+// CHECK-NEXT: 1: 8: if (f1_handle == NULL) {<br>
+// CHECK-NEXT: #####: 9: fprintf(stderr, "unable
to open 'func.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 10: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 11: }<br>
+// CHECK-NEXT: -: 12:<br>
+// CHECK-NEXT: 1: 13: void (*func)(void) =
(void (*)(void))dlsym(f1_handle, "func");<br>
+// CHECK-NEXT: 1: 14: if (func == NULL) {<br>
+// CHECK-NEXT: #####: 15: fprintf(stderr, "unable
to lookup symbol 'func': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 16: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 17: }<br>
+// CHECK-NEXT: -: 18:<br>
+// CHECK-NEXT: 1: 19: dlerror();<br>
+// CHECK-NEXT: 1: 20: void *f2_handle =
dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL);<br>
+// CHECK-NEXT: 1: 21: if (f2_handle == NULL) {<br>
+// CHECK-NEXT: #####: 22: fprintf(stderr, "unable
to open 'func2.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 23: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 24: }<br>
+// CHECK-NEXT: -: 25:<br>
+// CHECK-NEXT: 1: 26: void (*func2)(void) =
(void (*)(void))dlsym(f2_handle, "func2");<br>
+// CHECK-NEXT: 1: 27: if (func2 == NULL) {<br>
+// CHECK-NEXT: #####: 28: fprintf(stderr, "unable
to lookup symbol 'func2': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 29: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 30: }<br>
+// CHECK-NEXT: 1: 31: func2();<br>
+// CHECK-NEXT: -: 32:<br>
+// CHECK-NEXT: -: 33:#ifdef USE_LIB3<br>
+// CHECK-NEXT: 1: 34: void *f3_handle =
dlopen("func3.shared", RTLD_LAZY | RTLD_GLOBAL);<br>
+// CHECK-NEXT: 1: 35: if (f3_handle == NULL) {<br>
+// CHECK-NEXT: #####: 36: fprintf(stderr, "unable
to open 'func3.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 37: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 38: }<br>
+// CHECK-NEXT: -: 39:<br>
+// CHECK-NEXT: 1: 40: void (*func3)(void) =
(void (*)(void))dlsym(f3_handle, "func3");<br>
+// CHECK-NEXT: 1: 41: if (func3 == NULL) {<br>
+// CHECK-NEXT: #####: 42: fprintf(stderr, "unable
to lookup symbol 'func3': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 43: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 44: }<br>
+// CHECK-NEXT: 1: 45: func3();<br>
+// CHECK-NEXT: -: 46:#endif<br>
+// CHECK-NEXT: -: 47:<br>
+// CHECK-NEXT: 1: 48: dlerror();<br>
+// CHECK-NEXT: 1: 49: void (*gcov_flush1)() =
(void (*)())dlsym(f1_handle, "__gcov_flush");<br>
+// CHECK-NEXT: 1: 50: if (gcov_flush1 == NULL)
{<br>
+// CHECK-NEXT: #####: 51: fprintf(stderr, "unable
to find __gcov_flush in func.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 52: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 53: }<br>
+// CHECK-NEXT: -: 54:<br>
+// CHECK-NEXT: 1: 55: dlerror();<br>
+// CHECK-NEXT: 1: 56: void (*gcov_flush2)() =
(void (*)())dlsym(f2_handle, "__gcov_flush");<br>
+// CHECK-NEXT: 1: 57: if (gcov_flush2 == NULL)
{<br>
+// CHECK-NEXT: #####: 58: fprintf(stderr, "unable
to find __gcov_flush in func2.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 59: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 60: }<br>
+// CHECK-NEXT: -: 61:<br>
+// CHECK-NEXT: 1: 62: if (gcov_flush1 ==
gcov_flush2) {<br>
+// CHECK-NEXT: #####: 63: fprintf(stderr, "Same
__gcov_flush found in func.shared and func2.shared\n");<br>
+// CHECK-NEXT: #####: 64: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 65: }<br>
+// CHECK-NEXT: -: 66:<br>
+// CHECK-NEXT: 1: 67: dlerror();<br>
+// CHECK-NEXT: 1: 68: if (dlclose(f2_handle) !=
0) {<br>
+// CHECK-NEXT: #####: 69: fprintf(stderr, "unable
to close 'func2.shared': %s\n", dlerror());<br>
+// CHECK-NEXT: #####: 70: return EXIT_FAILURE;<br>
+// CHECK-NEXT: -: 71: }<br>
+// CHECK-NEXT: -: 72:<br>
+// CHECK-NEXT: 1: 73: func();<br>
+// CHECK-NEXT: -: 74:<br>
+// CHECK-NEXT: 1: 75: int g1 = 0;<br>
+// CHECK-NEXT: 1: 76: int g2 = 0;<br>
+// CHECK-NEXT: 1: 77: int n = 10;<br>
+// CHECK-NEXT: -: 78:<br>
+// CHECK-NEXT: 1: 79: if (n % 5 == 0)<br>
+// CHECK-NEXT: 1: 80: g1++;<br>
+// CHECK-NEXT: -: 81: else<br>
+// CHECK-NEXT: #####: 82: g2++;<br>
+// CHECK-NEXT: -: 83:<br>
+// CHECK-NEXT: 1: 84: return EXIT_SUCCESS;<br>
+// CHECK-NEXT: 1: 85:}<br>
+// CHECK-NEXT: -: 86:<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,6 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-dlopen-func.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-dlopen-func.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-dlopen-func.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: 3: 1:void func(int K) { if (K)
{} }<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func2.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func2.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func2.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func2.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func2.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,6 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-dlopen-func2.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-dlopen-func2.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-dlopen-func2.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: 3: 1:void func2(int K) { if (K)
{} }<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1 @@<br>
+void func3(int K) { if (K) {} }<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-dlopen-func3.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,6 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-dlopen-func2.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-dlopen-func2.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-dlopen-func2.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: 3: 1:void func2(int K) { if (K)
{} }<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,14 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-shared-lib.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-shared-lib.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-shared-lib.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: -: 1:int g1 = 0;<br>
+// CHECK-NEXT: -: 2:int g2 = 1;<br>
+// CHECK-NEXT: -: 3:<br>
+// CHECK-NEXT: -: 4:void foo(int n) {<br>
+// CHECK-NEXT: 1: 5: if (n % 5 == 0)<br>
+// CHECK-NEXT: #####: 6: g1++;<br>
+// CHECK-NEXT: -: 7: else<br>
+// CHECK-NEXT: 1: 8: g2++;<br>
+// CHECK-NEXT: 1: 9:}<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,14 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-shared-lib.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-shared-lib.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-shared-lib.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: -: 1:int g1 = 0;<br>
+// CHECK-NEXT: -: 2:int g2 = 1;<br>
+// CHECK-NEXT: -: 3:<br>
+// CHECK-NEXT: -: 4:void foo(int n) {<br>
+// CHECK-NEXT: 2: 5: if (n % 5 == 0)<br>
+// CHECK-NEXT: #####: 6: g1++;<br>
+// CHECK-NEXT: -: 7: else<br>
+// CHECK-NEXT: 2: 8: g2++;<br>
+// CHECK-NEXT: 2: 9:}<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,14 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-shared-lib.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-shared-lib.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-shared-lib.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: -: 1:int g1 = 0;<br>
+// CHECK-NEXT: -: 2:int g2 = 1;<br>
+// CHECK-NEXT: -: 3:<br>
+// CHECK-NEXT: -: 4:void foo(int n) {<br>
+// CHECK-NEXT: 1000000: 5: if (n % 5 == 0)<br>
+// CHECK-NEXT: 360000: 6: g1++;<br>
+// CHECK-NEXT: -: 7: else<br>
+// CHECK-NEXT: 640000: 8: g2++;<br>
+// CHECK-NEXT: 1000000: 9:}<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush.c<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush.c?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush.c?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush.c
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush.c
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,36 @@<br>
+extern void foo(int n);<br>
+extern void __gcov_flush(void);<br>
+<br>
+int bar1 = 0;<br>
+int bar2 = 1;<br>
+<br>
+void bar(int n) {<br>
+ if (n % 5 == 0)<br>
+ bar1++;<br>
+ else<br>
+ bar2++;<br>
+}<br>
+<br>
+int main(int argc, char *argv[]) {<br>
+#ifdef SHARED_CALL_BEFORE_GCOV_FLUSH<br>
+ foo(1);<br>
+#endif<br>
+<br>
+ bar(5);<br>
+<br>
+ __gcov_flush();<br>
+<br>
+ bar(5);<br>
+<br>
+#ifdef SHARED_CALL_AFTER_GCOV_FLUSH<br>
+ foo(1);<br>
+#endif<br>
+<br>
+#ifdef EXIT_ABRUPTLY<br>
+ _exit(0);<br>
+#endif<br>
+<br>
+ bar(5);<br>
+<br>
+ return 0;<br>
+}<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,41 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-shared-main-gcov-flush.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-shared-main-gcov-flush.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: -: 1:extern void foo(int n);<br>
+// CHECK-NEXT: -: 2:extern void
__gcov_flush(void);<br>
+// CHECK-NEXT: -: 3:<br>
+// CHECK-NEXT: -: 4:int bar1 = 0;<br>
+// CHECK-NEXT: -: 5:int bar2 = 1;<br>
+// CHECK-NEXT: -: 6:<br>
+// CHECK-NEXT: -: 7:void bar(int n) {<br>
+// CHECK-NEXT: 1: 8: if (n % 5 == 0)<br>
+// CHECK-NEXT: 1: 9: bar1++;<br>
+// CHECK-NEXT: -: 10: else<br>
+// CHECK-NEXT: #####: 11: bar2++;<br>
+// CHECK-NEXT: 1: 12:}<br>
+// CHECK-NEXT: -: 13:<br>
+// CHECK-NEXT: -: 14:int main(int argc, char
*argv[]) {<br>
+// CHECK-NEXT: -: 15:#ifdef
SHARED_CALL_BEFORE_GCOV_FLUSH<br>
+// CHECK-NEXT: 1: 16: foo(1);<br>
+// CHECK-NEXT: -: 17:#endif<br>
+// CHECK-NEXT: -: 18:<br>
+// CHECK-NEXT: 1: 19: bar(5);<br>
+// CHECK-NEXT: -: 20:<br>
+// CHECK-NEXT: 1: 21: __gcov_flush();<br>
+// CHECK-NEXT: -: 22:<br>
+// CHECK-NEXT: 1: 23: bar(5);<br>
+// CHECK-NEXT: -: 24:<br>
+// CHECK-NEXT: -: 25:#ifdef
SHARED_CALL_AFTER_GCOV_FLUSH<br>
+// CHECK-NEXT: 1: 26: foo(1);<br>
+// CHECK-NEXT: -: 27:#endif<br>
+// CHECK-NEXT: -: 28:<br>
+// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY<br>
+// CHECK-NEXT: 1: 30: _exit(0);<br>
+// CHECK-NEXT: -: 31:#endif<br>
+// CHECK-NEXT: -: 32:<br>
+// CHECK-NEXT: -: 33: bar(5);<br>
+// CHECK-NEXT: -: 34:<br>
+// CHECK-NEXT: -: 35: return 0;<br>
+// CHECK-NEXT: #####: 36:}<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,41 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-shared-main-gcov-flush.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-shared-main-gcov-flush.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: -: 1:extern void foo(int n);<br>
+// CHECK-NEXT: -: 2:extern void
__gcov_flush(void);<br>
+// CHECK-NEXT: -: 3:<br>
+// CHECK-NEXT: -: 4:int bar1 = 0;<br>
+// CHECK-NEXT: -: 5:int bar2 = 1;<br>
+// CHECK-NEXT: -: 6:<br>
+// CHECK-NEXT: -: 7:void bar(int n) {<br>
+// CHECK-NEXT: 3: 8: if (n % 5 == 0)<br>
+// CHECK-NEXT: 3: 9: bar1++;<br>
+// CHECK-NEXT: -: 10: else<br>
+// CHECK-NEXT: #####: 11: bar2++;<br>
+// CHECK-NEXT: 3: 12:}<br>
+// CHECK-NEXT: -: 13:<br>
+// CHECK-NEXT: -: 14:int main(int argc, char
*argv[]) {<br>
+// CHECK-NEXT: -: 15:#ifdef
SHARED_CALL_BEFORE_GCOV_FLUSH<br>
+// CHECK-NEXT: -: 16: foo(1);<br>
+// CHECK-NEXT: -: 17:#endif<br>
+// CHECK-NEXT: -: 18:<br>
+// CHECK-NEXT: 1: 19: bar(5);<br>
+// CHECK-NEXT: -: 20:<br>
+// CHECK-NEXT: 1: 21: __gcov_flush();<br>
+// CHECK-NEXT: -: 22:<br>
+// CHECK-NEXT: 1: 23: bar(5);<br>
+// CHECK-NEXT: -: 24:<br>
+// CHECK-NEXT: -: 25:#ifdef
SHARED_CALL_AFTER_GCOV_FLUSH<br>
+// CHECK-NEXT: 1: 26: foo(1);<br>
+// CHECK-NEXT: -: 27:#endif<br>
+// CHECK-NEXT: -: 28:<br>
+// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY<br>
+// CHECK-NEXT: -: 30: _exit(0);<br>
+// CHECK-NEXT: -: 31:#endif<br>
+// CHECK-NEXT: -: 32:<br>
+// CHECK-NEXT: 1: 33: bar(5);<br>
+// CHECK-NEXT: -: 34:<br>
+// CHECK-NEXT: 1: 35: return 0;<br>
+// CHECK-NEXT: -: 36:}<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,41 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-shared-main-gcov-flush.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-shared-main-gcov-flush.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: -: 1:extern void foo(int n);<br>
+// CHECK-NEXT: -: 2:extern void
__gcov_flush(void);<br>
+// CHECK-NEXT: -: 3:<br>
+// CHECK-NEXT: -: 4:int bar1 = 0;<br>
+// CHECK-NEXT: -: 5:int bar2 = 1;<br>
+// CHECK-NEXT: -: 6:<br>
+// CHECK-NEXT: -: 7:void bar(int n) {<br>
+// CHECK-NEXT: 3: 8: if (n % 5 == 0)<br>
+// CHECK-NEXT: 3: 9: bar1++;<br>
+// CHECK-NEXT: -: 10: else<br>
+// CHECK-NEXT: #####: 11: bar2++;<br>
+// CHECK-NEXT: 3: 12:}<br>
+// CHECK-NEXT: -: 13:<br>
+// CHECK-NEXT: -: 14:int main(int argc, char
*argv[]) {<br>
+// CHECK-NEXT: -: 15:#ifdef
SHARED_CALL_BEFORE_GCOV_FLUSH<br>
+// CHECK-NEXT: 1: 16: foo(1);<br>
+// CHECK-NEXT: -: 17:#endif<br>
+// CHECK-NEXT: -: 18:<br>
+// CHECK-NEXT: 1: 19: bar(5);<br>
+// CHECK-NEXT: -: 20:<br>
+// CHECK-NEXT: 1: 21: __gcov_flush();<br>
+// CHECK-NEXT: -: 22:<br>
+// CHECK-NEXT: 1: 23: bar(5);<br>
+// CHECK-NEXT: -: 24:<br>
+// CHECK-NEXT: -: 25:#ifdef
SHARED_CALL_AFTER_GCOV_FLUSH<br>
+// CHECK-NEXT: 1: 26: foo(1);<br>
+// CHECK-NEXT: -: 27:#endif<br>
+// CHECK-NEXT: -: 28:<br>
+// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY<br>
+// CHECK-NEXT: -: 30: _exit(0);<br>
+// CHECK-NEXT: -: 31:#endif<br>
+// CHECK-NEXT: -: 32:<br>
+// CHECK-NEXT: 1: 33: bar(5);<br>
+// CHECK-NEXT: -: 34:<br>
+// CHECK-NEXT: 1: 35: return 0;<br>
+// CHECK-NEXT: -: 36:}<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,41 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-shared-main-gcov-flush.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-shared-main-gcov-flush.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: -: 1:extern void foo(int n);<br>
+// CHECK-NEXT: -: 2:extern void
__gcov_flush(void);<br>
+// CHECK-NEXT: -: 3:<br>
+// CHECK-NEXT: -: 4:int bar1 = 0;<br>
+// CHECK-NEXT: -: 5:int bar2 = 1;<br>
+// CHECK-NEXT: -: 6:<br>
+// CHECK-NEXT: -: 7:void bar(int n) {<br>
+// CHECK-NEXT: 3: 8: if (n % 5 == 0)<br>
+// CHECK-NEXT: 3: 9: bar1++;<br>
+// CHECK-NEXT: -: 10: else<br>
+// CHECK-NEXT: #####: 11: bar2++;<br>
+// CHECK-NEXT: 3: 12:}<br>
+// CHECK-NEXT: -: 13:<br>
+// CHECK-NEXT: -: 14:int main(int argc, char
*argv[]) {<br>
+// CHECK-NEXT: -: 15:#ifdef
SHARED_CALL_BEFORE_GCOV_FLUSH<br>
+// CHECK-NEXT: 1: 16: foo(1);<br>
+// CHECK-NEXT: -: 17:#endif<br>
+// CHECK-NEXT: -: 18:<br>
+// CHECK-NEXT: 1: 19: bar(5);<br>
+// CHECK-NEXT: -: 20:<br>
+// CHECK-NEXT: 1: 21: __gcov_flush();<br>
+// CHECK-NEXT: -: 22:<br>
+// CHECK-NEXT: 1: 23: bar(5);<br>
+// CHECK-NEXT: -: 24:<br>
+// CHECK-NEXT: -: 25:#ifdef
SHARED_CALL_AFTER_GCOV_FLUSH<br>
+// CHECK-NEXT: -: 26: foo(1);<br>
+// CHECK-NEXT: -: 27:#endif<br>
+// CHECK-NEXT: -: 28:<br>
+// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY<br>
+// CHECK-NEXT: -: 30: _exit(0);<br>
+// CHECK-NEXT: -: 31:#endif<br>
+// CHECK-NEXT: -: 32:<br>
+// CHECK-NEXT: 1: 33: bar(5);<br>
+// CHECK-NEXT: -: 34:<br>
+// CHECK-NEXT: 1: 35: return 0;<br>
+// CHECK-NEXT: -: 36:}<br>
<br>
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main.c.gcov<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main.c.gcov?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main.c.gcov?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main.c.gcov
(added)<br>
+++
compiler-rt/trunk/test/profile/Inputs/instrprof-shared-main.c.gcov
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,18 @@<br>
+// CHECK: -:
0:Source:{{.*}}Inputs/instrprof-shared-main.c<br>
+// CHECK-NEXT: -:
0:Graph:instrprof-shared-main.gcno<br>
+// CHECK-NEXT: -:
0:Data:instrprof-shared-main.gcda<br>
+// CHECK-NEXT: -: 0:Runs:1<br>
+// CHECK-NEXT: -: 0:Programs:1<br>
+// CHECK-NEXT: -: 1:extern int g1, g2;<br>
+// CHECK-NEXT: -: 2:extern void foo(int n);<br>
+// CHECK-NEXT: -: 3:<br>
+// CHECK-NEXT: -: 4:int main() {<br>
+// CHECK-NEXT: -: 5: int i, j;<br>
+// CHECK-NEXT: 2002: 6: for (i = 0; i < 1000;
i++)<br>
+// CHECK-NEXT: 2002000: 7: for (j = 0; j <
1000; j++)<br>
+// CHECK-NEXT: 1001000: 8: foo(i * j);<br>
+// CHECK-NEXT: -: 9:<br>
+// CHECK-NEXT: 1: 10: if (g2 - g1 == 280001)<br>
+// CHECK-NEXT: 1: 11: return 0;<br>
+// CHECK-NEXT: #####: 12: return 1;<br>
+// CHECK-NEXT: 1: 13:}<br>
<br>
Modified:
compiler-rt/trunk/test/profile/instrprof-dlopen-dlclose-gcov.test<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-dlopen-dlclose-gcov.test?rev=336365&r1=336364&r2=336365&view=diff"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-dlopen-dlclose-gcov.test?rev=336365&r1=336364&r2=336365&view=diff</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/instrprof-dlopen-dlclose-gcov.test
(original)<br>
+++
compiler-rt/trunk/test/profile/instrprof-dlopen-dlclose-gcov.test
Thu Jul 5 08:52:59 2018<br>
@@ -1,6 +1,30 @@<br>
RUN: mkdir -p %t.d<br>
-RUN: %clang --coverage -o %t.d/func.shared -fPIC -shared
%S/Inputs/instrprof-dlopen-func.c<br>
-RUN: %clang --coverage -o %t.d/func2.shared -fPIC -shared
%S/Inputs/instrprof-dlopen-func2.c<br>
+RUN: cd %t.d<br>
+<br>
+RUN: %clang --coverage -o func.shared -fPIC -shared
%S/Inputs/instrprof-dlopen-func.c<br>
+RUN: %clang --coverage -o func2.shared -fPIC -shared
%S/Inputs/instrprof-dlopen-func2.c<br>
+RUN: %clang --coverage -o func3.shared -fPIC -shared
%S/Inputs/instrprof-dlopen-func3.c<br>
RUN: %clang --coverage -o %t -fPIC -rpath %t.d
%S/Inputs/instrprof-dlopen-dlclose-main.c<br>
<br>
+# Test with two dlopened libraries.<br>
+RUN: %run %t<br>
+RUN: llvm-cov gcov instrprof-dlopen-dlclose-main.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-dlopen-dlclose-main.c.gcov
%S/Inputs/instrprof-dlopen-dlclose-main.c.gcov<br>
+RUN: llvm-cov gcov instrprof-dlopen-func.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-dlopen-func.c.gcov
%S/Inputs/instrprof-dlopen-func.c.gcov<br>
+RUN: llvm-cov gcov instrprof-dlopen-func2.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-dlopen-func2.c.gcov
%S/Inputs/instrprof-dlopen-func2.c.gcov<br>
+RUN: rm instrprof-dlopen-dlclose-main.gcda
instrprof-dlopen-func.gcda instrprof-dlopen-func2.gcda<br>
+<br>
+# Test with three dlopened libraries.<br>
+RUN: %clang -DUSE_LIB3 --coverage -o %t -fPIC -rpath %t.d
%S/Inputs/instrprof-dlopen-dlclose-main.c<br>
RUN: %run %t<br>
+RUN: llvm-cov gcov instrprof-dlopen-dlclose-main.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-dlopen-dlclose-main.c.gcov
%S/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov<br>
+RUN: llvm-cov gcov instrprof-dlopen-func.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-dlopen-func.c.gcov
%S/Inputs/instrprof-dlopen-func.c.gcov<br>
+RUN: llvm-cov gcov instrprof-dlopen-func2.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-dlopen-func2.c.gcov
%S/Inputs/instrprof-dlopen-func2.c.gcov<br>
+RUN: llvm-cov gcov instrprof-dlopen-func3.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-dlopen-func2.c.gcov
%S/Inputs/instrprof-dlopen-func3.c.gcov<br>
+RUN: rm instrprof-dlopen-dlclose-main.gcda
instrprof-dlopen-func.gcda instrprof-dlopen-func2.gcda
instrprof-dlopen-func3.gcda<br>
<br>
Added:
compiler-rt/trunk/test/profile/instrprof-gcov-two-objects.test<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-gcov-two-objects.test?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-gcov-two-objects.test?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/instrprof-gcov-two-objects.test
(added)<br>
+++
compiler-rt/trunk/test/profile/instrprof-gcov-two-objects.test
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,18 @@<br>
+RUN: mkdir -p %t.d<br>
+RUN: cd %t.d<br>
+<br>
+RUN: %clang --coverage -o instrprof-shared-lib.o -c
%S/Inputs/instrprof-shared-lib.c<br>
+RUN: test -f instrprof-shared-lib.gcno<br>
+<br>
+RUN: %clang --coverage -o instrprof-shared-main.o -c
%S/Inputs/instrprof-shared-main.c<br>
+RUN: test -f instrprof-shared-main.gcno<br>
+<br>
+RUN: %clang --coverage -o %t instrprof-shared-main.o
instrprof-shared-lib.o<br>
+RUN: test -f %t<br>
+<br>
+RUN: %run %t<br>
+RUN: llvm-cov gcov instrprof-shared-main.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-shared-main.c.gcov
%S/Inputs/instrprof-shared-main.c.gcov<br>
+RUN: llvm-cov gcov instrprof-shared-lib.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-shared-lib.c.gcov
%S/Inputs/instrprof-shared-lib_in-loop.c.gcov<br>
+RUN: rm instrprof-shared-main.gcda
instrprof-shared-lib.gcda<br>
<br>
Added:
compiler-rt/trunk/test/profile/instrprof-shared-gcov-flush.test<br>
URL: <a
href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-shared-gcov-flush.test?rev=336365&view=auto"
target="_blank" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-shared-gcov-flush.test?rev=336365&view=auto</a><br>
==============================================================================<br>
---
compiler-rt/trunk/test/profile/instrprof-shared-gcov-flush.test
(added)<br>
+++
compiler-rt/trunk/test/profile/instrprof-shared-gcov-flush.test
Thu Jul 5 08:52:59 2018<br>
@@ -0,0 +1,49 @@<br>
+RUN: mkdir -p %t.d<br>
+RUN: cd %t.d<br>
+<br>
+RUN: %clang --coverage -o libfunc.so -fPIC -shared
%S/Inputs/instrprof-shared-lib.c<br>
+RUN: test -f instrprof-shared-lib.gcno<br>
+<br>
+# Test the case where we exit abruptly after calling
__gcov_flush, which means we don't write out the counters
at exit.<br>
+RUN: %clang -DEXIT_ABRUPTLY
-DSHARED_CALL_BEFORE_GCOV_FLUSH
-DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o %t -L%t.d
-rpath %t.d -lfunc
%S/Inputs/instrprof-shared-main-gcov-flush.c<br>
+RUN: test -f instrprof-shared-main-gcov-flush.gcno<br>
+<br>
+RUN: %run %t<br>
+RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-shared-main-gcov-flush.c.gcov
%S/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov<br>
+RUN: llvm-cov gcov instrprof-shared-lib.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-shared-lib.c.gcov
%S/Inputs/instrprof-shared-lib.c.gcov<br>
+RUN: rm instrprof-shared-main-gcov-flush.gcda
instrprof-shared-lib.gcda<br>
+<br>
+# Test the case where we exit normally and we have a call
to the shared library function before __gcov_flush.<br>
+RUN: %clang -DSHARED_CALL_BEFORE_GCOV_FLUSH --coverage -o
%t -L%t.d -rpath %t.d -lfunc
%S/Inputs/instrprof-shared-main-gcov-flush.c<br>
+RUN: test -f instrprof-shared-main-gcov-flush.gcno<br>
+<br>
+RUN: %run %t<br>
+RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-shared-main-gcov-flush.c.gcov
%S/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov<br>
+RUN: llvm-cov gcov instrprof-shared-lib.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-shared-lib.c.gcov
%S/Inputs/instrprof-shared-lib.c.gcov<br>
+RUN: rm instrprof-shared-main-gcov-flush.gcda
instrprof-shared-lib.gcda<br>
+<br>
+# Test the case where we exit normally and we have a call
to the shared library function after __gcov_flush.<br>
+RUN: %clang -DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o
%t -L%t.d -rpath %t.d -lfunc
%S/Inputs/instrprof-shared-main-gcov-flush.c<br>
+RUN: test -f instrprof-shared-main-gcov-flush.gcno<br>
+<br>
+RUN: %run %t<br>
+RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-shared-main-gcov-flush.c.gcov
%S/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov<br>
+RUN: llvm-cov gcov instrprof-shared-lib.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-shared-lib.c.gcov
%S/Inputs/instrprof-shared-lib.c.gcov<br>
+RUN: rm instrprof-shared-main-gcov-flush.gcda
instrprof-shared-lib.gcda<br>
+<br>
+# Test the case where we exit normally and we have calls
to the shared library function before and after
__gcov_flush.<br>
+RUN: %clang -DSHARED_CALL_BEFORE_GCOV_FLUSH
-DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o %t -L%t.d
-rpath %t.d -lfunc
%S/Inputs/instrprof-shared-main-gcov-flush.c<br>
+RUN: test -f instrprof-shared-main-gcov-flush.gcno<br>
+<br>
+RUN: %run %t<br>
+RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-shared-main-gcov-flush.c.gcov
%S/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov<br>
+RUN: llvm-cov gcov instrprof-shared-lib.gcda<br>
+RUN: FileCheck --match-full-lines --strict-whitespace
--input-file instrprof-shared-lib.c.gcov
%S/Inputs/instrprof-shared-lib_called-twice.c.gcov<br>
+RUN: rm instrprof-shared-main-gcov-flush.gcda
instrprof-shared-lib.gcda<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a
href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits"
target="_blank" moz-do-not-send="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a></font><br>
</div>
</blockquote>
<div dir="ltr"> </div>
</div>
<br>
</blockquote>
<br>
</body>
</html>