5 use POSIX qw(&strftime);
6 use Getopt::Long qw(:config no_ignore_case);
10 my $gdbcvsmaster=$ENV{"HOME"}."/redhat/gdb-cvs-master";
11 my $binutilscvsmaster=$ENV{"HOME"}."/redhat/binutils-cvs-master";
12 my $archermaster=$ENV{"HOME"}."/redhat/gdb-master";
13 my $fedoragitroot=q{git://pkgs.fedoraproject.org};
14 my $rhelgitroot=q{git://pkgs.devel.redhat.com/rpms};
15 my $arch_i386=qr{(?:x86|i\d86|ia32)}io;
16 my $arch_x86_64=qr{(?:x8664|x86_64|em64t)}io;
17 my $resultdir=$ENV{"HOME"}."/.hammock-result";
18 my @arches=qw(i386 x86_64);
41 # FIXME: Connect make paralellization to the children.
45 # FIXME: 20100911servpatched-f14:
46 # readchar: Connection reset by peer
47 # Remote side has terminated connection. GDBserver will reopen the connection.
48 # Can't bind address: Address already in use.
49 # <last 2 lines repearing>
56 # Use --dwarf=40 for: --dwarf=4 -fno-debug-types-section
57 # Use --dwarf=41 for: --dwarf=4 -fdebug-types-section
60 my $debug_types_section;
64 "i|userid=s"=>\$userid,
66 "serial"=>sub { $parallel=0; },
67 "parallel"=>sub { $parallel=1; },
68 "d|distro=s{,}"=>\@distro,
69 "cd|componentdistro=s{,}"=>\@componentdistro,
70 "p|path=s{,}"=>\@path,
71 "P|prefixpath=s{,}"=>\@prefixpath,
72 "a|arch=s{,}"=>\@arch,
73 "c|component=s"=>\$component,
74 "s|srcrpm=s"=>\$srcrpm,
76 "target=s{,}"=>\@target,
77 "D|distrojobs=s"=>\$distrojobs,
78 "configure=s"=>\$configure,
80 "gdbcvspie"=>\$gdbcvspie,
82 "gdbserver"=>\$gdbserver,
83 "valgrind"=>\$valgrind,
85 "gdbindex"=>\$gdbindex,
90 "orphanripper!"=>\$orphanripper,
91 "options=s"=>\$options,
93 $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/*");
94 $component and $component=~m{^/home/} and (-f "$component/gdb/gdbtypes.c" or die "$component/gdb/gdbtypes.c not found");
95 $component and $srcrpm and die "-c|--component excludes -s|--srcrpm";
96 $component or $srcrpm or die "-c|--component or -s|--srcrpm required";
97 $component||=""; # Make `eq' not complaining.
99 if ($component=~/^(gdb|binutils)cvs$/) {
100 $cvsbranch=(!$branch?"":"-r $branch"); # "-A" is broken with new sourceware.org
101 $gdbcvsmaster=$ENV{"HOME"}."/redhat/gdb-cvs-master74" if ($branch||"") eq "gdb_7_4-branch";
103 die "--branch currently unsupported for non-CVS sources" if $branch;
105 !$gdbcvspie or $component eq "gdbcvs" or die "--gdbcvspie requires -c gdbcvs";
106 @target and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--target is available only for baretestsuite modes";
107 $strip and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--strip is available only for baretestsuite modes";
108 $options and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--options is available only for baretestsuite modes";
109 $gdbserver and $component!~/^(?:gdbcvs|archer-.*)$/ and die "--gdbserver is available only for gdbcvs or archer-*";
110 $valgrind and $component!~/^(?:gdbcvs|archer-.*)$/ and die "--valgrind is available only for gdbcvs or archer-*";
111 $gdbserver and $valgrind and die "--gdbserver and --valgrind are mutually exclusive";
112 ($gdbserver || $valgrind) and ($gdbindex || $dwz) and die "--gdbserver|--valgrind and --gdbindex|--dwz are mutually exclusive";
113 do { $debug_types_section=0; $dwarf=4; } if ($dwarf||0)==40;
114 do { $debug_types_section=1; $dwarf=4; } if ($dwarf||0)==41;
115 !defined $dwarf or ($dwarf>=2 && $dwarf<=4) or die "--dwarf requires DWARF version number";
116 !defined $stabs or ($stabs>=0 && $stabs<=2) or die "--stabs is 0=off or 1=-gstabs or 2=-gstabs+";
117 ($gdbserver || $valgrind || $gdbindex || $dwz) and ($dwarf || $stabs) and die "--gdbserver|--valgrind|--gdbindex and --dwarf|--stabs are mutually exclusive";
118 $orphanripper=($orphanripper?"orphanripper":"");
120 do { error "Duplicate target: $_\n" if $target{$_}++; } for @target;
121 @arch="x86_64" if @target&&!@arch;
122 for my $file (@file) {
123 -f $file and -r $file or error "-f|--file $file not readable: $!";
125 ###push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-index-assert.patch" if $component=~/^(?:gdbcvs|archer-)/;
126 ###push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-dejagnu-go.patch" if $component=~/^(?:gdbcvs|archer-)/;
127 $distrojobs=(@target?1:2) if !defined $distrojobs;
128 $distrojobs=~/^\d+$/ or die "-D|distrojobs must be a number: $distrojobs";
129 $distrojobs>=1 or die "-D|distrojobs must be positive: $distrojobs";
130 error "Excessive arguments: @ARGV" if @ARGV;
131 @arch=@arches if !@arch;
132 my $path=join(":",@path) if @path;
133 @componentdistro and @componentdistro!=@distro and die "--cd|--componentdistro must have the same elements count as -d|--distro";
135 #FIXME:push @file,"/home/jkratoch/t/gdbserverasyncnonstop.patch" if $component=~/^(?:gdbcvs|archer-)/;
136 push @file,"/home/jkratoch/t/watchpointfork2.patch" if $component=~/^(?:gdbcvs|archer-)/;
137 #push @file,"/home/jkratoch/t/gdb-breakpointchanged.patch" if $component=~/^(?:gdbcvs|archer-)/;
139 sub distro_normalize($;$)
144 s{^/var/lib/mock/+}{};
147 s/^(?:devel|rawhide)\b/fedora-rawhide/;
148 s/^(?:epel|centos)-?(\d)/epel-$1/;
149 s/^(?:rhel)-?(\d)/rhel-$1/;
150 s/^(?:f|fedora)-?(\d)/fedora-$1/;
152 @archuse="" if -d "/var/lib/mock/$_";
153 @archuse="i386" if s/-$arch_i386$//o;
154 @archuse="x86_64" if s/-$arch_x86_64$//o;
156 for my $arch (@archuse?@archuse:@arch) {
157 my $dir="/var/lib/mock/$_".(!$arch?"":"-$arch");
158 $force or -d $dir or error "No distro: $dir";
161 return ($_,@archuse);
164 # epel-\d-i386|fedora-\d-i386|fedora-rawhide-i386
166 for my $distroi (0..$#distro) {
167 my $distro=$distro[$distroi];
168 my $componentdistro=$componentdistro[$distroi];
170 if ($componentdistro) {
171 my $force=($componentdistro=~s/!$//);
172 ($componentdistro,@archuse)=distro_normalize $componentdistro,$force;
173 @archuse and die "--cd|--componentdistro must have no arch: ".join(" ",@archuse);
175 ($distro,@archuse)=distro_normalize $distro;
176 $componentdistro||=$distro;
177 @archuse=@arch if !@archuse;
178 for my $archuse (@archuse) {
179 for my $target (@target?@target:undef()) {
180 push @distrouse,{"distro"=>$distro.(!$archuse?"":"-$archuse"),"componentdistro"=>$componentdistro,"target"=>$target};
190 my %opt=map(($_=>1),@opt);
191 warn "+ mkdir".($opt{"-p"} ? " -p" : "")." $dir\n";
192 mkdir $dir or ($opt{"mayexist"} && $!{EEXIST}) or die "mkdir $dir: $!";
201 my %opt=map(($_=>1),@opt);
204 $cmd="set -ex; $cmd";
205 $ok="$log.ok" if $log;
206 $cmd="($cmd; touch $ok) 2>&1|tee -a $log; test -f $ok" if $log;
212 system $cmd and die "$cmd: $!";
216 my $basedir=$ENV{"HOME"}."/hammock";
217 newdir $basedir,"mayexist";
218 my $idbase=strftime("%Y%m%d",localtime());
221 for my $seq (defined $userid ? $userid : (0..99)) {
222 $id=$idbase.(defined $userid ? $seq : sprintf("%02d",$seq));
226 spawn "chmod -R u+w $dir; rm -rf $dir" if -d $dir && $force && defined $userid;
227 error "Directory not free: $dir" if !$id || !$dir || -e $dir;
228 print STDERR "ID = $id | dir = $dir\n";
229 error "No distros specified" if !@distrouse;
230 die "$error errors seen, aborted" if $error;
234 my($fname,$content)=@_;
237 open F,">$fname" or die $fname;
238 print F $content or die $fname;
239 close F or die $fname;
247 open F,"$fname" or die $fname;
249 defined(my $r=<F>) or die $fname;
250 close F or die $fname;
257 link $old,$new or spawn "cp -p '$old' '$new'";
261 spawn "cgclassify -g '*':hammock $$ || :";
263 spawn "renice +19 -p $$";
264 spawn "ionice -c3 -p $$";
267 my $resultid="$resultdir/$id";
268 my $resultidxz="$resultid.tar.xz";
269 newdir $resultdir,"mayexist";
270 spawn "rm -rf $resultid" if -d $resultid && $force;
272 unlink $resultidxz or $!{ENOENT} or die "unlink $resultidxz: $!";
273 spawn "uname -r >$dir/kernel";
276 "prefixpath"=>join(":",@prefixpath),
277 "component"=>$component,
280 "file"=>join("\n",@file),
281 "configure"=>$configure,
282 "gdbcvspie"=>$gdbcvspie,
283 "gdbserver"=>$gdbserver,
284 "valgrind"=>$valgrind,
286 "gdbindex"=>$gdbindex,
291 "debug_types_section"=>$debug_types_section,
292 "orphanripper"=>$orphanripper,
295 while (my($name,$val)=each(%dump)) {
297 writefile "$dir/$name","$val\n";
298 ln "$dir/$name","$resultid/$name";
300 for my $file (@file) {
301 newdir "$dir/file.d","mayexist";
302 (my $base=$file)=~s{^.*/}{};
303 my $d="$dir/file.d/$base";
305 newdir "$resultid/file.d","mayexist";
306 ln $d,"$resultid/file.d/$base";
311 my($sub,$in,$out)=@_;
316 open F,$in or die $in;
317 local $_=do { local $/; <F>; } or die $in;
320 &{$sub}() or die $_."\nError substituting $in";
329 for my $file (@file) {
331 $filebase=~s{^.*/}{};
332 my $target="$targetdir/$filebase";
333 # Some *.patch files may be new.
334 # -f $target or die "File $file does not exist at $target";
335 spawn "rm -f $target; cp -p $file $target";
341 while (@distrouse || keys(%child)) {
342 while (keys(%child)<$distrojobs && @distrouse) {
343 my $distrouse=shift @distrouse;
344 my $distro=$distrouse->{"distro"};
345 my $componentdistro=$distrouse->{"componentdistro"};
346 my $target=$distrouse->{"target"};
347 my $rpmbuild="rpmbuild";
356 if ($component=~/^fedora(.*)$/) {
358 $gitbranch="f$1" if $componentdistro=~/^fedora-(\d+)/;
359 $gitbranch="master" if $componentdistro=~/^fedora-rawhide/;
360 die "$component vs. $componentdistro" if !$gitbranch;
361 $gitroot=$fedoragitroot;
364 if ($component=~/^rhel(.*)$/) {
367 $gitroot=$rhelgitroot;
368 $gitpkg="https_proxy= rhpkg";
369 # EPEL still uses Berkeley DB version 8 while F-11+ (F-10?) uses version 9.
370 # Using db_dump and db_load would no longer make it mock compatible.
371 $rpmbuild.=q{ --dbpath $PWD --nodeps};
374 my $distrodirbase=$distro;
375 $distrodirbase.="-$target" if $target;
376 my $distrodir="$dir/$distrodirbase";
378 $log="$distrodir/log";
379 my $out="$distrodir/out";
384 die if !defined $pid;
386 $child{$pid}=$distrodirbase;
391 my $builddir="$distrodir/build";
394 # Do not use mockrun as the rpm database may be in a different version.
395 spawn "rpm -r /var/lib/mock/$distro/root -qa|sort >$out/rpm-qa";
402 $c="export PATH=\"$path:\$PATH\"; $c" if $path;
403 for my $prefixpath (@prefixpath) {
404 $c="export PATH=\"$prefixpath/bin:\$PATH\"; $c";
405 $c="export LD_LIBRARY_PATH=\"$prefixpath/lib64:$prefixpath/lib\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH}\"; $c";
407 $c="export PATH=\"\$HOME/bin:\$PATH\"; $c";
408 $c="export MAKEFLAGS=\"-j\$[`getconf _NPROCESSORS_ONLN`*3/2]\"; $c";
409 $c="export http_proxy=http://127.0.0.1:3128/; $c";
410 $c="set -ex; cd $builddir; $c";
411 die "found ': $c" if $c=~/'/;
412 spawn "mockrun $::distro '$c'";
420 spawn "cd $distrodir; git clone ".($gitbranch eq "auto"?"":"-b $gitbranch")." $gitroot/$gitrepo $component";
421 my $componentdir="$distrodir/$component";
422 -d $componentdir or die "Failed checkout to: $componentdir";
423 if ($gitbranch eq "auto") {
424 $componentdistro=~/^(?:rhel|epel)-(\d+)$/ or die $componentdistro;
426 my @l=grep { m{^\s*origin/rhel-$major\.\d+\s*$} } split /\n/,readfile "cd $componentdir; git branch -r |";
430 s{^\s*origin/rhel-\d+\.(\d+)\s*$}{$1} or die;
433 @l=sort { minor($b) <=> minor($a); } @l;
434 $gitbranch=($l[0]=~m{^\s*origin/(.*?)\s*$})[0] or die;
435 spawn "cd $componentdir; git checkout $gitbranch";
437 copyfiles $componentdir;
438 spawn "cd $componentdir; $gitpkg verrel >$out/verrel";
439 my $glob="$componentdir/*.src.rpm";
440 @{[glob $glob]}==0 or die "Found some before test-srpm: $glob";
441 # No `spawn' as we could get:
442 # error: unpacking of archive failed on file X;4a56efef: cpio: MD5 sum mismatch
443 mockrun "cd $componentdir; $gitpkg srpm";
444 my @srcrpm=(glob $glob);
445 @srcrpm==1 or die "Did not find 1 srcrpm: @srcrpm";
453 spawn "cd $distrodir; cvs -q -z3 -d $cvsroot co rpms/$cvsrepo/$cvsbasedir";
454 my $componentdir="$distrodir/rpms/$cvsrepo/$cvsbasedir";
455 -d $componentdir or die "Failed checkout to: $componentdir";
456 # Required for RHEL; Fedora does so automatically.
457 spawn "cd $componentdir/..; cvs -q -z3 -d $cvsroot co common";
458 # Workaround (RHEL-5?) curl which uses `Pragma: nocache' on $http_proxy.
459 subst sub { s{echo "curl }{$&-H 'Pragma: cache' }; },"$componentdir/../common/Makefile.common";
460 copyfiles $componentdir;
461 spawn "cd $componentdir; make verrel >$out/verrel";
462 my $glob="$componentdir/*.src.rpm";
463 @{[glob $glob]}==0 or die "Found some before test-srpm: $glob";
464 # No `spawn' as we could get:
465 # error: unpacking of archive failed on file X;4a56efef: cpio: MD5 sum mismatch
466 mockrun "cd $componentdir; make test-srpm";
467 my @srcrpm=(glob $glob);
468 @srcrpm==1 or die "Did not find 1 srcrpm: @srcrpm";
473 my $srcrpmbasename=$srcrpm;
474 $srcrpmbasename=~s{^.*/}{};
475 spawn "cp -p $srcrpm $builddir/$srcrpmbasename";
477 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"};
478 $rpmbuildlocal="$orphanripper $rpmbuildlocal" if $cvsrepo && $cvsrepo eq "glibc";
479 mockrun $rpmbuildlocal." --rebuild --with testsuite $srcrpmbasename";
484 if ($component=~/^(gdb|binutils)cvs$/) {
486 my $cvsmaster=$which eq "gdb" ? $gdbcvsmaster : $binutilscvsmaster;
488 spawn "cp -a $cvsmaster $builddir/src; cd $builddir/src; cvs update $cvsbranch";
490 spawn "cd $builddir; cvs -q -z3 -d :pserver:anoncvs:\@sourceware.org:/cvs/src co $cvsbranch $which";
492 spawn "cd $builddir/src; test -z \"\$(cvs update $cvsbranch)\"";
493 $baretestsuite="$builddir/src";
496 if ($component=~/^archer-/) {
497 spawn "git clone ".(!-d $archermaster ? "" : "--reference $archermaster")." git://sourceware.org/git/archer.git $builddir/$component";
498 spawn "cd $builddir/$component; git fetch";
499 spawn "cd $builddir/$component; git checkout -b $component origin/$component; [ \"`git status`\" = \"# On branch $component\nnothing to commit (working directory clean)\" ]";
500 $baretestsuite="$builddir/$component";
503 if ($component=~m{^/home/}) {
504 spawn "cp -a $component $builddir/src; cd $builddir/src; find -name \"*.[oa]\" -o -name \"*.l[oa]\" -o -name gdb.sum -o -name gdb.log|xargs rm -f; make clean || :";
505 $baretestsuite="$builddir/src";
508 if ($baretestsuite) {
509 for my $file (@file) {
510 my $target="$baretestsuite/$file";
511 if ($file=~m{[.](R?)patch$}) {
514 $fileabs=$ENV{"PWD"}."/$fileabs" if $fileabs!~m{^/};
515 spawn "cd $baretestsuite; patch -${R}p1 <$fileabs";
517 -f $target or $file=~m{/testsuite/} or die "File $file does not exist at $target";
518 spawn "rm -f $target; cp -p $file $target";
523 $errs12.=" -s" if $strip;
524 $errs12.=" --target=$target" if $target;
525 $errs12.=" $options" if $options;
526 $errs12.=" $configure" if $configure;
528 if ($component eq "binutilscvs") {
529 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;};
533 do { unlink $_ or warn "$_: $!"; } for "$baretestsuite/gdb/testsuite/gdb.base/break-interp.exp";
535 my @check=($distro=~/-x86_64/ ? qw(-m64 -m32) : -m32);
536 @check=map("check//unix/$_",@check);
537 @check=map({($_,"$_/-fPIE/-pie");} @check) if $gdbcvspie;
538 my %flags=("CC_FOR_TARGET" =>"gcc",
539 "CXX_FOR_TARGET" =>"g++",
540 "GO_FOR_TARGET" =>"gccgo",
541 "GO_LD_FOR_TARGET"=>"gccgo",
543 # for i in ".join(" ",@check).";do $orphanripper make -k \$i || :;done
547 (my $q1=$q0)=~s/ /\\ /g;
548 (my $q2=$q1)=~s/ /\\ /g;
549 return ' RUNTESTFLAGS="'.join(' ',map($_.'='.$flags{$_}.'\ '.$q1,keys(%flags))).' GNATMAKE_FOR_TARGET=gnatmake\ --GCC=gcc\\ '.$q2.'"';
551 die "FIXME" if $valgrind;
552 # .(!$valgrind?"":' RUNTESTFLAGS=--target_board=valgrind')
553 # .(!$valgrind?"":' HAMMOCK_VALGRIND=1')
554 # .(!$valgrind?"":' --without-python') # FIXME: Fix valgrind --suppressions
555 mockrun "cd $baretestsuite;"
557 .(!$bfd32?"":' --disable-64-bit-bfd')
558 ."; cd gdb; ulimit -c unlimited; DEJAGNU=$baretestsuite/site.exp "
559 ."$orphanripper make -k ".join(" ",@check)
560 # Ensure serial run if FORCE_PARALLEL=1 is not present
561 ." RUNTESTFLAGS=DUMMY=dummy"
562 .(!$gdbserver?"":' RUNTESTFLAGS=--target_board=native-gdbserver')
563 # Missing GNATMAKE_FOR_TARGET!
564 .(!($gdbindex||$dwz)?"":' RUNTESTFLAGS="'.join(' ',map($_.'=/bin/sh\ $PWD/contrib/cc-with-tweaks.sh'
565 .(!$gdbindex?"":'\ -i')
567 .'\ '.$flags{$_},keys(%flags))).'"')
568 #.(!$gdbindex?"":' RUNTESTFLAGS="'.join(' ',map($_.'=/bin/sh\ $PWD/cc-with-index.sh\ '.$flags{$_},keys(%flags))).'"')
569 .(!$dwarf?"":runtestcc "-gdwarf-$dwarf".(!defined $debug_types_section?"":'\ '.($debug_types_section?"-fdebug-types-section":"-fno-debug-types-section"))." -g0")
570 .(!$optimg?"":runtestcc "-Og -g0")
571 .(!$stabs?"":runtestcc(($stabs==1?"-gstabs":"-gstabs+")." -g0"))
572 .(!$parallel?"":' FORCE_PARALLEL=1')
573 ." || :; ".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;};
576 # perl -i -pe 's{\Q'"$HOME"'\E/.*?/build/[^/]*/}{}g' "$base"/*
577 my $HOME=$ENV{"HOME"};
578 for my $file (glob("$out/*.sum"),glob("$out/*.log")) {
579 subst sub { s{\Q$HOME\E/.*?/build/[^/]*/}{}g; },$file;
582 die "internal error" if @target;
585 # Call gdbunpack only if no direct $out directory will be created.
586 # It is needed only for .src.rpm-built testsuites, no matter how .src.rpm
589 if ($component=~/^(?:fedora|rhel)glibc$/) {
590 @testinlog=(qr/={20}TESTING DETAILS={17}/,qr/={20}PLT RELOCS END={18}/);
593 subst sub { s{^.*?\n($testinlog[0]\n.*\n$testinlog[1]\n).*$}{$1}s; },$log,$out;
594 } elsif ($cvsbasedir || $srcrpm) {
595 # Applies both to gdb and binutils.
596 spawn "mv $out $out.x; gdbunpack $log; mv $out.x/* $out/; rmdir $out.x";
600 for my $from (glob "$out/*.log") {
601 (my $to=$from).="filt";
602 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;
606 my $resultout="$resultdir/$id/$distrodirbase";
610 for my $fname (glob "$out/*") {
611 (my $base=$fname)=~s{^.*/}{};
612 my $d="$resultout/$base";
613 warn "+ link $fname $d\n";
620 print STDERR "waiting for ".scalar(keys(%child))." children, ".scalar(@distrouse)." distros to go...\n";
622 next if $pid==-1 && $!==10; # 10==No child processes
623 die "wait()==-1: $!" if $pid==-1;
624 die "not found pid $pid" if !$child{$pid};
625 error "weird status $? for pid $pid: ".$child{$pid} if $?;
626 print STDERR "finished: $pid ".$child{$pid}."\n";
632 spawn "(set -e -o pipefail;cd $resultdir;tar cf - $id|xz -9e >$resultidxz;rm -rf $id)&","bare";
640 $r.=int($sec/(60*60))."h";
643 if ($r || $sec>=60) {
644 $r.=int($sec/60)."m";
652 print STDERR "ID = $id | dir = $dir\n";
653 my $time=timestr(time()-$start);
654 print STDERR "total time=$time\n";
655 writefile "$dir/time","$time\n";
656 die "$error errors seen, aborted" if $error;
657 print STDERR "done\n";