set -e
set -o pipefail
-cpus=$(
- perl -we '
- use strict;
- require Sys::CPU;
- my $ncpus = Sys::CPU::cpu_count();
- $ncpus *= 1.5;
- print join " ", (0 .. $ncpus-1) or die $!;
- print "\n" or die $!;
- ' ||
- echo 0 1 2
-)
-
-rm -rf stunt
-mkdir stunt
-cd stunt
+cpus='0 1'
+
+uid=`id -u`
+cd /var/run/user/$uid
+mkdir -p version-charset-test
+cd version-charset-test
+
+stunt=stunt$1
+rm -rf $stunt
+mkdir $stunt
+cd $stunt
for cpu in $cpus; do
mkdir c$cpu
(cd c$cpu
- git init)
+ git init -q)
done
#exec 3<&0 </dev/null
our $file;
our $count;
our $batch=0;
+ our $total=0;
our @tasks;
my @freecpus = qw('"$cpus"');
waitpid $pid, 0 == $pid or die $!;
die "$oldbatch $?" if $?;
unlink "b$oldbatch" or die "$oldbatch $!";
- print STDERR "check completed $oldbatch [$pid] #$cpu\n";
+# print STDERR "check completed $oldbatch [$pid] #$cpu\n";
push @freecpus, $cpu;
}
close $file or die $!;
- print STDERR "check closing $batch ($count)\n";
+# print STDERR "check closing $batch ($count)\n";
await_task unless @freecpus;
exec qw(eatmydata git update-ref --stdin);
die $!;
}
- print STDERR "check spawned $batch ($count) [$pid] #$cpu\n";
+# print STDERR "check spawned $batch ($count) [$pid] #$cpu\n";
push @tasks, [ $pid, $cpu, $batch ];
$batch++;
$file = undef;
+ $total += $count;
$count = 0;
}
$file ||= new IO::File "b$batch", ">" or die $!;
chomp;
print $file "delete refs/tags/$_\n" or die $!;
- $count++ < 100000 or complete_batch;
+ $count++ < 1000 or complete_batch;
}
#print STDERR "FOO\n";
STDIN->error and die $!;
complete_batch();
await_task while @tasks;
+ print STDERR "check exiting (total=$total)\n";
'