performance test initial work

- pts build added (not yet pulled by cts)

- cts-tradefed has PTS mode where binary is under android-pts

- performance measurement is delivered to host by throwing exception!
  : This can reduce the amount of code duplication as all existing
    instrumentation test code can be re-used.
    When performance test throws PtsException, it is treated as PASS and
    the message is stored to the xml.

- UI scrolling performance
  : scroll 10k list from top to bottom and measure time

- File system performance
  : sequential write, sequential read, update
    update with almost full disk
    actural disk I/O can be checked by monitoring /proc/self/io
    if kernel supports it. But it is only for debugging

Change-Id: Id83988fe34b6040bc20c98061a2b4f3d2f878b86
diff --git a/tools/utils/buildCts.py b/tools/utils/buildCts.py
index ada706c..77e93b1 100755
--- a/tools/utils/buildCts.py
+++ b/tools/utils/buildCts.py
@@ -54,20 +54,24 @@
 
   def __init__(self, argv):
     """Initialize the CtsBuilder from command line arguments."""
-    if not len(argv) == 6:
-      print 'Usage: %s <testRoot> <ctsOutputDir> <tempDir> <androidRootDir> <docletPath>' % argv[0]
+    if not (len(argv) == 6 or len(argv)==7):
+      print 'Usage: %s <testRoot> <ctsOutputDir> <tempDir> <androidRootDir> <docletPath> [-pts]' % argv[0]
       print ''
       print 'testRoot:       Directory under which to search for CTS tests.'
       print 'ctsOutputDir:   Directory in which the CTS repository should be created.'
       print 'tempDir:        Directory to use for storing temporary files.'
       print 'androidRootDir: Root directory of the Android source tree.'
       print 'docletPath:     Class path where the DescriptionGenerator doclet can be found.'
+      print '-pts:           generate plan for PTS.'
       sys.exit(1)
     self.test_root = sys.argv[1]
     self.out_dir = sys.argv[2]
     self.temp_dir = sys.argv[3]
     self.android_root = sys.argv[4]
     self.doclet_path = sys.argv[5]
+    self.isCts = True
+    if len(argv) ==7 and sys.argv[6] == "-pts":
+      self.isCts = False
 
     self.test_repository = os.path.join(self.out_dir, 'repository/testcases')
     self.plan_repository = os.path.join(self.out_dir, 'repository/plans')
@@ -99,6 +103,13 @@
       doc = tools.XmlFile(description)
       packages.append(doc.GetAttr('TestPackage', 'appPackageName'))
 
+    if not self.isCts: # PTS
+      plan = tools.TestPlan(packages)
+      plan.Include('.*')
+      plan.Exclude(r'android\.tests\.sigtest')
+      self.__WritePlan(plan, 'PTS')
+      return
+
     plan = tools.TestPlan(packages)
     plan.Exclude('android\.performance.*')
     self.__WritePlan(plan, 'CTS')
@@ -158,3 +169,4 @@
   if result != 0:
     sys.exit(result)
   builder.GenerateTestPlans()
+