facebook / openbmc

OpenBMC is an open software framework to build a complete Linux image for a Board Management Controller (BMC).
633 stars 277 forks source link

tests2: Remove qemu_check filters #179

Closed peterdelevoryas closed 2 years ago

peterdelevoryas commented 2 years ago

Summary: I used this script to rewrite each file to remove the skipIf decorators if possible. I'll look at the CircleCI results, and then add additional tests to the qemu_denylist.txt file to replace these filters.

We still have some qemu_check usage within test cases to perform different test behavior in some cases.

import os

def rewrite_file(path):
    lines = [line for line in open(path, 'r') if "unittest.skipIf" not in line]

    # Remove qemu_check import if unused
    tmp = [line for line in lines if "qemu_check" not in line]
    if len(lines) - len(tmp) == 1:
        lines = tmp

    text = ''.join(lines)
    with open(path, 'w') as f:
        f.truncate(len(text))
        f.write(text)

def yield_file_paths(directory):
    for dir, _, files in os.walk("tests2"):
        for file in files:
            rel_path = os.path.join(dir, file)
            yield rel_path

if __name__ == '__main__':
    for path in yield_file_paths("tests2"):
        rewrite_file(path)

Test Plan: Watching CircleCI results.