Add flag to test.py to force lower priority of gradle processes

Change-Id: I062a6700eaec2d35ebf88f4e93dc82643bcf98c1
diff --git a/tools/test.py b/tools/test.py
index aa63a0f..16bb545 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -264,6 +264,10 @@
                         help='Pass --no-daemon to the gradle run',
                         default=False,
                         action='store_true')
+    result.add_argument('--low-priority',
+                        help='Run gradle with priority=low (higher niceness)',
+                        default=False,
+                        action='store_true')
     result.add_argument(
         '--kotlin-compiler-dev',
         help='Specify to download a kotlin dev compiler and run '
@@ -384,6 +388,9 @@
         # Bots don't like dangling processes.
         gradle_args.append('--no-daemon')
 
+    if options.low_priority:
+        gradle_args.append('--priority=low')
+
     # Set all necessary Gradle properties and options first.
     if options.shard_count:
         assert options.shard_number