hammock:
[nethome.git] / bin / hammock
index f742304..d3851e7 100755 (executable)
@@ -30,6 +30,7 @@ my $parallel=1;
 my @distro;
 my @componentdistro;
 my @path;
+my @prefixpath;
 my @arch;
 my $component;
 my $srcrpm;
@@ -50,9 +51,11 @@ my $gdbserver;
 my $valgrind;
 my $bfd32;
 my $gdbindex;
+my $dwz;
 my $dwarf;
 # Use --dwarf=40 for: --dwarf=4 -fno-debug-types-section
 # Use --dwarf=41 for: --dwarf=4    -fdebug-types-section
+my $optimg;
 my $stabs;
 my $debug_types_section;
 my $orphanripper=1;
@@ -65,6 +68,7 @@ die if !GetOptions(
   "d|distro=s{,}"=>\@distro,
     "cd|componentdistro=s{,}"=>\@componentdistro,
   "p|path=s{,}"=>\@path,
+  "P|prefixpath=s{,}"=>\@prefixpath,
   "a|arch=s{,}"=>\@arch,
   "c|component=s"=>\$component,
   "s|srcrpm=s"=>\$srcrpm,
@@ -79,7 +83,9 @@ die if !GetOptions(
     "valgrind"=>\$valgrind,
     "bfd32"=>\$bfd32,
     "gdbindex"=>\$gdbindex,
+    "dwz"=>\$dwz,
     "dwarf=i"=>\$dwarf,
+    "optimg"=>\$optimg,
     "stabs=i"=>\$stabs,
     "orphanripper!"=>\$orphanripper,
     "options=s"=>\$options,
@@ -91,7 +97,8 @@ $component or $srcrpm or die "-c|--component or -s|--srcrpm required";
 $component||="";  # Make `eq' not complaining.
 my $cvsbranch;
 if ($component=~/^(gdb|binutils)cvs$/) {
-  $cvsbranch=(!$branch?"-A":"-r $branch");
+  $cvsbranch=(!$branch?"":"-r $branch"); # "-A" is broken with new sourceware.org
+  $gdbcvsmaster=$ENV{"HOME"}."/redhat/gdb-cvs-master74" if ($branch||"") eq "gdb_7_4-branch";
 } else {
   die "--branch currently unsupported for non-CVS sources" if $branch;
 }
@@ -102,12 +109,12 @@ $options and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--options is a
 $gdbserver and $component!~/^(?:gdbcvs|archer-.*)$/ and die "--gdbserver is available only for gdbcvs or archer-*";
 $valgrind and $component!~/^(?:gdbcvs|archer-.*)$/ and die "--valgrind is available only for gdbcvs or archer-*";
 $gdbserver and $valgrind and die "--gdbserver and --valgrind are mutually exclusive";
-($gdbserver || $valgrind) and $gdbindex and die "--gdbserver|--valgrind and --gdbindex are mutually exclusive";
+($gdbserver || $valgrind) and ($gdbindex || $dwz) and die "--gdbserver|--valgrind and --gdbindex|--dwz are mutually exclusive";
 do { $debug_types_section=0; $dwarf=4; } if ($dwarf||0)==40;
 do { $debug_types_section=1; $dwarf=4; } if ($dwarf||0)==41;
 !defined $dwarf or ($dwarf>=2 && $dwarf<=4) or die "--dwarf requires DWARF version number";
 !defined $stabs or ($stabs>=0 && $stabs<=2) or die "--stabs is 0=off or 1=-gstabs or 2=-gstabs+";
-($gdbserver || $valgrind || $gdbindex) and ($dwarf || $stabs) and die "--gdbserver|--valgrind|--gdbindex and --dwarf|--stabs are mutually exclusive";
+($gdbserver || $valgrind || $gdbindex || $dwz) and ($dwarf || $stabs) and die "--gdbserver|--valgrind|--gdbindex and --dwarf|--stabs are mutually exclusive";
 $orphanripper=($orphanripper?"orphanripper":"");
 my %target;
 do { error "Duplicate target: $_\n" if $target{$_}++; } for @target;
@@ -115,8 +122,8 @@ do { error "Duplicate target: $_\n" if $target{$_}++; } for @target;
 for my $file (@file) {
   -f $file and -r $file or error "-f|--file $file not readable: $!";
 }
-push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-index-assert.patch" if $component=~/^(?:gdbcvs|archer-)/;
-push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-dejagnu-go.patch"   if $component=~/^(?:gdbcvs|archer-)/;
+###push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-index-assert.patch" if $component=~/^(?:gdbcvs|archer-)/;
+###push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-dejagnu-go.patch"   if $component=~/^(?:gdbcvs|archer-)/;
 $distrojobs=(@target?1:2) if !defined $distrojobs;
 $distrojobs=~/^\d+$/ or die "-D|distrojobs must be a number: $distrojobs";
 $distrojobs>=1 or die "-D|distrojobs must be positive: $distrojobs";
@@ -125,7 +132,9 @@ error "Excessive arguments: @ARGV" if @ARGV;
 my $path=join(":",@path) if @path;
 @componentdistro and @componentdistro!=@distro and die "--cd|--componentdistro must have the same elements count as -d|--distro";
 
-###unshift @file,"/home/jkratoch/t/gdbservergnulib.patch" if $component eq "gdbcvs";
+#FIXME:push @file,"/home/jkratoch/t/gdbserverasyncnonstop.patch" if $component=~/^(?:gdbcvs|archer-)/;
+push @file,"/home/jkratoch/t/watchpointfork2.patch" if $component=~/^(?:gdbcvs|archer-)/;
+#push @file,"/home/jkratoch/t/gdb-breakpointchanged.patch" if $component=~/^(?:gdbcvs|archer-)/;
 
 sub distro_normalize($;$)
 {
@@ -264,6 +273,7 @@ unlink $resultidxz or $!{ENOENT} or die "unlink $resultidxz: $!";
 spawn "uname -r >$dir/kernel";
 my %dump=(
   "path"=>$path,
+  "prefixpath"=>join(":",@prefixpath),
   "component"=>$component,
   "branch"=>$branch,
   "srcrpm"=>$srcrpm,
@@ -274,7 +284,9 @@ my %dump=(
   "valgrind"=>$valgrind,
   "bfd32"=>$bfd32,
   "gdbindex"=>$gdbindex,
+  "dwz"=>$dwz,
   "dwarf"=>$dwarf,
+  "optimg"=>$optimg,
   "stabs"=>$stabs,
   "debug_types_section"=>$debug_types_section,
   "orphanripper"=>$orphanripper,
@@ -388,6 +400,10 @@ while (@distrouse || keys(%child)) {
       my($c)=@_;
 
       $c="export PATH=\"$path:\$PATH\"; $c" if $path;
+      for my $prefixpath (@prefixpath) {
+       $c="export PATH=\"$prefixpath/bin:\$PATH\"; $c";
+       $c="export LD_LIBRARY_PATH=\"$prefixpath/lib64:$prefixpath/lib\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH}\"; $c";
+      }
       $c="export PATH=\"\$HOME/bin:\$PATH\"; $c";
       $c="export MAKEFLAGS=\"-j\$[`getconf _NPROCESSORS_ONLN`*3/2]\"; $c";
       $c="export http_proxy=http://127.0.0.1:3128/; $c";
@@ -532,22 +548,26 @@ while (@distrouse || keys(%child)) {
          (my $q2=$q1)=~s/ /\\ /g;
          return ' RUNTESTFLAGS="'.join(' ',map($_.'='.$flags{$_}.'\ '.$q1,keys(%flags))).' GNATMAKE_FOR_TARGET=gnatmake\ --GCC=gcc\\ '.$q2.'"';
        }
+       die "FIXME" if $valgrind;
+         # .(!$valgrind?"":' RUNTESTFLAGS=--target_board=valgrind')
+         # .(!$valgrind?"":' HAMMOCK_VALGRIND=1')
+         # .(!$valgrind?"":' --without-python')        # FIXME: Fix valgrind --suppressions
        mockrun "cd $baretestsuite;"
-               .(!$valgrind?"":' HAMMOCK_VALGRIND=1')
                ." $errs12"
-               .(!$valgrind?"":' --without-python')    # FIXME: Fix valgrind --suppressions
                .(!$bfd32?"":' --disable-64-bit-bfd')
-               ."; cd gdb; ulimit -c unlimited; "
-               .(!$gdbserver?"":'DEJAGNU=$HOME/src/runtest-gdbserver/site.exp ')
-               .(!$valgrind?"":'DEJAGNU=$HOME/src/runtest-valgrind/site.exp ')
+               ."; cd gdb; ulimit -c unlimited; DEJAGNU=$baretestsuite/site.exp "
                ."$orphanripper make -k ".join(" ",@check)
                # Ensure serial run if FORCE_PARALLEL=1 is not present
                ." RUNTESTFLAGS=DUMMY=dummy"
                .(!$gdbserver?"":' RUNTESTFLAGS=--target_board=native-gdbserver')
-               .(!$valgrind?"":' RUNTESTFLAGS=--target_board=valgrind')
                # Missing GNATMAKE_FOR_TARGET!
-               .(!$gdbindex?"":' RUNTESTFLAGS="'.join(' ',map($_.'=/bin/sh\ $PWD/cc-with-index.sh\ '.$flags{$_},keys(%flags))).'"')
+               .(!($gdbindex||$dwz)?"":' RUNTESTFLAGS="'.join(' ',map($_.'=/bin/sh\ $PWD/contrib/cc-with-tweaks.sh'
+                   .(!$gdbindex?"":'\ -i')
+                   .(!$dwz?"":'\ -m')
+                 .'\ '.$flags{$_},keys(%flags))).'"')
+               #.(!$gdbindex?"":' RUNTESTFLAGS="'.join(' ',map($_.'=/bin/sh\ $PWD/cc-with-index.sh\ '.$flags{$_},keys(%flags))).'"')
                .(!$dwarf?"":runtestcc "-gdwarf-$dwarf".(!defined $debug_types_section?"":'\ '.($debug_types_section?"-fdebug-types-section":"-fno-debug-types-section"))." -g0")
+               .(!$optimg?"":runtestcc "-Og -g0")
                .(!$stabs?"":runtestcc(($stabs==1?"-gstabs":"-gstabs+")." -g0"))
                .(!$parallel?"":' FORCE_PARALLEL=1')
                ." || :; ".q{for t in sum log;do for file in testsuite*/gdb.$t;do suffix="${file#testsuite.unix.}"; suffix="${suffix%/gdb.$t}"; ln $file}." $out/gdb".q{$suffix.$t || :; done; done;};