[v2] criu: add -fprofile-update=atomic for builds with gcov

Submitted by Andrey Vagin on March 7, 2018, 10:49 p.m.

Details

Message ID 20180307224954.14139-1-avagin@virtuozzo.com
State Accepted
Series "criu: add -fprofile-update=atomic for builds with gcov"
Commit 44dadb9a56eb1f960e24792a8e8afc17093b520b
Headers show

Commit Message

Andrey Vagin March 7, 2018, 10:49 p.m.
Sometimes we see errors like this:
criu/cr-restore.gcda:Merge mismatch for function 106

It proabably means that this gcda file was corrupted. According to the
gcc man page, the -fprofile-update=atomic should fix this problem.

v2: this options appered in gcc7, so we need to install it.

Reported-by: Mr Travis CI
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
---
 .travis.yml                 | 3 ++-
 Makefile                    | 2 +-
 scripts/travis/travis-tests | 9 ++++++++-
 3 files changed, 11 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/.travis.yml b/.travis.yml
index cd33019cc..538cd2221 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,7 @@  cache: ccache
 services:
   - docker
 env:
-  - TR_ARCH=local       GCOV=1
+  - TR_ARCH=local
   - TR_ARCH=local       CLANG=1
   - TR_ARCH=alpine
   - TR_ARCH=fedora-asan
@@ -23,6 +23,7 @@  env:
   - TR_ARCH=fedora-rawhide
   - TR_ARCH=fedora-rawhide-aarch64
   - TR_ARCH=phaul-test
+  - TR_ARCH=local       GCOV=1
 matrix:
   allow_failures:
     - env: TR_ARCH=docker-test
diff --git a/Makefile b/Makefile
index 6cdda4630..bdfb55b26 100644
--- a/Makefile
+++ b/Makefile
@@ -91,7 +91,7 @@  DEFINES			+= -D_GNU_SOURCE
 
 WARNINGS		:= -Wall -Wformat-security
 
-CFLAGS-GCOV		:= --coverage -fno-exceptions -fno-inline
+CFLAGS-GCOV		:= --coverage -fno-exceptions -fno-inline -fprofile-update=atomic
 export CFLAGS-GCOV
 
 ifneq ($(GCOV),)
diff --git a/scripts/travis/travis-tests b/scripts/travis/travis-tests
index 6cfc81f52..0a0db0b3e 100755
--- a/scripts/travis/travis-tests
+++ b/scripts/travis/travis-tests
@@ -20,6 +20,13 @@  travis_prep () {
 		CC=clang
 	fi
 
+	[ -n "$GCOV" ] && {
+		apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
+		apt-get update -yq
+		apt-get -yq --no-install-suggests --no-install-recommends --force-yes install g++-7
+		CC=gcc-7
+	}
+
 	# ccache support, only enable for non-GCOV case
 	if [ "$CCACHE" = "1" -a -z "$GCOV" ]; then
 		# ccache is installed by default, need to set it up
@@ -99,7 +106,7 @@  bash ./test/jenkins/criu-inhfd.sh
 
 make -C test/others/mnt-ext-dev/ run
 #make -C test/others/exec/ run
-make -C test/others/make/ run
+make -C test/others/make/ run CC="$CC"
 
 ./test/zdtm.py run -t zdtm/static/env00 --sibling
 

Comments

Andrey Vagin March 23, 2018, 12:43 a.m.
Applied

On Thu, Mar 08, 2018 at 01:49:54AM +0300, Andrei Vagin wrote:
> Sometimes we see errors like this:
> criu/cr-restore.gcda:Merge mismatch for function 106
> 
> It proabably means that this gcda file was corrupted. According to the
> gcc man page, the -fprofile-update=atomic should fix this problem.
> 
> v2: this options appered in gcc7, so we need to install it.
> 
> Reported-by: Mr Travis CI
> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
> ---
>  .travis.yml                 | 3 ++-
>  Makefile                    | 2 +-
>  scripts/travis/travis-tests | 9 ++++++++-
>  3 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index cd33019cc..538cd2221 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -5,7 +5,7 @@ cache: ccache
>  services:
>    - docker
>  env:
> -  - TR_ARCH=local       GCOV=1
> +  - TR_ARCH=local
>    - TR_ARCH=local       CLANG=1
>    - TR_ARCH=alpine
>    - TR_ARCH=fedora-asan
> @@ -23,6 +23,7 @@ env:
>    - TR_ARCH=fedora-rawhide
>    - TR_ARCH=fedora-rawhide-aarch64
>    - TR_ARCH=phaul-test
> +  - TR_ARCH=local       GCOV=1
>  matrix:
>    allow_failures:
>      - env: TR_ARCH=docker-test
> diff --git a/Makefile b/Makefile
> index 6cdda4630..bdfb55b26 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -91,7 +91,7 @@ DEFINES			+= -D_GNU_SOURCE
>  
>  WARNINGS		:= -Wall -Wformat-security
>  
> -CFLAGS-GCOV		:= --coverage -fno-exceptions -fno-inline
> +CFLAGS-GCOV		:= --coverage -fno-exceptions -fno-inline -fprofile-update=atomic
>  export CFLAGS-GCOV
>  
>  ifneq ($(GCOV),)
> diff --git a/scripts/travis/travis-tests b/scripts/travis/travis-tests
> index 6cfc81f52..0a0db0b3e 100755
> --- a/scripts/travis/travis-tests
> +++ b/scripts/travis/travis-tests
> @@ -20,6 +20,13 @@ travis_prep () {
>  		CC=clang
>  	fi
>  
> +	[ -n "$GCOV" ] && {
> +		apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
> +		apt-get update -yq
> +		apt-get -yq --no-install-suggests --no-install-recommends --force-yes install g++-7
> +		CC=gcc-7
> +	}
> +
>  	# ccache support, only enable for non-GCOV case
>  	if [ "$CCACHE" = "1" -a -z "$GCOV" ]; then
>  		# ccache is installed by default, need to set it up
> @@ -99,7 +106,7 @@ bash ./test/jenkins/criu-inhfd.sh
>  
>  make -C test/others/mnt-ext-dev/ run
>  #make -C test/others/exec/ run
> -make -C test/others/make/ run
> +make -C test/others/make/ run CC="$CC"
>  
>  ./test/zdtm.py run -t zdtm/static/env00 --sibling
>  
> -- 
> 2.13.6
>