This file is indexed.

/usr/share/sagemath/bin/sage-runtests is in sagemath-common 7.4-9.

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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env python

import optparse, os, sys

if __name__ == "__main__":
    parser = optparse.OptionParser()

    def optional_argument(option, opt_str, value, parser, typ, default_arg):
        assert value is None
        try:
            next_arg = typ(parser.rargs[0])
        except Exception:
            next_arg = default_arg
        else:
            parser.rargs.pop(0)
        setattr(parser.values, option.dest, next_arg)

    parser.add_option("-p", "--nthreads", dest="nthreads", default=1, action="callback",
        callback=optional_argument, callback_args=(int, 0), nargs=0,
        metavar="N", help="tests in parallel using N threads with 0 interpreted as max(2, min(8, cpu_count()))")
    parser.add_option("-T", "--timeout", type=int, default=-1, help="timeout (in seconds) for doctesting one file, 0 for no timeout")
    parser.add_option("-a", "--all", action="store_true", default=False, help="test all files in the Sage library")
    parser.add_option("--logfile", metavar="FILE", help="log all output to FILE")
    parser.add_option("--sagenb", action="store_true", default=False, help="test all files from the Sage notebook sources")

    parser.add_option("-l", "--long", action="store_true", default=False, help="include lines with the phrase 'long time'")
    parser.add_option("--warn-long", dest="warn_long", default=None, action="callback",
        callback=optional_argument, callback_args=(float, 1.0), nargs=0,
        metavar="SECONDS", help="warn if tests take more time than SECONDS")
    parser.add_option("--optional", metavar="PKGS", default="sage,optional",
        help='only run tests including one of the "# optional" tags listed in PKGS; '
             'if "sage" is listed, will also run the standard doctests; '
             'if "optional" is listed, will also run tests for installed optional (new-style) packages; '
             'if "external" is listed, will also run tests for available external software; '
             'if set to "all", then all tests will be run')
    parser.add_option("--randorder", type=int, metavar="SEED", help="randomize order of tests")
    parser.add_option("--global-iterations", "--global_iterations", type=int, default=0, help="repeat the whole testing process this many times")
    parser.add_option("--file-iterations", "--file_iterations", type=int, default=0, help="repeat each file this many times, stopping on the first failure")

    parser.add_option("-i", "--initial", action="store_true", default=False, help="only show the first failure in each file")
    parser.add_option("--force_lib", "--force-lib", action="store_true", default=False, help="assume all files are Sage library files, regardless of location, ie don't import anything from the file tested")
    parser.add_option("--abspath", action="store_true", default=False, help="print absolute paths rather than relative paths")
    parser.add_option("--verbose", action="store_true", default=False, help="print debugging output during the test")
    parser.add_option("-d", "--debug", action="store_true", default=False, help="drop into a python debugger when an unexpected error is raised")

    parser.add_option("--gdb", action="store_true", default=False, help="run doctests under the control of gdb")
    parser.add_option("--valgrind", "--memcheck", action="store_true", default=False,
                      help="run doctests using Valgrind's memcheck tool.  The log "
                         "files are named sage-memcheck.PID and can be found in " +
                         os.path.join(os.environ["DOT_SAGE"], "valgrind"))
    parser.add_option("--massif", action="store_true", default=False,
                      help="run doctests using Valgrind's massif tool.  The log "
                         "files are named sage-massif.PID and can be found in " +
                         os.path.join(os.environ["DOT_SAGE"], "valgrind"))
    parser.add_option("--cachegrind", action="store_true", default=False,
                      help="run doctests using Valgrind's cachegrind tool.  The log "
                         "files are named sage-cachegrind.PID and can be found in " +
                         os.path.join(os.environ["DOT_SAGE"], "valgrind"))
    parser.add_option("--omega", action="store_true", default=False,
                      help="run doctests using Valgrind's omega tool.  The log "
                         "files are named sage-omega.PID and can be found in " +
                         os.path.join(os.environ["DOT_SAGE"], "valgrind"))

    parser.add_option("-f", "--failed", action="store_true", default=False,
        help="doctest only those files that failed in the previous run")
    parser.add_option("-n", "--new", action="store_true", default=False,
        help="doctest only those files that have been changed in the repository and not yet been committed")
    parser.add_option("--show-skipped", "--show_skipped", action="store_true", default=False,
        help="print a summary at the end of each file of optional tests that were skipped")

    parser.add_option("--stats_path", "--stats-path", default=os.path.join(os.environ['DOT_SAGE'], "timings2.json"),
                          help="path to a json dictionary for the latest run storing a timing for each file")

    # The --serial option is only really for internal use, better not
    # document it.
    parser.add_option("--serial", action="store_true", default=False, help=optparse.SUPPRESS_HELP)

    parser.set_usage("sage -t [options] filenames")


    from sage.doctest.control import DocTestController
    options, args = parser.parse_args()

    if len(args) == 0 and not (options.all or options.sagenb or options.new):
        parser.print_help()
        err = 2
    else:
        DC = DocTestController(options, args)
        err = DC.run()

    sys.exit(err)