Update Prow image to Debian Buster so that we have access to Python 3.7

Upstream KUnit depends on features only available in Python 3.7;
however, the Debian Stretch repo only has upto Python 3.5. So update
Prow to Debian Buster and Python 3.7.

Change-Id: I5771413e582064e91beaf41ed90b49a269081ae4
diff --git a/WORKSPACE b/WORKSPACE
index fd83a37..dea4702 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -83,7 +83,7 @@
     name = "debian_base",
     registry = "index.docker.io",
     repository = "library/debian",
-    tag = "stretch",
+    tag = "buster",
 )
 
 # rules for installing packages from debian snapshot
@@ -110,9 +110,9 @@
 dpkg_src(
     name = "uml",
     arch = "amd64",
-    distro = "stretch",
-    sha256 = "a0c5a8906ac6ad010535cca152df43411d0e5db1790f6d0e4106bbdf96f3ef0f",
-    snapshot = "20181121T102052Z",
+    distro = "buster",
+    sha256 = "d310bbe2c01ff031ed5e65f50d6ce7ffef24717ffbc696a259117e45370c437e",
+    snapshot = "20181221T102052Z",
     url = "http://snapshot.debian.org/archive",
 )
 
diff --git a/debs.bzl b/debs.bzl
index dbda02a..6c81032 100644
--- a/debs.bzl
+++ b/debs.bzl
@@ -12,6 +12,8 @@
     return [
         "bc",
         "binutils",
+        "binutils-common",
+        "binutils-x86-64-linux-gnu",
         "bison",
         "build-essential",
         "bzip2",
@@ -34,6 +36,7 @@
         "lcov",
         "libasan3",
         "libatomic1",
+        "libbinutils",
         "libbison-dev",
         "libbz2-1.0",
         "libc-dev-bin",
@@ -51,26 +54,27 @@
         "libgc1c2",
         "libgcc-6-dev",
         "libgcc1",
-        "libgdbm3",
         "libgmp10",
         "libgomp1",
         "libisl15",
+        "libisl19",
         "libitm1",
         "liblsan0",
         "libltdl7",
         "liblzma5",
         "libmpc3",
         "libmpdec2",
-        "libmpfr4",
+        "libmpfr6",
         "libmpx2",
-        "libncurses5",
-        "libncursesw5",
+        "libncurses6",
+        "libncursesw6",
         "libnewt0.52",
         "libpcre3",
-        "libperl5.24",
+        "libpcre2-8-0",
+        "libperl5.28",
         "libpython3-stdlib",
-        "libpython3.5-minimal",
-        "libpython3.5-stdlib",
+        "libpython3.7-minimal",
+        "libpython3.7-stdlib",
         "libquadmath0",
         "libreadline7",
         "libselinux1",
@@ -81,10 +85,10 @@
         "libstdc++-6-dev",
         "libstdc++6",
         "libtextwrap1",
-        "libtinfo5",
+        "libtinfo6",
         "libtsan0",
         "libubsan0",
-        "libunistring0",
+        "libunistring2",
         "linux-libc-dev",
         "m4",
         "make",
@@ -93,11 +97,11 @@
         "patch",
         "perl",
         "perl-base",
-        "perl-modules-5.24",
+        "perl-modules-5.28",
         "python3",
         "python3-minimal",
-        "python3.5",
-        "python3.5-minimal",
+        "python3.7",
+        "python3.7-minimal",
         "readline-common",
         "tar",
         "xz-utils",
diff --git a/kunit.sh b/kunit.sh
index 7dcb702..3f3e97c 100755
--- a/kunit.sh
+++ b/kunit.sh
@@ -14,10 +14,25 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# TODO(brendanhiggins@google.com): The below is needed to make gcc-6 the default
+# gcc in this image. gcc-6 is needed because gcov currently does not work with
+# UML on gcc-7+. See:
+# https://patchwork.ozlabs.org/project/linux-um/patch/20190718012136.GA135592@google.com/
+rm /usr/bin/gcc
+rm /usr/bin/g++
+rm /usr/bin/gcov
+
+ln -s /usr/bin/gcc-6 /usr/bin/cc
+ln -s /usr/bin/gcc-6 /usr/bin/gcc
+ln -s /usr/bin/c++-6 /usr/bin/c++
+ln -s /usr/bin/g++-6 /usr/bin/g++
+ln -s /usr/bin/gcov-6 /usr/bin/gcov
 
 # Prow may not create artifacts folder in advance.
 mkdir -p "$ARTIFACTS"
 
+KUNIT_VERSION_ARGS=""
+
 # KUnit repos based on upstream have a default kunitconfig; we can check for
 # that to see if we are running a repo based on upstream or not.
 #
@@ -28,6 +43,7 @@
     cp ./arch/um/configs/kunit_defconfig .kunitconfig
   fi
   cp .kunitconfig .config
+  KUNIT_VERSION_ARGS="--build_dir=."
 else
   if [[ ! -f ./kunitconfig ]]; then
     cp /kunitconfig ./kunitconfig
@@ -48,12 +64,15 @@
 KUNIT_TEST_EXIT_CODE=$?
 
 # Build and run kernel, parse output, and send details to output log
-python3 ./tools/testing/kunit/kunit.py run > "$ARTIFACTS/kunit.log" 2>&1
+python3 ./tools/testing/kunit/kunit.py run $KUNIT_VERSION_ARGS > "$ARTIFACTS/kunit.log" 2>&1
 KUNIT_EXIT_CODE=$?
 
 # Generate an HTML coverage report using LCOV
-# TODO(mariaignacio): Have LCOV_FILTER be default until we can specify the state
-LCOV_FILTER=1
+# TODO(brendanhiggins@google.com): Prow no longer seems to provide a full git
+# repo, so we cannot use git trivially to measure incremental coverage. Not sure
+# if this is a setting we can change or if we can get the information in some
+# other way.
+LCOV_FILTER=0
 
 if [[ $LCOV_FILTER -eq 1 ]]; then
   # Generate a list of recently modified directories, "-d <dirname> ..."
@@ -101,7 +120,9 @@
   echo "============================="
 else
   awk '/Overall coverage rate:/,EOF' "$ARTIFACTS/genhtml.log"
-  echo "Incremental line coverage: $(/incremental_coverage coverage.info)%"
+  if [[ $LCOV_FILTER -eq 1 ]]; then
+    echo "Incremental line coverage: $(/incremental_coverage coverage.info)%"
+  fi
 fi
 
 echo "============================="