Fixes some of the flakiness in Telecom

- Fixes some flakiness in the tests
- Mocks out the ToneGenerator

Test: Run Telecom Unit Tests
Change-Id: If3bd51fe4a82068cc0d712d2e499abde4fdb0481
diff --git a/scripts/telecom_testing.sh b/scripts/telecom_testing.sh
index 0ece427..723b041 100644
--- a/scripts/telecom_testing.sh
+++ b/scripts/telecom_testing.sh
@@ -10,6 +10,7 @@
                           running tests (mmma).
   -e                    Run code coverage. Coverage will be output into the coverage/
                           directory in the repo root.
+  -g                    Run build commands with USE_GOMA=true
   -h                    This help message.
   "
 
@@ -20,8 +21,9 @@
   local installwdep=false
   local debug=false
   local coverage=false
+  local goma=false
 
-  while getopts "c:p:hadie" opt; do
+  while getopts "c:p:hadieg" opt; do
     case "$opt" in
       h)
         echo "$usage"
@@ -40,6 +42,8 @@
         installwdep=true;;
       e)
         coverage=true;;
+      g)
+        goma=true;;
       p)
         project=$OPTARG;;
     esac
@@ -67,6 +71,8 @@
   if [ $install = true ] ; then
     local olddir=$(pwd)
     local emma_opt=
+    local goma_opt=
+
     cd $T
     # Build and exit script early if build fails
 
@@ -76,10 +82,14 @@
       emma_opt="EMMA_INSTRUMENT=false"
     fi
 
+    if [ $goma = true ] ; then
+        goma_opt="USE_GOMA=true"
+    fi
+
     if [ $installwdep = true ] ; then
-      (export ${emma_opt}; mmma -j40 "$build_dir")
+      (export ${emma_opt}; mmma ${goma_opt} -j40 "$build_dir")
     else
-      (export ${emma_opt}; mmm "$build_dir")
+      (export ${emma_opt}; mmm ${goma_opt} "$build_dir")
     fi
     if [ $? -ne 0 ] ; then
       echo "Make failed! try using -a instead of -i if building with coverage"