This file is indexed.

/usr/lib/plainbox-providers-1/checkbox/bin/sleep_time_check is in plainbox-provider-checkbox 0.3-2.

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

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
59
60
61
62
#!/usr/bin/env python3

import sys
import argparse


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('filename',
                        action='store',
                        help='The output file from sleep tests to parse')
    parser.add_argument('--s',
                        dest='sleep_threshold',
                        action='store',
                        type=float,
                        default=10.00,
                        help=('The max time a system should have taken to '
                              'enter a sleep state. (Default: %(default)s)'
                              ))
    parser.add_argument('--r',
                        action='store',
                        dest='resume_threshold',
                        type=float,
                        default=3.00,
                        help=('The max time a system should have taken to '
                              'resume from a sleep state. (Default: '
                              '%(default)s)'))
    args = parser.parse_args()
    
    try:
        file = open(args.filename)
        lines = file.readlines()
    finally:
        file.close()

    # find our times
    for line in lines:
        if "Average time to sleep" in line:
            sleep_time = float(line.split(':')[1].strip())
        elif "Average time to resume" in line:
            resume_time = float(line.split(':')[1].strip())

    print("Average time to enter sleep state: %s seconds" % sleep_time)
    print("Average time to resume from sleep state: %s seconds" % resume_time)
    
    failed = False
    if sleep_time > args.sleep_threshold:
        print("System failed to suspend in less than %s seconds" % 
                args.sleep_threshold)
        failed = True
    if resume_time > args.resume_threshold:
        print("System failed to resume in less than %s seconds" %
                args.resume_threshold)
        failed = True
    if sleep_time <= 0.00 or resume_time <= 0.00:
        print("ERROR: One or more times was not reported correctly")
        failed = True

    return failed

if __name__ == "__main__":
    sys.exit(main())