From 0e42f65d72d188dc0535f5ba70192cae632d5be3 Mon Sep 17 00:00:00 2001 From: Peter Oberparleiter Date: Tue, 30 Jun 2009 11:41:20 -0700 Subject: [PATCH] --- yaml --- r: 154583 b: refs/heads/master c: 972c71a3183ab41c0b1a9e50842be7e3e980954f h: refs/heads/master i: 154581: 0b313dbe8d994dcb70ac7dc7fa6059fa50409312 154579: d2ed18d78918fb93faac734b1e8d5ab1550fa497 154575: cfed10814c0649be502932d230a965bea9a5a5bb v: v3 --- [refs] | 2 +- trunk/Documentation/gcov.txt | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/[refs] b/[refs] index bbb156e6b86d..5ba0379921a8 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b01e8dc34379f4ba2f454390e340a025edbaaa7e +refs/heads/master: 972c71a3183ab41c0b1a9e50842be7e3e980954f diff --git a/trunk/Documentation/gcov.txt b/trunk/Documentation/gcov.txt index e716aadb3a33..40ec63352760 100644 --- a/trunk/Documentation/gcov.txt +++ b/trunk/Documentation/gcov.txt @@ -188,13 +188,18 @@ Solution: Exclude affected source files from profiling by specifying GCOV_PROFILE := n or GCOV_PROFILE_basename.o := n in the corresponding Makefile. +Problem: Files copied from sysfs appear empty or incomplete. +Cause: Due to the way seq_file works, some tools such as cp or tar + may not correctly copy files from sysfs. +Solution: Use 'cat' to read .gcda files and 'cp -d' to copy links. + Alternatively use the mechanism shown in Appendix B. + Appendix A: gather_on_build.sh ============================== Sample script to gather coverage meta files on the build machine (see 6a): - #!/bin/bash KSRC=$1 @@ -226,7 +231,7 @@ Appendix B: gather_on_test.sh Sample script to gather coverage data files on the test machine (see 6b): -#!/bin/bash +#!/bin/bash -e DEST=$1 GCDA=/sys/kernel/debug/gcov @@ -236,11 +241,13 @@ if [ -z "$DEST" ] ; then exit 1 fi -find $GCDA -name '*.gcno' -o -name '*.gcda' | tar cfz $DEST -T - +TEMPDIR=$(mktemp -d) +echo Collecting data.. +find $GCDA -type d -exec mkdir -p $TEMPDIR/\{\} \; +find $GCDA -name '*.gcda' -exec sh -c 'cat < $0 > '$TEMPDIR'/$0' {} \; +find $GCDA -name '*.gcno' -exec sh -c 'cp -d $0 '$TEMPDIR'/$0' {} \; +tar czf $DEST -C $TEMPDIR sys +rm -rf $TEMPDIR -if [ $? -eq 0 ] ; then - echo "$DEST successfully created, copy to build system and unpack with:" - echo " tar xfz $DEST" -else - echo "Could not create file $DEST" -fi +echo "$DEST successfully created, copy to build system and unpack with:" +echo " tar xfz $DEST"