This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Fix "make install"


Janis reported that "make install" no longer works for V3 after "make
check" in the presence of multilibs.  I think this patch will fix it,
though it's a little hard to say for certain.  The key idea is to move
building abi_check into DejaGNU.  As a result, it's more likely that
"make check-abi" will work in a cross configuration; we get to take
advantage of DejaGNU's ability to run programs on remote hosts.  (It
still probably won't quite work on all targets due to the fact that
rsh doesn't propagate exit codes.)

I modified abi_check to return a non-zero exit code when it finds a
missing symbol or one whose size has changed.  I removed "make
check-abi-verbose" and instead had DejaGNU always pass the "--verbose"
option, since the output goes into the DejaGNU log, and DejaGNU will
print the key pass/fail information.

I tested this by using "make check-abi" with an intentionally broken
current_symbols.txt file to make sure that it failed, and with a
non-broken file to make sure it passed.  

Janis, does this patch work for you?  V3 maintainers, OK to apply?

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-03-31  Mark Mitchell  <mark@codesourcery.com>

	* testsuite/Makefile.am (noinst_PROGRAMS): Remove.
	(site.exp): Write out the path to the baseline file.
	(check-abi): Use DejaGNU.
	(check-abi-verbose): Remove.
	* testsuite/Makefile.in: Regenerated.
	* testsuite/abi_check.cc (main): Check the return value from
	compare_symbols.
	* testsuite/testsuite_abi.cc (compare_symbols): Return a value.
	* testsuite/testsuite_abi.h (compare_symbols): Adjust prototype.
	* testsuite/libstdc++-abi/abi.exp: New file.
	* testsuite/lib/libstdc++.exp (v3-build_support): Don't rebuild
	objects that have already been built.

Index: testsuite/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/Makefile.am,v
retrieving revision 1.43
diff -c -5 -p -r1.43 Makefile.am
*** testsuite/Makefile.am	24 Mar 2005 06:54:46 -0000	1.43
--- testsuite/Makefile.am	31 Mar 2005 08:35:04 -0000
*************** noinst_LIBRARIES = libv3test.a
*** 47,65 ****
  libv3test_a_SOURCES = \
  	testsuite_abi.cc \
  	testsuite_allocator.cc \
  	testsuite_hooks.cc 
  
- ## Build support utilities.
- if GLIBCXX_TEST_ABI
- noinst_PROGRAMS = abi_check
- else
- noinst_PROGRAMS =
- endif
- abi_check_SOURCES = abi_check.cc
- abi_check_DEPENDENCIES = libv3test.a
- 
  all-local: stamp_wchar stamp_thread
  
  # Enable wchar_t tests if capable.
  if GLIBCXX_TEST_WCHAR_T
  stamp_wchar:
--- 47,56 ----
*************** site.exp: Makefile
*** 101,110 ****
--- 92,102 ----
  	@echo 'set host_triplet $(host_triplet)' >>site.tmp
  	@echo 'set target_alias "$(target_alias)"' >>site.tmp
  	@echo 'set target_triplet $(target_triplet)' >>site.tmp
  	@echo 'set target_triplet $(target_triplet)' >>site.tmp
  	@echo 'set libiconv "$(LIBICONV)"' >>site.tmp
+ 	@echo 'set baseline_file "$(baseline_file)"' >> site.tmp
  	@echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
  	@test ! -f site.exp || \
  	  sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
  	@-rm -f site.bak
  	@test ! -f site.exp || mv site.exp site.bak
*************** new-abi-baseline:
*** 138,160 ****
  	  ${extract_symvers} ../src/.libs/libstdc++.so $${output})
  
  if GLIBCXX_TEST_ABI
  # Use 'new-abi-baseline' to create an initial symbol file.  Then run
  # 'check-abi' to test for changes against that file.
! check-abi: abi_check baseline_symbols current_symbols.txt
! 	-@./abi_check --check ./current_symbols.txt ${baseline_file} \
! 	  2>&1 | tee libstdc++-abi.sum
! 	-@cp libstdc++-abi.sum libstdc++-abi.log
! 
! check-abi-verbose: abi_check baseline_symbols current_symbols.txt
! 	-@./abi_check --check-verbose ./current_symbols.txt ${baseline_file} \
! 	  2>&1 | tee libstdc++-abi.sum
! 	-@cp libstdc++-abi.sum libstdc++-abi.log
! 
  else
  check-abi:
- check-abi-verbose:
  endif
  
  
  # These two special 'check-script' rules use the bash script
  # 'check_survey' to do testing. This script is not as portable as the
--- 130,143 ----
  	  ${extract_symvers} ../src/.libs/libstdc++.so $${output})
  
  if GLIBCXX_TEST_ABI
  # Use 'new-abi-baseline' to create an initial symbol file.  Then run
  # 'check-abi' to test for changes against that file.
! check-abi: baseline_symbols current_symbols.txt site.exp
! 	-@runtest --tool libstdc++ abi.exp
  else
  check-abi:
  endif
  
  
  # These two special 'check-script' rules use the bash script
  # 'check_survey' to do testing. This script is not as portable as the
Index: testsuite/abi_check.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/abi_check.cc,v
retrieving revision 1.21
diff -c -5 -p -r1.21 abi_check.cc
*** testsuite/abi_check.cc	22 May 2004 17:08:02 -0000	1.21
--- testsuite/abi_check.cc	31 Mar 2005 08:17:15 -0000
*************** main(int argc, char** argv)
*** 75,85 ****
        if (access(baseline_file, R_OK) != 0)
  	{
  	  cerr << "Cannot read baseline file " << baseline_file << endl;
  	exit(1);
  	}
