~jocave/checkbox/hybrid-amd-gpu-mods

« back to all changes in this revision

Viewing changes to providers/plainbox-provider-ubuntu-touch/bin/uls_resource

  • Committer: Sylvain Pineau
  • Author(s): Maciej Kisielewski, Sylvain Pineau, Paul Larson
  • Date: 2016-05-18 08:38:44 UTC
  • mfrom: (4343.1.9 launchpad/loc-svc-test-cc)
  • Revision ID: sylvain_pineau-20160518083844-0v5zigpa4vcwujdy
"automatic merge of lp:~kissiel/checkbox/loc-svc-test-cc/ by tarmac [r=pierre-equoy][bug=][author=kissiel]"

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python3
 
2
#
 
3
# This file is part of Checkbox.
 
4
#
 
5
# Copyright 2016 Canonical Ltd.
 
6
#
 
7
# Checkbox is free software: you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License version 3,
 
9
# as published by the Free Software Foundation.
 
10
#
 
11
# Checkbox is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with Checkbox.  If not, see <http://www.gnu.org/licenses/>.
 
18
"""
 
19
This program generates Ubuntu Location Service tests formatted as plainbox
 
20
jobs. It requires executables ubuntu-location-service-tests package to be
 
21
available in the path.
 
22
 
 
23
Number of plainbox jobs generated with this script should match running:
 
24
$ for e in `find . -executable`; do $e --gtest_list_tests 2>/dev/null; done
 
25
|grep '^\ ' |wc -l
 
26
in the ubuntu-location-service-tests bin directory.
 
27
 
 
28
Note that for different architectures the binaries names and number of tests
 
29
may vary.
 
30
"""
 
31
 
 
32
import os
 
33
import subprocess
 
34
import sys
 
35
 
 
36
BINARIES_BLACKLISTED = [
 
37
    'daemon_and_cli_tests', 'acceptance_tests', # all tests from those binaries
 
38
    # require /usr/share/dbus-cpp/session.conf to be present; this file is
 
39
    # normally _installed_ with libdbus-cpp-dev.
 
40
    #'engine_test', # tests from this binary yield 'stack smashing detected'
 
41
    # which is reproducable on desktops
 
42
]
 
43
 
 
44
TESTS_BLACKLISTED = [
 
45
    'HardwareAbstractionLayerFixture.time_to_first_fix_cold_start_without_supl_benchmark_requires_hardware',
 
46
    'HardwareAbstractionLayerFixture.time_to_first_fix_cold_start_with_supl_benchmark_requires_hardware',
 
47
    # those two tests when run indoors can run indefinitely
 
48
    'RemoteProviderdTest.AClientReceivesUpdatesFromAnOutOfProcessProvider',
 
49
    # this test also requires /usr/share/dbus-cpp/session.conf
 
50
    'EspooProviderTest.receives_position_updates_requires_daemons',
 
51
    # this test requires X11
 
52
    'AppArmorProfileResolver.libapparmor_profile_resolver_returns_correct_profile_for_unconfined_process',
 
53
    # this test is run as part of checkbox, so apparmor reports app being
 
54
    # checkbox, and not the one that test expects
 
55
]
 
56
 
 
57
TESTS_REQUIRING_ROOT = [
 
58
]
 
59
 
 
60
def main():
 
61
    uls_binaries = [
 
62
        "acceptance_tests", "boost_ptree_settings_test",
 
63
        "connectivity_manager_test", "controller_test", "criteria_test",
 
64
        "daemon_and_cli_tests", "default_permission_manager_test",
 
65
        "demultiplexing_reporter_test", "engine_test", "espoo_provider_test",
 
66
        "gps_provider_test", "harvester_test", "ichnaea_reporter_test",
 
67
        "position_test", "provider_factory_test",
 
68
        "provider_selection_policy_test", "provider_test",
 
69
        "remote_provider_test", "remote_providerd_test",
 
70
        "time_based_update_policy_test", "trust_store_permission_manager_test",
 
71
        "wgs84_test"]
 
72
    for uls_bin in uls_binaries:
 
73
        if uls_bin in BINARIES_BLACKLISTED:
 
74
            continue
 
75
        output = subprocess.check_output([uls_bin, '--gtest_list_tests'])
 
76
        suite = ''
 
77
        for line in output.decode(sys.stdout.encoding).split('\n'):
 
78
            if not line.startswith(' '):
 
79
                suite = line
 
80
            else:
 
81
                test_name = line.lstrip()
 
82
                full_name = suite + test_name
 
83
                root = 'yes' if full_name in TESTS_REQUIRING_ROOT else 'no'
 
84
                if full_name in TESTS_BLACKLISTED:
 
85
                    continue
 
86
                print('full_name: {}'.format(full_name))
 
87
                print('test_case: {}'.format(test_name))
 
88
                print('binary: {}'.format(uls_bin))
 
89
                print('root: {}'.format(root))
 
90
                if root == 'yes':
 
91
                    print('ld_lib_path: {}'.format(os.environ.get('LD_LIBRARY_PATH') or ''))
 
92
                print()
 
93
 
 
94
 
 
95
if __name__ == '__main__':
 
96
    main()