1# -*- python -*-
2# Copyright (c) 2012 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6Import('env')
7
8# test source is copied from tests/nameservice/ -- we don't actually
9# care to run the test here, just to cause it to fall over.  we do,
10# however, run it without any fault injection to ensure that we don't
11# have any false injection, to ensure the test hasn't bitrotted.
12
13# postmessage version of srpc_nameservice_test
14
15pm_ns_obj = env.ComponentObject('fault_pm_nameservice_test.o',
16                                'fault_pm_nameservice_test.cc')
17pm_ns_nexe_name = env.ProgramNameForNmf('fault_pm_nameservice_test')
18pm_ns_nexe = env.ComponentProgram(pm_ns_nexe_name,
19                                  pm_ns_obj,
20                                  EXTRA_LIBS=['nacl_ppapi_util',
21                                              'ppapi_cpp',
22                                              'pthread',
23                                              'srpc',
24                                              'platform',
25                                              'gio',
26                                              'imc',
27                                              'imc_syscalls',
28                                              ])
29env.Publish(pm_ns_nexe_name, 'run',
30            ['no_fault_pm_nameservice_test.html',
31             'fault_pm_nameservice_test.html',
32             ])
33
34# chrome_browser_tests
35
36# NB: there is a "plain" version of post-message based name service
37# test, and a "fault-injected" version -- essentially this test is
38# simple and in the same repository as the core NaCl where the fault
39# injection code (see native_client/src/trusted/fault_injection/)
40# lives, which is a primary requirement for being able to commit
41# changes to the tests and to the code-under-test in atomic units.
42
43for extra_os_env, test_args, out_name, run_name, html_file in [
44    [[],
45     [],
46     'no_fault_pm_nameservice_browser_test.out',
47     'run_no_fault_pm_nameservice_chrome_browser_test',
48     'no_fault_pm_nameservice_test.html',
49     ],
50    [['NACL_FAULT_INJECTION=load_module=GF20'],
51     # LOAD_NO_MEMORY
52     [('expected_error','"NaCl module load failed: Insufficient memory to load file"')],
53     'fault_pm_nameservice_browser_test.out',
54     'run_fault_pm_nameservice_chrome_browser_test',
55     'fault_pm_nameservice_test.html',
56     ],
57    [['NACL_FAULT_INJECTION=pq=GF2'],
58     # LOAD_UNSUPPORTED_OS_PLATFORM
59     [('expected_error', '"NaCl module load failed: Operating system platform is not supported"')],
60     'fault_pq_os_pm_nameservice_browser_test.out',
61     'run_fault_pq_os_pm_nameservice_chrome_browser_test',
62     'fault_pm_nameservice_test.html',
63     ],
64    [['NACL_FAULT_INJECTION=pq=GF3'],
65     # LOAD_DEP_UNSUPPORTED
66     [('expected_error', '"NaCl module load failed: Data Execution Prevention is required but is not supported"')],
67     'fault_pq_dep_pm_nameservice_browser_test.out',
68     'run_fault_pq_dep_pm_nameservice_chrome_browser_test',
69     'fault_pm_nameservice_test.html',
70     ],
71    ]:
72
73    node = env.PPAPIBrowserTester(
74        out_name,
75        url=html_file,
76        nmf_names=['fault_pm_nameservice_test'],
77        files=env.ExtractPublishedFiles(pm_ns_nexe_name),
78        test_args=test_args,
79        osenv=['NACLVERBOSITY=0:pp_weak_ref=0:weak_ref=0'] + extra_os_env
80        )
81
82    env.AddNodeToTestSuite(node,
83                           ['chrome_browser_tests'],
84                           run_name,
85                           is_broken=(env.PPAPIBrowserTesterIsBroken() or
86                                      env.Bit('nacl_glibc')))
87