Open Bug 2018028 Opened 1 month ago Updated 1 month ago

Quadratic test loading in jittest.py

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

People

(Reporter: mgaudet, Unassigned)

References

(Blocks 1 open bug)

Details

If jittest.py is provided arguments, we construct the test list as follows

    if test_args:
        read_all = False
        for arg in test_args:
            test_list += jittests.find_tests(arg)

find_tests however walks the whole directory path each time!

def find_tests(substring=None):
    ans = []
    for dirpath, dirnames, filenames in os.walk(TEST_DIR):
        dirnames.sort()
        filenames.sort()
        if dirpath == ".":
            continue

        for filename in filenames:
            if not filename.endswith(".js"):
                continue
            if filename in ("shell.js", "browser.js"):
                continue
            test = os.path.join(dirpath, filename)
            if substring is None or substring in os.path.relpath(test, TEST_DIR):
                ans.append(test)
    return ans

This of course is badly quadratic if you were to provide a long list of paths.

We should only be walking the tree once and evaluating the test across substrings once per test.

This will be totally un-noticable the majority of the time but is irksome :)

Blocks: sm-testing
Severity: -- → N/A
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.