!       compare_symbols(baseline_file, test_file, verbose);
      }
    
    if (argv1 == "--examine")
      {
        const char* file = argv[3];
--- 75,86 ----
        if (access(baseline_file, R_OK) != 0)
  	{
  	  cerr << "Cannot read baseline file " << baseline_file << endl;
  	exit(1);
  	}
!       if (!compare_symbols(baseline_file, test_file, verbose))
! 	exit (1);
      }
    
    if (argv1 == "--examine")
      {
        const char* file = argv[3];
Index: testsuite/testsuite_abi.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/testsuite_abi.cc,v
retrieving revision 1.9
diff -c -5 -p -r1.9 testsuite_abi.cc
*** testsuite/testsuite_abi.cc	1 Mar 2005 03:52:36 -0000	1.9
--- testsuite/testsuite_abi.cc	31 Mar 2005 08:17:15 -0000
*************** examine_symbol(const char* name, const c
*** 279,289 ****
      }
    catch(...)
      { __throw_exception_again; }
  }
  
! void 
  compare_symbols(const char* baseline_file, const char* test_file, 
  		bool verbose)
  {
    // Input both lists of symbols into container.
    symbols baseline = create_symbols(baseline_file);
--- 279,289 ----
      }
    catch(...)
      { __throw_exception_again; }
  }
  
! int
  compare_symbols(const char* baseline_file, const char* test_file, 
  		bool verbose)
  {
    // Input both lists of symbols into container.
    symbols baseline = create_symbols(baseline_file);
*************** compare_symbols(const char* baseline_fil
*** 391,400 ****
--- 391,402 ----
    cout << "# of added symbols:\t\t " << added_names.size() << endl;
    cout << "# of missing symbols:\t\t " << missing_names.size() << endl;
    cout << "# of incompatible symbols:\t " << incompatible.size() << endl;
    cout << endl;
    cout << "using: " << baseline_file << endl;
+ 
+   return !(missing_names.size() || incompatible.size());
  }
  
  
  symbols
  create_symbols(const char* file)
Index: testsuite/testsuite_abi.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/testsuite_abi.h,v
retrieving revision 1.2
diff -c -5 -p -r1.2 testsuite_abi.h
*** testsuite/testsuite_abi.h	6 Jan 2005 07:08:48 -0000	1.2
--- testsuite/testsuite_abi.h	31 Mar 2005 08:17:15 -0000
*************** symbol&
*** 92,102 ****
  get_symbol(const std::string& mangled, const symbols& list);
  
  extern "C" void
  examine_symbol(const char* name, const char* file);
  
! extern "C" void
  compare_symbols(const char* baseline_file, const char* test_file, bool verb);
  
  
  // Util.
  symbols
--- 92,102 ----
  get_symbol(const std::string& mangled, const symbols& list);
  
  extern "C" void
  examine_symbol(const char* name, const char* file);
  
! extern "C" int
  compare_symbols(const char* baseline_file, const char* test_file, bool verb);
  
  
  // Util.
  symbols
Index: testsuite/lib/libstdc++.exp
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/lib/libstdc++.exp,v
retrieving revision 1.36
diff -c -5 -p -r1.36 libstdc++.exp
*** testsuite/lib/libstdc++.exp	25 Mar 2005 23:24:57 -0000	1.36
--- testsuite/lib/libstdc++.exp	31 Mar 2005 08:17:56 -0000
*************** proc v3-build_support {} {
*** 302,311 ****
--- 302,317 ----
      global srcdir
      global v3-wchar_t
      global v3-threads
      global v3-test_objs
  
+     # If we have already built the support objects, we do not need to
+     # build them again.
+     if { ${v3-test_objs} != "" } {
+ 	return
+     }
+ 
      # Figure out whether or not the library supports certain features.
      set v3-wchar_t 0
      set v3-threads 0
      set v3-test_objs ""
  
Index: testsuite/libstdc++-abi/abi.exp
===================================================================
RCS file: testsuite/libstdc++-abi/abi.exp
diff -N testsuite/libstdc++-abi/abi.exp
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/libstdc++-abi/abi.exp	31 Mar 2005 08:32:14 -0000
***************
*** 0 ****
--- 1,36 ----
+ # Copyright (C) 2005 Free Software Foundation, Inc.
+ #
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 2 of the License, or
+ # (at your option) any later version.
+ # 
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ # GNU General Public License for more details.
+ # 
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+ 
+ # If there is no current_symbols.txt file, then skip this test.
+ if { ![file exists "current_symbols.txt"] } {
+     return
+ }
+ 
+ # Build the support objects.
+ v3-build_support
+ 
+ # Build the abi_check program.
+ if { [v3_target_compile "$srcdir/abi_check.cc" "abi_check" \
+       "executable" [list "additional_flags=-w"]] != "" } {
+     error "could not compile abi_check.cc"
+ }
+ 
+ remote_download "target" $baseline_file "baseline_symbols.txt"
+ remote_download "target" "current_symbols.txt" "current_symbols.txt"
+ set result [${tool}_load "./abi_check" \
+ 		[list "--check-verbose" "current_symbols.txt" \
+ 		     "baseline_symbols.txt"]]
+ [lindex $result 0] "abi_check"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]