File: test_support.py

package info (click to toggle)
libtemplates-parser 25.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,404 kB
  • sloc: ada: 12,020; python: 658; makefile: 351; sh: 37
file content (27 lines) | stat: -rwxr-xr-x 594 bytes parent folder | download | duplicates (2)
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
"""
This module contains support functions for all test.py
"""

from e3.os.process import Run
import os
import sys


def gprbuild(prj):
    """Compile a project with gprbuild"""
    cmd = ["gprbuild", "-p", "-P" + prj, "-bargs", "-E"]
    process = Run(cmd)
    if process.status:
        print(process.out)


def run(bin, options=None, output_file=None):
    """Run a test"""
    if options is None:
        options = []
    if "TIMEOUT" in os.environ:
        timeout = int(os.environ["TIMEOUT"])
    else:
        timeout = 300

    Run([bin] + options, output=output_file, timeout=timeout)