aiaiai-test-patchset: remove leftover 'wait for bisect test' code

I didn't notice this code in my first (quick) pass at fixing a race
condition here. Apparently we *were* trying to wait for the bisection
test to complete, but we just weren't doing it at the right time.

Anyway, with the current code, multi-config test runs will fail, since
the second config will have a valid $pid_bisect from the previous
config, meaning we will try to 'wait' again for the same expired
process. The shell doesn't like that, so we fail.

Let's move the bisect process's PID into a function-local context, and
ensure that each config is completely finished before moving to the next
one. So there will be a single, obvious place to wait for the process
completion.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
diff --git a/aiaiai-test-patchset b/aiaiai-test-patchset
index b16d7a6..6193dfc 100755
--- a/aiaiai-test-patchset
+++ b/aiaiai-test-patchset
@@ -163,7 +163,6 @@
 
 }
 
-pid_bisect=
 test_configuration()
 {
 	local config="$1"
@@ -171,21 +170,10 @@
 	local arch="$(leave_second "$1")";
 	local cross="$(leave_third "$1")";
 	local arch_opt=
+	local pid_bisect=
 
 	[ -z "$arch" ] || arch_opt="-a $arch${cross:+",$cross"}"
 
-	if [ -n "$bisectability" ]; then
-		# We share the same source tree with 'aiaiai-test-bisectability', so
-		# wait for it (it could be run at the previous iteration)
-		if [ -n "$pid_bisect" ]; then
-			wait "$pid_bisect" || die "aiaiai-test-bisectability failed"
-			pid_bisect=
-		fi
-
-		# Clean-up the git tree after the test
-		rm $verbose -rf "$cloned_kernel1/.git/rebase-apply" >&2
-	fi
-
 	git --git-dir="$(git_dir "$cloned_kernel1")" reset $quiet --hard "$commit_id1" >&2
 
 	# Enable use of a random condiguration that is stable between the
@@ -248,9 +236,14 @@
 	aiaiai-diff-log $verbose $preserve "$tmpdir/diff-for-diff-log" "$log1.stderr.log" \
 		        -w "$tmpdir" "$log2.stderr.log" > "$tmpdir/$config.stderr.diff"
 
-	# MUST sync with bisect test before removing build artifacts
-	[ -z "$pid_bisect" ]   || wait "$pid_bisect"   || die "aiaiai-test-bisectability failed"
-	verbose "Done with bisectability test"
+	if [ -n "$bisectability" ]; then
+		# MUST sync with bisect test before removing build artifacts
+		wait "$pid_bisect" || die "aiaiai-test-bisectability failed"
+
+		# Clean-up the git tree after the test
+		rm $verbose -rf "$cloned_kernel1/.git/rebase-apply" >&2
+		verbose "Done with bisectability test"
+	fi
 
 	if [ -n "$preserve" ]; then
 		message "Preserving objdirs: $obj1 $obj2"