1# Copyright 2017 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.
4from autotest_lib.server.cros.cfm.configurable_test.dsl import *
5from autotest_lib.server import utils
6
7AUTHOR = "kerl@google.com, chromeos-meetings@google.com"
8NAME = "enterprise_CFM_ConfigurableCfmTestSanity.verifications"
9PURPOSE = "Verifies the configurable CfM test infra with a simple scenario"
10CRITERIA = "No errors occur"
11ATTRIBUTES = "suite:hotrod-remora, suite:bluestreak-pre-cq"
12TIME = "SHORT"
13TEST_CATEGORY = "Functional"
14TEST_TYPE = "server"
15
16DOC = """
17Verifies that we can specify and run verification and assertion steps in a
18configurable CFM test.
19"""
20
21cfm_test = CfmTest(
22    scenario=Scenario(
23        AssertUsbDevices([ATRUS], lambda devices: True),
24        RetryAssertAction(
25            AssertFileDoesNotContain('/var/log/messages', ['FOOERRORBAR']),
26            5,
27            0.1),
28        Sleep(0.1),
29        AssertFileDoesNotContain('/var/log/eventlog.txt', ['FOOERRORBAR']),
30        # Create some silly scenarios to be selected at random. The purpose
31        # of this is only to test the SelectScenarioAtRandom action.
32        # Since the predicate always return true for the assert actions
33        # we do not actually verify the devices exist.
34        SelectScenarioAtRandom(scenarios=[
35                Scenario(AssertUsbDevices([ATRUS], lambda devices: True),
36                    AssertFileDoesNotContain('/var/log/messages',
37                                             ['FOOERRORBAR'])),
38                Scenario(AssertUsbDevices([HUDDLY_GO], lambda devices: True)),
39                Scenario(AssertUsbDevices([ATRUS], lambda devices: True))],
40            run_times=3),
41        AssertNoNewCrashes()
42    ),
43
44    configuration=Configuration(
45        run_test_only = True
46    )
47)
48
49def run_test(machine):
50    job.run_test("enterprise_CFM_ConfigurableCfmTestSanity",
51                 cfm_test = cfm_test,
52                 tag = 'verifications',
53                 host = hosts.create_host(machine))
54
55
56parallel_simple(run_test, machines)
57