update bazel workspace for emscripten 2.0.3 (#613)

* update bazel workspace for emscripten 2.0.3

* test to make sure WORKSPACE is up to date

* make it clear what happened when WORKSPACE is out of date

* intentionally add error to make sure circleci fails properly

* revert intentionally bad commit

* increase visibility of failure message

Co-authored-by: Mitch Foley <mitchfoley@google.com>
diff --git a/bazel/WORKSPACE b/bazel/WORKSPACE
index 971c714..22d5238 100644
--- a/bazel/WORKSPACE
+++ b/bazel/WORKSPACE
@@ -8,12 +8,12 @@
 
 load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")
 
-# emscripten 2.0.2
+# emscripten 2.0.3
 http_archive(
     name = "emscripten",
-    sha256 = "9febbc252372efee82e62d548f510dfc85ade6661f5f3be28823848d4757d614",
+    sha256 = "3d1bcbf01104c83595f769f65f9c57eceb6e9f6be8d115e80ff6a44c22570b32",
     strip_prefix = "install",
-    url = "https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/ede25d889a0abe63360d4c5d420087c8753b8bbe/wasm-binaries.tbz2",
+    url = "https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/7a7f38ca19da152d4cd6da4776921a0f1e3f3e3f/wasm-binaries.tbz2",
     build_file = "//emscripten_toolchain:emscripten.BUILD",
     type = "tar.bz2",
 )
diff --git a/scripts/test_bazel.sh b/scripts/test_bazel.sh
index f2a5e3c..f1ba3c9 100755
--- a/scripts/test_bazel.sh
+++ b/scripts/test_bazel.sh
@@ -5,5 +5,20 @@
 set -x
 set -e
 
+# Get the latest version number from emscripten-releases-tag.txt.
+VER=$(grep -oP '(?<=latest\": \")([\d\.]+)(?=\")' \
+        emscripten-releases-tags.txt \
+      | sed --expression "s/\./\\\./g")
+# Based on the latest version number, get the commit hash for that version.
+HASH=$(grep "${VER}" emscripten-releases-tags.txt \
+      | grep -v latest \
+      | cut -f4 -d\")
+      
+FAILMSG="!!! scripts/update_bazel_toolchain.sh needs to be run !!!"
+
+# Ensure the WORKSPACE file is up to date with the latest version.
+grep ${VER} bazel/WORKSPACE || (echo ${FAILMSG} && false)
+grep ${HASH} bazel/WORKSPACE || (echo ${FAILMSG} && false)
+
 cd bazel
 bazel build //hello-world:hello-world-wasm