new_variant: clean EC before testing

Stale output files in the EC build directory can cause intermittent
build failures. Clean the EC build before starting the new variant.

BUG=b:168755528
TEST=`testdata/new_variant_fulltest.sh waddledee &&
testdata/new_variant_fulltest.sh waddledoo && echo PASS`
After building new variants of both reference boards, you'll see
a "PASS" as the last line of output.

Change-Id: I602db6e6dc629a7e19687a6367e6cc2976c194e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2426247
Tested-by: Paul Fagerburg <pfagerburg@chromium.org>
Auto-Submit: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
diff --git a/contrib/variant/testdata/new_variant_fulltest.sh b/contrib/variant/testdata/new_variant_fulltest.sh
index 0244869..1f3a581 100755
--- a/contrib/variant/testdata/new_variant_fulltest.sh
+++ b/contrib/variant/testdata/new_variant_fulltest.sh
@@ -211,6 +211,15 @@
   popd
 fi
 
+# This test uses Kingitchy as a new variant name for both Waddledee and
+# Waddledoo. The EC build fails if you test creating a variant of one of
+# those reference boards and then the other without cleaning up the build
+# directory first, because the outputs in platform/ec/build/kingitchy don't
+# match up with the "new" source files that are under the same name.
+# To prevent old build outputs from colliding, just clean the EC build.
+pushd /mnt/host/source/src/platform/ec
+make clobber
+popd
 
 # Now create the new variant. Output will be captured as a side-effect of
 # running in CQ, or it will be in the scrollback buffer on the user's terminal