Add test_namespace option to test.py

This allows you to run tests in specific namespace relative to the r8 root namespace
tools/test.py --test_namespace desugar/desugaredlibrary

Change-Id: I0d857ae002d419c6187c15e6220a92a478bf6048
diff --git a/tools/test.py b/tools/test.py
index c949fb3..bb8dbd2 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -112,6 +112,10 @@
   result.add_option('--java-max-memory-size', '--java_max_memory_size',
       help='Set memory for running tests, default 4G',
       default='4G')
+  result.add_option('--test-namespace', '--test_namespace',
+      help='Only run tests in  this namespace. The namespace is relative to '
+          'com/android/tools/r8, e.g., desugar/desugaredlibrary',
+      default=None)
   result.add_option('--shard-count', '--shard_count',
       help='We are running this many shards.')
   result.add_option('--shard-number', '--shard_number',
@@ -193,6 +197,8 @@
     gradle_args.append('-Pjctf')
   if options.only_jctf:
     gradle_args.append('-Ponly_jctf')
+  if options.test_namespace:
+    gradle_args.append('-Ptest_namespace=%s' % options.test_namespace)
   if options.jctf_compile_only:
     gradle_args.append('-Pjctf_compile_only')
   if options.disable_assertions: