aboutsummaryrefslogtreecommitdiff
path: root/deprecated/automation/clients/dejagnu_compiler.py
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-02-14 03:08:18 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-02-14 03:08:18 +0000
commitdb729d703a0bf8fc92f011d160abd063c338b2f3 (patch)
tree35fa0fbaeaaddd9cc2a126a05eee3527b51e83a8 /deprecated/automation/clients/dejagnu_compiler.py
parentdddbf2c6f79f2334de6d41b86d63698714ba1124 (diff)
parentb75f321fc8978b92ce3db6886ccb966768f0c7a8 (diff)
downloadtoolchain-utils-db729d703a0bf8fc92f011d160abd063c338b2f3.tar.gz
Snap for 6206568 from b75f321fc8978b92ce3db6886ccb966768f0c7a8 to rvc-releaseandroid-vts-11.0_r9android-vts-11.0_r8android-vts-11.0_r7android-vts-11.0_r6android-vts-11.0_r5android-vts-11.0_r4android-vts-11.0_r3android-vts-11.0_r2android-vts-11.0_r16android-vts-11.0_r15android-vts-11.0_r14android-vts-11.0_r13android-vts-11.0_r12android-vts-11.0_r11android-vts-11.0_r10android-vts-11.0_r1android-security-11.0.0_r76android-security-11.0.0_r75android-security-11.0.0_r74android-security-11.0.0_r73android-security-11.0.0_r72android-security-11.0.0_r71android-security-11.0.0_r70android-security-11.0.0_r69android-security-11.0.0_r68android-security-11.0.0_r67android-security-11.0.0_r66android-security-11.0.0_r65android-security-11.0.0_r64android-security-11.0.0_r63android-security-11.0.0_r62android-security-11.0.0_r61android-security-11.0.0_r60android-security-11.0.0_r59android-security-11.0.0_r58android-security-11.0.0_r57android-security-11.0.0_r56android-security-11.0.0_r55android-security-11.0.0_r54android-security-11.0.0_r53android-security-11.0.0_r52android-security-11.0.0_r51android-security-11.0.0_r50android-security-11.0.0_r49android-security-11.0.0_r1android-platform-11.0.0_r9android-platform-11.0.0_r8android-platform-11.0.0_r7android-platform-11.0.0_r6android-platform-11.0.0_r5android-platform-11.0.0_r4android-platform-11.0.0_r3android-platform-11.0.0_r2android-platform-11.0.0_r13android-platform-11.0.0_r12android-platform-11.0.0_r11android-platform-11.0.0_r10android-platform-11.0.0_r1android-cts-11.0_r9android-cts-11.0_r8android-cts-11.0_r7android-cts-11.0_r6android-cts-11.0_r5android-cts-11.0_r4android-cts-11.0_r3android-cts-11.0_r2android-cts-11.0_r16android-cts-11.0_r15android-cts-11.0_r14android-cts-11.0_r13android-cts-11.0_r12android-cts-11.0_r11android-cts-11.0_r10android-cts-11.0_r1android-11.0.0_r6android-11.0.0_r5android-11.0.0_r4android-11.0.0_r3android-11.0.0_r25android-11.0.0_r2android-11.0.0_r17android-11.0.0_r1android11-tests-releaseandroid11-security-releaseandroid11-s1-releaseandroid11-releaseandroid11-platform-releaseandroid11-gsi
Change-Id: I997cf91dd612b5e50d502271baf665232843c30a
Diffstat (limited to 'deprecated/automation/clients/dejagnu_compiler.py')
-rwxr-xr-xdeprecated/automation/clients/dejagnu_compiler.py98
1 files changed, 98 insertions, 0 deletions
diff --git a/deprecated/automation/clients/dejagnu_compiler.py b/deprecated/automation/clients/dejagnu_compiler.py
new file mode 100755
index 00000000..7448b87e
--- /dev/null
+++ b/deprecated/automation/clients/dejagnu_compiler.py
@@ -0,0 +1,98 @@
+#!/usr/bin/python2
+#
+# Copyright 2012 Google Inc. All Rights Reserved.
+"""dejagnu_compiler.py: Run dejagnu test."""
+
+__author__ = 'shenhan@google.com (Han Shen)'
+
+import logging
+import optparse
+import os
+import pickle
+import sys
+import xmlrpclib
+
+from automation.clients.helper import jobs
+from automation.clients.helper import perforce
+from automation.common import command as cmd
+from automation.common import job_group
+from automation.common import logger
+
+
+class DejagnuCompilerNightlyClient:
+ DEPOT2_DIR = '//depot2/'
+ P4_CHECKOUT_DIR = 'perforce2/'
+ P4_VERSION_DIR = os.path.join(P4_CHECKOUT_DIR, 'gcctools/chromeos/v14')
+
+ def __init__(self, board, remote, p4_snapshot, cleanup):
+ self._board = board
+ self._remote = remote
+ self._p4_snapshot = p4_snapshot
+ self._cleanup = cleanup
+
+ def Run(self):
+ server = xmlrpclib.Server('http://localhost:8000')
+ server.ExecuteJobGroup(pickle.dumps(self.CreateJobGroup()))
+
+ def CheckoutV14Dir(self):
+ p4view = perforce.View(self.DEPOT2_DIR, [
+ perforce.PathMapping('gcctools/chromeos/v14/...')
+ ])
+ return self.GetP4Snapshot(p4view)
+
+ def GetP4Snapshot(self, p4view):
+ p4client = perforce.CommandsFactory(self.P4_CHECKOUT_DIR, p4view)
+
+ if self._p4_snapshot:
+ return p4client.CheckoutFromSnapshot(self._p4_snapshot)
+ else:
+ return p4client.SetupAndDo(p4client.Sync(), p4client.Remove())
+
+ def CreateJobGroup(self):
+ chain = cmd.Chain(self.CheckoutV14Dir(), cmd.Shell(
+ 'python', os.path.join(self.P4_VERSION_DIR, 'test_gcc_dejagnu.py'),
+ '--board=%s' % self._board, '--remote=%s' % self._remote,
+ '--cleanup=%s' % self._cleanup))
+ label = 'dejagnu'
+ job = jobs.CreateLinuxJob(label, chain, timeout=8 * 60 * 60)
+ return job_group.JobGroup(label,
+ [job],
+ cleanup_on_failure=True,
+ cleanup_on_completion=True)
+
+
+@logger.HandleUncaughtExceptions
+def Main(argv):
+ parser = optparse.OptionParser()
+ parser.add_option('-b',
+ '--board',
+ dest='board',
+ help='Run performance tests on these boards')
+ parser.add_option('-r',
+ '--remote',
+ dest='remote',
+ help='Run performance tests on these remotes')
+ parser.add_option('-p',
+ '--p4_snapshot',
+ dest='p4_snapshot',
+ help=('For development only. '
+ 'Use snapshot instead of checking out.'))
+ parser.add_option('--cleanup',
+ dest='cleanup',
+ default='mount',
+ help=('Cleanup test directory, values could be one of '
+ '"mount", "chroot" or "chromeos"'))
+ options, _ = parser.parse_args(argv)
+
+ if not all([options.board, options.remote]):
+ logging.error('Specify a board and remote.')
+ return 1
+
+ client = DejagnuCompilerNightlyClient(options.board, options.remote,
+ options.p4_snapshot, options.cleanup)
+ client.Run()
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(Main(sys.argv))