This file is indexed.

/usr/lib/python3/dist-packages/os_testr/generate_subunit.py is in python3-os-testr 1.0.0-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python2
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.


import datetime
import sys

import pbr.version
import subunit
from subunit import iso8601


__version__ = pbr.version.VersionInfo('os_testr').version_string()


def main():
    if '--version' in sys.argv:
        print(__version__)
        exit(0)

    start_time = datetime.datetime.fromtimestamp(float(sys.argv[1])).replace(
        tzinfo=iso8601.UTC)
    elapsed_time = datetime.timedelta(seconds=int(sys.argv[2]))
    stop_time = start_time + elapsed_time

    if len(sys.argv) > 3:
        status = sys.argv[3]
    else:
        status = 'success'

    if len(sys.argv) > 4:
        test_id = sys.argv[4]
    else:
        test_id = 'devstack'

    # Write the subunit test
    output = subunit.v2.StreamResultToBytes(sys.stdout)
    output.startTestRun()
    output.status(timestamp=start_time, test_id=test_id)
    # Write the end of the test
    output.status(test_status=status, timestamp=stop_time, test_id=test_id)
    output.stopTestRun()


if __name__ == '__main__':
    main()