cheets_CTS: handle packages with no tests.

Sometimes tradefed returns 0 tests for a package. Currently there
there are several packages on ARC for which this is correct. But
sometimes this can be due to unrelated failures.

BUG=b:32488317
TEST=Ran locally 3 new cases:
     a) Package never reveals any tests (eventual failure).
     b) Package reveals no tests as expected (pass).
     c) Package reveals tests even though it wasn' expected (failure).

Change-Id: Ie8f94c615032247b5e0e1d2922ace3fcf4ea267c
Reviewed-on: https://chromium-review.googlesource.com/406729
Commit-Ready: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Ilja H. Friedel <ihf@chromium.org>
Reviewed-by: Rohit Makasana <rohitbm@chromium.org>
diff --git a/server/cros/tradefed_test.py b/server/cros/tradefed_test.py
index e39e43d..e818ab6 100644
--- a/server/cros/tradefed_test.py
+++ b/server/cros/tradefed_test.py
@@ -630,14 +630,15 @@
                 os.path.join(repository_logs, datetime),
                 destination_logs_datetime)
 
-    def _get_failure_expectations(self):
-        """Return a list of waivers and manual tests.
+    def _get_expected_failures(self, directory):
+        """Return a list of expected failures.
 
-        @return: a list of expected failing tests with unchecked status.
+        @return: a list of expected failures.
         """
-        expected_fail_dir = os.path.join(self.bindir, 'expectations')
+        logging.info('Loading expected failures from %s.', directory)
+        expected_fail_dir = os.path.join(self.bindir, directory)
         expected_fail_files = glob.glob(expected_fail_dir + '/*.' + self._abi)
-        expected_fail_tests = set()
+        expected_failures = set()
         for expected_fail_file in expected_fail_files:
             try:
                 file_path = os.path.join(expected_fail_dir, expected_fail_file)
@@ -645,8 +646,8 @@
                     lines = set(f.read().splitlines())
                     logging.info('Loaded %d expected failures from %s',
                                  len(lines), expected_fail_file)
-                    expected_fail_tests = expected_fail_tests | lines
+                    expected_failures |= lines
             except IOError as e:
                 logging.error('Error loading %s (%s).', file_path, e.strerror)
-        logging.info('Finished loading test waivers: %s', expected_fail_tests)
-        return expected_fail_tests
\ No newline at end of file
+        logging.info('Finished loading expected failures: %s', expected_failures)
+        return expected_failures