X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=bin%2Fhammock;h=2e6fd32e8d9b25b914bd7a33391370d06d76d089;hp=748bb4327b513e4dc36bab5cef93e27880a5e97b;hb=71174f74e243fc093b9c720180ac0a9cc2db1304;hpb=789133371ca9867b8827aaf443f25357d1de2661 diff --git a/bin/hammock b/bin/hammock index 748bb43..2e6fd32 100755 --- a/bin/hammock +++ b/bin/hammock @@ -9,7 +9,7 @@ my $start=time(); my $gdbcvsmaster=$ENV{"HOME"}."/redhat/gdb-cvs-master"; my $binutilscvsmaster=$ENV{"HOME"}."/redhat/binutils-cvs-master"; -my $archermaster=$ENV{"HOME"}."/redhat/archer-master"; +my $archermaster=$ENV{"HOME"}."/redhat/gdb-master"; my $fedoragitroot=q{git://pkgs.fedoraproject.org}; #Unknown host cvs.devel.redhat.com. #my $rhelcvsroot=q{:pserver:anonymous:@cvs.devel.redhat.com:/cvs/dist}; @@ -28,7 +28,7 @@ sub error my $userid; my $force; -my $parallel=9; # 1 or 2 or 3 +my $parallel=1; my @distro; my @componentdistro; my @path; @@ -51,13 +51,16 @@ my $strip; my $gdbserver; my $valgrind; my $gdbindex; -my $dwarf4; +my $dwarf; +# Use --dwarf=40 for: --dwarf=4 -fno-debug-types-section +# Use --dwarf=41 for: --dwarf=4 -fdebug-types-section +my $debug_types_section; +my $orphanripper=1; die if !GetOptions( "i|userid=s"=>\$userid, "force"=>\$force, - "1|serial"=>sub { $parallel=1; }, - "2|standard"=>sub { $parallel=2; }, - "3|parallel"=>sub { $parallel=3; }, + "serial"=>sub { $parallel=0; }, + "parallel"=>sub { $parallel=1; }, "d|distro=s{,}"=>\@distro, "cd|componentdistro=s{,}"=>\@componentdistro, "p|path=s{,}"=>\@path, @@ -74,7 +77,8 @@ die if !GetOptions( "gdbserver"=>\$gdbserver, "valgrind"=>\$valgrind, "gdbindex"=>\$gdbindex, - "dwarf4"=>\$dwarf4, + "dwarf=i"=>\$dwarf, + "orphanripper!"=>\$orphanripper, ); $component and ($component=~m{^(?:(?:fedora|rhel)(?:gdb|binutils|glibc)|gdbcvs|binutilscvs|archer-.*|/home/.*)$} or die "-c|--component required to be: fedoragdb|rhelgdb|fedorabinutils|rhelbinutils|fedoraglibc|rhelglibc|gdbcvs|binutilscvs|archer-*|/home/*"); $component and $component=~m{^/home/} and (-f "$component/gdb/gdbtypes.c" or die "$component/gdb/gdbtypes.c not found"); @@ -94,7 +98,11 @@ $gdbserver and $component ne "gdbcvs" and die "--gdbserver is available only for $valgrind and $component ne "gdbcvs" and die "--valgrind is available only for gdbcvs"; $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 || $gdbindex) and $dwarf4 and die "--gdbserver|--valgrind|--gdbindex and --dwarf4 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"; +($gdbserver || $valgrind || $gdbindex) and $dwarf and die "--gdbserver|--valgrind|--gdbindex and --dwarf are mutually exclusive"; +$orphanripper=($orphanripper?"orphanripper":""); my %target; do { error "Duplicate target: $_\n" if $target{$_}++; } for @target; @arch="x86_64" if @target&&!@arch; @@ -104,9 +112,6 @@ for my $file (@file) { $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"; -# User may want to modify ASAP her files submitted for the test. -my $will_copy=@file || $component=~m{^/home/}; -$parallel||=$will_copy ? 2 : 1; error "Excessive arguments: @ARGV" if @ARGV; @arch=@arches if !@arch; my $path=join(":",@path) if @path; @@ -216,7 +221,7 @@ sub writefile } # /etc/cgconfig.conf -spawn "echo cgclassify -g '*':hammock $$ || :"; +spawn "cgclassify -g '*':hammock $$ || :"; spawn "renice +19 -p $$"; spawn "ionice -c3 -p $$"; @@ -240,7 +245,9 @@ my %dump=( "gdbserver"=>$gdbserver, "valgrind"=>$valgrind, "gdbindex"=>$gdbindex, - "dwarf4"=>$dwarf4, + "dwarf"=>$dwarf, + "debug_types_section"=>$debug_types_section, + "orphanripper"=>$orphanripper, ); while (my($name,$val)=each(%dump)) { next if !$val; @@ -251,7 +258,7 @@ for my $file (@file) { newdir "$dir/file.d","mayexist"; (my $base=$file)=~s{^.*/}{}; my $d="$dir/file.d/$base"; - link $file,$d or die "link $file $d: $!"; + link $file,$d or spawn "cp -p '$file' '$d'"; newdir "$resultid/file.d","mayexist"; link $d,"$resultid/file.d/$base" or warn "link $file $resultid/file.d/$base: $!"; } @@ -304,7 +311,7 @@ while (@distrouse || keys(%child)) { my $gitrepo; if ($component=~/^fedora(.*)$/) { $gitrepo=$1; - $gitbranch="f$1/master" if $componentdistro=~/^fedora-(\d+)$/; + $gitbranch="f$1" if $componentdistro=~/^fedora-(\d+)$/; $gitbranch="master" if $componentdistro=~/^fedora-rawhide$/; die "$component vs. $componentdistro" if !$gitbranch; $gitroot=$fedoragitroot; @@ -327,7 +334,7 @@ while (@distrouse || keys(%child)) { my $out="$distrodir/out"; newdir $out; - if ($parallel>1) { + if ($parallel) { my $pid=fork(); die if !defined $pid; if ($pid) { @@ -403,8 +410,8 @@ while (@distrouse || keys(%child)) { spawn "cp -p $srcrpm $builddir/$srcrpmbasename"; my $rpmbuildlocal=$rpmbuild.q{ --define "_topdir $PWD" --define "_builddir $PWD" --define "_rpmdir $PWD" --define "_sourcedir $PWD" --define "_specdir $PWD" --define "_srcrpmdir $PWD" --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm"}; - $rpmbuildlocal="orphanripper $rpmbuildlocal" if $cvsrepo && $cvsrepo eq "glibc"; - mockrun $rpmbuildlocal." --rebuild --with testsuite".($parallel<2 ? "" : " --with parallel")." $srcrpmbasename"; + $rpmbuildlocal="$orphanripper $rpmbuildlocal" if $cvsrepo && $cvsrepo eq "glibc"; + mockrun $rpmbuildlocal." --rebuild --with testsuite $srcrpmbasename"; } my $baretestsuite; @@ -453,23 +460,38 @@ while (@distrouse || keys(%child)) { $errs12.=" $configure" if $configure; if ($component eq "binutilscvs") { - mockrun "cd $baretestsuite; $errs12; ulimit -c unlimited; orphanripper make -k check || :; ".q{for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log};do ln $file}." $out/binutils-$distro-".q{$(basename $file) || :; done;}; + mockrun "cd $baretestsuite; $errs12; ulimit -c unlimited; $orphanripper make -k check || :; ".q{for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log};do ln $file}." $out/binutils-$distro-".q{$(basename $file) || :; done;}; } else { + if ($valgrind) { + # FIXME + do { unlink $_ or warn "$_: $!"; } for "$baretestsuite/gdb/testsuite/gdb.base/break-interp.exp"; + } my @check=($distro=~/-x86_64/ ? qw(-m64 -m32) : -m32); @check=map("check//unix/$_",@check); @check=map({($_,"$_/-fPIE/-pie");} @check) if $gdbcvspie; - # for i in ".join(" ",@check).";do orphanripper make -k \$i || :;done - mockrun "cd $baretestsuite; $errs12" + # for i in ".join(" ",@check).";do $orphanripper make -k \$i || :;done + sub runtestcc($) + { + local($_)=@_; + s/ /\\ /g; + return ' RUNTESTFLAGS="CC_FOR_TARGET=gcc\ '.$_.' CXX_FOR_TARGET=g++\ '.$_.'"' + } + mockrun "cd $baretestsuite;" + .(!$valgrind?"":' HAMMOCK_VALGRIND=1') + ." $errs12" .(!$valgrind?"":' --without-python') # FIXME: Fix valgrind --suppressions ."; cd gdb; ulimit -c unlimited; " .(!$gdbserver?"":'DEJAGNU=$HOME/src/runtest-gdbserver/site.exp ') .(!$valgrind?"":'DEJAGNU=$HOME/src/runtest-valgrind/site.exp ') - ."orphanripper make -k ".join(" ",@check) + ."$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') .(!$gdbindex?"":' RUNTESTFLAGS="CC_FOR_TARGET=/bin/sh\ $PWD/cc-with-index.sh\ gcc CXX_FOR_TARGET=/bin/sh\ $PWD/cc-with-index.sh\ g++"') - .(!$dwarf4?"":' RUNTESTFLAGS="CC_FOR_TARGET=gcc\ -gdwarf-4\ -g0 CXX_FOR_TARGET=g++\ -gdwarf-4\ -g0"') - ." 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;}; + .(!$dwarf?"":runtestcc "-gdwarf-$dwarf".(!defined $debug_types_section?"":'\ '.($debug_types_section?"-fdebug-types-section":"-fno-debug-types-section"))." -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;}; } # gdbunpack does: # perl -i -pe 's{\Q'"$HOME"'\E/.*?/build/[^/]*/}{}g' "$base"/* @@ -513,7 +535,7 @@ while (@distrouse || keys(%child)) { link $fname,$d or warn $!; } - exit 0 if $parallel>1; + exit 0 if $parallel; } print STDERR "waiting for ".scalar(keys(%child))." children, ".scalar(@distrouse)." distros to go...\n";