1# Copyright (c) 2018 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5from autotest_lib.client.common_lib import utils
6
7AUTHOR = "puthik"
8NAME = "MemoryQual.moblab"
9ATTRIBUTES = "suite:memory_qual"
10TIME = "LENGTHY"
11TEST_CATEGORY = "Stress"
12TEST_CLASS = "suite"
13TEST_TYPE = "server"
14
15DOC = """
16Sequence for qualification new memory part to AVL.
17"""
18
19HOUR_IN_SECS=60*60
20
21CLIENT_TESTS= [
22    ('platform_MemCheck', {}),
23    ('hardware_RamFio', {
24        'requirements': [('ram_suite', [])]}),
25    ('hardware_MemoryThroughput', {
26        'tag': 'memory_qual', 'test': 'bcopy', 'warmup': 100,
27        'num_iterations': 100, 'parallel': 2,
28        'sizes' : [ 1024, 2048, 4096, 8192,
29                    15360, 16384, 24576,
30                    30720, 32768, 33792,
31                    49152, 65536, 98304,
32                    130048, 131072, 256000,
33                    262144, 393216, 524288,
34                    1048576, 1468006, 1572864,
35                    1966080, 2097152, 2228224,
36                    2621440, 3072000, 3145728,
37                    3276800, 4194304, 8388608,
38                    16777216, 33554432, 67108864]}),
39    ('hardware_MemoryLatency', {
40        'sample_size_kb': [ int(2), int(192), int(1024)]}),
41    ('hardware_Memtester', {
42        'tag' : 'memory_qual', 'loop' : 100}),
43    ('hardware_SAT', {
44        'tag' : 'memory_qual', 'seconds' : 8 * HOUR_IN_SECS}),
45    ('power_MemorySuspend', {
46        'tag' : 'memory_qual', 'num_suspends' : 2}),
47]
48
49CLIENT_X86_TESTS= [
50    ('hardware_UnsafeMemory', {
51        'sec' : 5 * HOUR_IN_SECS}),
52]
53
54SERVER_TESTS= [
55    ('hardware_MemoryIntegrity', {
56        'tag' : 'idle', 'seconds' : HOUR_IN_SECS, 'suspend': False}),
57    ('hardware_MemoryIntegrity', {
58        'tag' : 'suspend', 'seconds' : HOUR_IN_SECS, 'suspend': True}),
59]
60
61def run_client_test(machine):
62    client = hosts.create_host(machine)
63    client_at = autotest.Autotest(client)
64    client_tests = (CLIENT_TESTS + CLIENT_X86_TESTS if client.get_arch() in
65        ('i386', 'i686', 'x86_64') else CLIENT_TESTS)
66    for test, argv in client_tests:
67        client.reboot()
68        client_at.run_test(test, **argv)
69
70def run_server_test(machine):
71    client = hosts.create_host(machine)
72    for test, argv in SERVER_TESTS:
73        client.reboot()
74        job.run_test(test, client_ip=machine, **argv)
75
76keyval = dict()
77try:
78    keyval['bug_id'] = bug_id
79    keyval['part_id'] = part_id
80except NameError:
81    # bug_id and/or part_id variables not defined
82    pass
83utils.write_keyval(job.resultdir, keyval)
84
85job.parallel_on_machines(run_client_test, machines)
86parallel_simple(run_server_test, machines)
87