diff options
| author | Havoc Pennington <hp@redhat.com> | 2004-12-24 17:54:01 +0000 | 
|---|---|---|
| committer | Havoc Pennington <hp@redhat.com> | 2004-12-24 17:54:01 +0000 | 
| commit | b8a309ac940374ead27618508ab8f81665ff7d9d (patch) | |
| tree | daa672a607300f214848db72737fa7cdbc46cad8 | |
| parent | f019ebdd20fd92f81117515f683872ff36b24b09 (diff) | |
2004-12-24  Havoc Pennington  <hp@redhat.com>
	* test/decode-gcov.c: change to use .gcno and .gcda files, but the
	file format has also changed and I haven't adapted to that yet
	* Makefile.am: load .gcno files from latest gcc
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | Makefile.am | 28 | ||||
| -rw-r--r-- | test/decode-gcov.c | 43 | 
3 files changed, 54 insertions, 24 deletions
@@ -1,3 +1,10 @@ +2004-12-24  Havoc Pennington  <hp@redhat.com> + +	* test/decode-gcov.c: change to use .gcno and .gcda files, but the +	file format has also changed and I haven't adapted to that yet +	 +	* Makefile.am: load .gcno files from latest gcc +  2004-12-23  John (J5) Palmieri  <johnp@redhat.com>  	* Patch from Rob Taylor <robtaylor@fastmail.fm> diff --git a/Makefile.am b/Makefile.am index 47ac1def..886618b9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -59,20 +59,20 @@ GCOV_DIRS=dbus bus $(GLIB_SUBDIR) $(QT_SUBDIR)  ## .PHONY so it always rebuilds it  .PHONY: coverage-report.txt  coverage-report.txt: -	BBG_FILES=`find $(GCOV_DIRS) -name "*.bbg"` ;				  \ -	C_FILES= ;								  \ -	for F in $$BBG_FILES ; do						  \ -		F_nolibs=`echo $$F | sed -e 's/.libs\///g'` ;			  \ -		C=`echo $$F_nolibs | sed -e 's/.bbg/.c/g'` ;			  \ -		B=`basename $$F .bbg` ;						  \ -		D=`dirname $$F` ;						  \ -		DA=`echo $$F | sed -e 's/.bbg/.da/g'` ;				  \ -		DA_libs=`echo $$D/.libs/$$B/.da` ;				  \ -		if test -e $$DA || test -e $$DA_libs; then			  \ -			C_FILES="$$C_FILES $$C" ;				  \ -		fi ;								  \ -	done ;									  \ -	echo $$C_FILES ;							  \ +	BBG_FILES=`find $(GCOV_DIRS) -name "*.bbg" -o -name "*.gcno"` ;			\ +	C_FILES= ;									\ +	for F in $$BBG_FILES ; do							\ +		F_nolibs=`echo $$F | sed -e 's/.libs\///g'` ;				\ +		C=`echo $$F_nolibs | sed -e 's/.bbg/.c/g' | sed -e 's/.gcno/.c/g'`  ;	\ +		B=`basename $$F .bbg` ;							\ +		D=`dirname $$F` ;							\ +		DA=`echo $$F | sed -e 's/.bbg/.da/g'` ;					\ +		DA_libs=`echo $$D/.libs/$$B/.da` ;					\ +		if test -e $$DA || test -e $$DA_libs; then				\ +			C_FILES="$$C_FILES $$C" ;					\ +		fi ;									\ +	done ;										\ +	echo $$C_FILES ;								\  	$(top_builddir)/test/decode-gcov --report $$C_FILES > coverage-report.txt  check-coverage: clean-gcov all check coverage-report.txt diff --git a/test/decode-gcov.c b/test/decode-gcov.c index b084d0d0..5235a1c5 100644 --- a/test/decode-gcov.c +++ b/test/decode-gcov.c @@ -1274,15 +1274,26 @@ load_functions_for_c_file (const DBusString *filename,  {    DBusString bbg_filename;    DBusString da_filename; +  DBusString gcno_filename; +  DBusString gcda_filename;    DBusString contents; +  DBusString *name;    DBusError error; +  /* With latest gcc it's .gcno instead of .bbg and +   * gcda instead of .da +   */ +      dbus_error_init (&error);    if (!_dbus_string_init (&bbg_filename) ||        !_dbus_string_init (&da_filename) || +      !_dbus_string_init (&gcno_filename) || +      !_dbus_string_init (&gcda_filename) ||        !_dbus_string_copy (filename, 0, &bbg_filename, 0) ||        !_dbus_string_copy (filename, 0, &da_filename, 0) || +      !_dbus_string_copy (filename, 0, &gcno_filename, 0) || +      !_dbus_string_copy (filename, 0, &gcda_filename, 0) ||        !_dbus_string_init (&contents))      die ("no memory\n"); @@ -1290,10 +1301,17 @@ load_functions_for_c_file (const DBusString *filename,    _dbus_string_shorten (&da_filename, 2);    if (!_dbus_string_append (&bbg_filename, ".bbg") || -      !_dbus_string_append (&da_filename, ".da")) +      !_dbus_string_append (&da_filename, ".da") || +      !_dbus_string_append (&bbg_filename, ".gcno") || +      !_dbus_string_append (&bbg_filename, ".gcda"))      die ("no memory\n"); -       -  if (!_dbus_file_get_contents (&contents, &bbg_filename, + +  if (_dbus_file_exists (_dbus_string_get_const_data (&gcno_filename))) +    name = &gcno_filename; +  else +    name = &bbg_filename; +   +  if (!_dbus_file_get_contents (&contents, name,                                  &error))      {        fprintf (stderr, "Could not open file: %s\n", @@ -1305,25 +1323,30 @@ load_functions_for_c_file (const DBusString *filename,    _dbus_string_set_length (&contents, 0); -  if (!_dbus_file_get_contents (&contents, &da_filename, +  if (_dbus_file_exists (_dbus_string_get_const_data (&gcda_filename))) +    name = &gcda_filename; +  else +    name = &da_filename; +   +  if (!_dbus_file_get_contents (&contents, name,                                  &error))      {        /* Try .libs/file.da */        int slash; -      if (_dbus_string_find_byte_backward (&da_filename, -                                            _dbus_string_get_length (&da_filename), -                                            '/', -                                            &slash)) +      if (_dbus_string_find_byte_backward (name, +                                           _dbus_string_get_length (name), +                                           '/', +                                           &slash))          {            DBusString libs;            _dbus_string_init_const (&libs, "/.libs"); -          if (!_dbus_string_copy (&libs, 0, &da_filename, slash)) +          if (!_dbus_string_copy (&libs, 0, name, slash))              die ("no memory");            dbus_error_free (&error); -          if (!_dbus_file_get_contents (&contents, &da_filename, +          if (!_dbus_file_get_contents (&contents, name,                                          &error))              {                fprintf (stderr, "Could not open file: %s\n",  | 
