cros_run_unit_tests: option to not fail if no testable packages found.

With Slim CQ builds, we will most often pass in the list of packages we
are interested in testing. Therefore, it is now increasingly common to
not find testable packages. This is expected and should not cause the
step to fail.

BUG=chromium:1124357
TEST=./run_pytest

Change-Id: Ia3235fff2b88edd63a4f059c9c35e3c7b539ffa1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2391399
Reviewed-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Sean Abraham <seanabraham@chromium.org>
Tested-by: Navil Perez <navil@google.com>
Commit-Queue: Navil Perez <navil@google.com>
diff --git a/scripts/cros_run_unit_tests.py b/scripts/cros_run_unit_tests.py
index 73bfa98..f40f909 100644
--- a/scripts/cros_run_unit_tests.py
+++ b/scripts/cros_run_unit_tests.py
@@ -71,6 +71,12 @@
       type=int,
       default=multiprocessing.cpu_count(),
       help='The limit for the number of possible concurrent jobs.')
+  parser.add_argument(
+      '--no-testable-packages-ok',
+      default=False,
+      action='store_true',
+      dest='testable_packages_optional',
+      help="If specified, don't fail if no testable packages are found.")
 
   options = parser.parse_args(argv)
   options.Freeze()
@@ -128,6 +134,9 @@
                     '\n  '.join(sorted(packages - pkg_with_test)))
 
   if not pkg_with_test:
+    if opts.testable_packages_optional:
+      logging.warning('No testable packages found!')
+      return 0
     logging.error('No testable packages found!')
     return 1