autotest: Add new test sequence for thermal qual

The test suite runs power_ThermalLoad & power_VideoCall
when charging/discharging and collects perf data with
power_Speedometer2

BUG=b:140967161
TEST=ThermalQual.fast

Change-Id: Ic65be2ffe8323be3d1be99cef98c138860809e20
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2018468
Tested-by: Puthikorn Voravootivat <puthik@chromium.org>
Auto-Submit: Puthikorn Voravootivat <puthik@chromium.org>
Commit-Queue: Puthikorn Voravootivat <puthik@chromium.org>
Reviewed-by: Mengqi Guo <mqg@chromium.org>
diff --git a/server/site_tests/sequences/control.thermal_qual_full b/server/site_tests/sequences/control.thermal_qual_full
new file mode 100644
index 0000000..8a26855
--- /dev/null
+++ b/server/site_tests/sequences/control.thermal_qual_full
@@ -0,0 +1,70 @@
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = "puthik"
+NAME = "ThermalQual.full"
+TIME = "LENGTHY"
+TEST_CATEGORY = "Stress"
+TEST_CLASS = "suite"
+TEST_TYPE = "server"
+DOC = """
+Sequence for qualification for thermal.
+"""
+
+from autotest_lib.client.common_lib import utils
+
+HOURS=60*60
+
+# Need separate list for client and server test due to how these test work.
+CLIENT_TESTS = [
+    ('power_WaitForCoolDown', {}),
+    ('power_Speedometer2', {'tag' : 'thermal_qual_full_before'}),
+
+    ('power_BatteryCharge', {
+        'percent_target_charge' : 70, 'max_run_time': 5 * HOURS}),
+    ('power_WaitForCoolDown', {}),
+    ('power_ThermalLoad', {
+        'tag' : 'thermal_qual_full_discharge', 'force_discharge' : True}),
+    ('power_Speedometer2', {'tag' : 'thermal_qual_full_ThermalLoad_discharge'}),
+
+    ('power_BatteryCharge', {
+        'percent_target_charge' : 70, 'max_run_time': 5 * HOURS}),
+    ('power_WaitForCoolDown', {}),
+    ('power_VideoCall', {
+        'tag' : 'thermal_qual_full_discharge', 'force_discharge' : True}),
+    ('power_Speedometer2', {'tag' : 'thermal_qual_full_VideoCall_discharge'}),
+
+    ('power_BatteryDrain', {
+        'force_discharge' : True, 'drain_to_percent' : 30,
+        'drain_timeout': 5 * HOURS}),
+    ('power_WaitForCoolDown', {}),
+    ('power_ThermalLoad', {'tag' : 'thermal_qual_full_charge'}),
+    ('power_Speedometer2', {'tag' : 'thermal_qual_full_ThermalLoad_charge'}),
+
+    ('power_BatteryDrain', {
+        'force_discharge' : True, 'drain_to_percent' : 30,
+        'drain_timeout': 5 * HOURS}),
+    ('power_WaitForCoolDown', {}),
+    ('power_VideoCall', {'tag' : 'thermal_qual_full_charge'}),
+    ('power_Speedometer2', {'tag' : 'thermal_qual_full_VideoCall_charge'})
+]
+
+# Workaround to make it compatible with moblab autotest UI.
+global args_dict
+try:
+    args_dict
+except NameError:
+    args_dict = utils.args_to_dict(args)
+
+pdash_note = args_dict.get('pdash_note', '')
+
+def run_client_test(machine):
+    client = hosts.create_host(machine)
+    client_at = autotest.Autotest(client)
+
+    for test, argv in CLIENT_TESTS:
+        argv['pdash_note'] = pdash_note
+        client_at.run_test(test, **argv)
+
+job.parallel_on_machines(run_client_test, machines)