File: run-tests.py

package info (click to toggle)
python-crc32c 2.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 300 kB
  • sloc: ansic: 979; python: 358; makefile: 2; sh: 2
file content (31 lines) | stat: -rw-r--r-- 697 bytes parent folder | download
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
import os
import subprocess as sp
import sys

SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))


def run(cmd):
    print(" ".join(cmd))
    sp.check_call(cmd)


def run_tests(crc32c_sw_mode):
    os.environ["CRC32C_SW_MODE"] = crc32c_sw_mode
    os.environ["CRC32C_SKIP_HW_PROBE"] = ["0", "1"][crc32c_sw_mode == "none"]
    message = "# Tests for CRC32C_SW_MODE: %s #" % crc32c_sw_mode
    hashes = "#" * len(message)
    print("\n" + hashes)
    print(message)
    print(hashes + "\n")
    run([sys.executable, "-m", "pytest", "-v", os.path.join(SCRIPT_DIR, "test")])


def main():
    run_tests("auto")
    run_tests("force")
    run_tests("none")


if __name__ == "__main__":
    main()