X-Git-Url: https://git.jankratochvil.net/?a=blobdiff_plain;f=bin%2Fhammock;h=70de9ccbb55e97e83245a1d7ce23650ed8b14fb5;hb=ff7bc80f098fc3fe911c7ffcf133052ab2de9ac0;hp=aecac0c8b7a5791dfb4217c9fbeb6a510c9256a4;hpb=eb873bcb2b07e50cc7b87a2687861e877149835e;p=nethome.git diff --git a/bin/hammock b/bin/hammock index aecac0c..70de9cc 100755 --- a/bin/hammock +++ b/bin/hammock @@ -1,5 +1,4 @@ #! /usr/bin/perl -# $Id$ use strict; use warnings; @@ -29,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; @@ -50,12 +49,15 @@ my $strip; # Can't bind address: Address already in use. # my $gdbserver; +my $valgrind; +my $gdbindex; +my $dwarf; +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, @@ -70,6 +72,10 @@ die if !GetOptions( "gdbcvspie"=>\$gdbcvspie, "strip"=>\$strip, "gdbserver"=>\$gdbserver, + "valgrind"=>\$valgrind, + "gdbindex"=>\$gdbindex, + "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"); @@ -85,7 +91,13 @@ if ($component=~/^(gdb|binutils)cvs$/) { !$gdbcvspie or $component eq "gdbcvs" or die "--gdbcvspie requires -c gdbcvs"; @target and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--target is available only for baretestsuite modes"; $strip and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--strip is available only for baretestsuite modes"; -$gdbserver and $component ne "gdbcvs" and die "--gdbserver is available only gdbcvs"; +$gdbserver and $component ne "gdbcvs" and die "--gdbserver is available only for gdbcvs"; +$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"; +!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; @@ -95,9 +107,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; @@ -206,6 +215,9 @@ sub writefile close F or die $fname; } +# /etc/cgconfig.conf +spawn "echo cgclassify -g '*':hammock $$ || :"; + spawn "renice +19 -p $$"; spawn "ionice -c3 -p $$"; newdir $dir; @@ -225,6 +237,11 @@ my %dump=( "file"=>join("\n",@file), "configure"=>$configure, "gdbcvspie"=>$gdbcvspie, + "gdbserver"=>$gdbserver, + "valgrind"=>$valgrind, + "gdbindex"=>$gdbindex, + "dwarf"=>$dwarf, + "orphanripper"=>$orphanripper, ); while (my($name,$val)=each(%dump)) { next if !$val; @@ -311,7 +328,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) { @@ -387,8 +404,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; @@ -437,13 +454,28 @@ 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 { 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; cd gdb; ulimit -c unlimited; ".(!$gdbserver?"":'DEJAGNU=$HOME/src/runtest-gdbserver/site.exp ')."orphanripper make -k ".join(" ",@check).(!$gdbserver?"":' RUNTESTFLAGS=--target_board=native-gdbserver')." 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;}; + # for i in ".join(" ",@check).";do $orphanripper make -k \$i || :;done + 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) + # 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++"') + .(!$dwarf?"":' RUNTESTFLAGS="CC_FOR_TARGET=gcc\ -gdwarf-'.$dwarf.'\ -g0 CXX_FOR_TARGET=g++\ -gdwarf-'.$dwarf.'\ -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"/* @@ -469,6 +501,13 @@ while (@distrouse || keys(%child)) { spawn "mv $out $out.x; gdbunpack $log; mv $out.x/* $out/; rmdir $out.x"; } + if ($valgrind) { + for my $from (glob "$out/*.log") { + (my $to=$from).="filt"; + spawn q{sed -n 's/^==[0-9]*== \([A-Z]\)/\1/p' <}.$from.q{|grep -v '^\(Conditional jump \|Invalid read \|Use of uninitialised value \|Syscall param .* uninitialised byte\)' >}.$to; + } + } + my $resultout="$resultdir/$id/$distrodirbase"; newdir $resultout; $resultout.="/out"; @@ -480,7 +519,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";