chiark / gitweb /
parallel in invoke
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 4 Nov 2016 16:21:05 +0000 (16:21 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 4 Nov 2016 16:21:05 +0000 (16:21 +0000)
README
check
invoke

diff --git a/README b/README
index 053aea4..09c1b19 100644 (file)
--- a/README
+++ b/README
@@ -1,3 +1,5 @@
+./invoke
+
 Copyright 2016 Ian Jackson
 Consider all of this GPLv2-or-later
 There is NO WARRANTY
diff --git a/check b/check
index 7ffa2da..7ebdda0 100755 (executable)
--- a/check
+++ b/check
@@ -2,31 +2,22 @@
 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
-)
+cpus='0 1'
 
 uid=`id -u`
 cd /var/run/user/$uid
 mkdir -p version-charset-test
 cd version-charset-test
 
-rm -rf stunt
-mkdir stunt
-cd stunt
+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
diff --git a/invoke b/invoke
index fc67da9..589c577 100755 (executable)
--- a/invoke
+++ b/invoke
@@ -2,7 +2,40 @@
 set -o pipefail
 set -ex
 
-./generate "$@" | ../dpkg/src/dpkg --filter-valid-versions | ./escape | ./check 
+cpus=$(
+       perl -we '
+           use strict;
+           require Sys::CPU;
+           my $ncpus = Sys::CPU::cpu_count();
+           $ncpus *= 1.5;
+           print $ncpus, " " or die $!;
+            print join " ", (0 .. $ncpus-1) or die $!;
+           print "\n" or die $!;
+       ' ||
+       echo 3 0 1 2
+)
+
+ncpus=${cpus%% *}
+cpus=${cpus#* }
+
+echo >&2 "ncpus=$ncpus cpus=($cpus)"
+
+pids=()
+
+for cpu in $cpus; do
+       (
+       ./generate $cpu/$ncpus "$@"                             | \
+       ../dpkg/src/dpkg --filter-valid-versions                | \
+       ./escape                                                | \
+       ./check $cpu
+       echo >&2 "cpu $cpu ok"
+       ) &
+       pids+=( $! )
+done
+
+for pid in ${pids[*]}; do
+       wait $pid
+done
 
 echo '*** OK EVERYTHING IS FINE ***'