autotest: Change exception type raised in servo set()

The Servo.set() method was raising an AssertionError, which bypasses
logic in many tests that tries to catch TestFail.  This commit makes
it use TestFail instead.

It also now reports what the actual value was, when it failed to change.

TEST=Run faft_lv1 on a device with cr50_uart_capture:not_applicable.
BUG=chromium:1013627
Change-Id: I96dfcab34df490099616085410c10872ed7373a1
Reviewed-on: https://chromium-review.googlesource.com/1857367
Tested-by: Dana Goyette <dgoyette@chromium.org>
Commit-Ready: Dana Goyette <dgoyette@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
diff --git a/server/cros/servo/servo.py b/server/cros/servo/servo.py
index 067c552..f194d65 100644
--- a/server/cros/servo/servo.py
+++ b/server/cros/servo/servo.py
@@ -729,17 +729,22 @@
 
         @param gpio_name Name of the gpio.
         @param gpio_value New setting for the gpio.
+        @raise error.TestFail: if the control value fails to change.
         """
         self.set_nocheck(gpio_name, gpio_value)
         retry_count = Servo.GET_RETRY_MAX
-        while gpio_value != self.get(gpio_name) and retry_count:
+        actual_value = self.get(gpio_name)
+        while gpio_value != actual_value and retry_count:
             logging.warning("%s != %s, retry %d", gpio_name, gpio_value,
-                         retry_count)
+                            retry_count)
             retry_count -= 1
             time.sleep(Servo.SHORT_DELAY)
-        if not retry_count:
-            assert gpio_value == self.get(gpio_name), \
-                'Servo failed to set %s to %s' % (gpio_name, gpio_value)
+            actual_value = self.get(gpio_name)
+
+        if gpio_value != actual_value:
+            raise error.TestFail(
+                    'Servo failed to set %s to %s. Got %s.'
+                    % (gpio_name, gpio_value, actual_value))
 
 
     def set_nocheck(self, gpio_name, gpio_value):