Flutter Engine
The Flutter Engine
Functions | Variables
infra_tests Namespace Reference

Functions

def test (cmd, cwd)
 
def python_unit_tests (train)
 
def recipe_test (train)
 
def gen_tasks_test (train)
 
def main ()
 

Variables

 INFRA_BOTS_DIR = os.path.dirname(os.path.realpath(__file__))
 
 SKIA_DIR = os.path.abspath(os.path.join(INFRA_BOTS_DIR, os.pardir, os.pardir))
 

Function Documentation

◆ gen_tasks_test()

def infra_tests.gen_tasks_test (   train)

Definition at line 47 of file infra_tests.py.

47def gen_tasks_test(train):
48 cmd = ['go', 'run', 'gen_tasks.go']
49 if not train:
50 cmd.append('--test')
51 try:
52 output = test(cmd, INFRA_BOTS_DIR)
53 except OSError:
54 return ('Failed to run "%s"; do you have Go installed on your machine?'
55 % ' '.join(cmd))
56 return output
57
58
def gen_tasks_test(train)
Definition: infra_tests.py:47
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ main()

def infra_tests.main ( )

Definition at line 59 of file infra_tests.py.

59def main():
60 train = False
61 if '--train' in sys.argv:
62 train = True
63
64 tests = (
65 python_unit_tests,
66 recipe_test,
67 gen_tasks_test,
68 )
69 errs = []
70 for t in tests:
71 err = t(train)
72 if err:
73 errs.append(err)
74
75 if len(errs) > 0:
76 print('Test failures:\n', file=sys.stderr)
77 for err in errs:
78 print('==============================', file=sys.stderr)
79 print(err, file=sys.stderr)
80 print('==============================', file=sys.stderr)
81 sys.exit(1)
82
83 if train:
84 print('Trained tests successfully.')
85 else:
86 print('All tests passed!')
87
88
def main()
Definition: infra_tests.py:59
def print(*args, **kwargs)
Definition: run_tests.py:49

◆ python_unit_tests()

def infra_tests.python_unit_tests (   train)

Definition at line 28 of file infra_tests.py.

28def python_unit_tests(train):
29 if train:
30 return None
31 return test(
32 [sys.executable, '-u', '-m', 'unittest', 'discover', '-s', '.', '-p',
33 '*_test.py'],
34 INFRA_BOTS_DIR)
35
36
def python_unit_tests(train)
Definition: infra_tests.py:28

◆ recipe_test()

def infra_tests.recipe_test (   train)

Definition at line 37 of file infra_tests.py.

37def recipe_test(train):
38 cmd = [
39 sys.executable, '-u', os.path.join(INFRA_BOTS_DIR, 'recipes.py'), 'test']
40 if train:
41 cmd.append('train')
42 else:
43 cmd.append('run')
44 return test(cmd, SKIA_DIR)
45
46
def recipe_test(train)
Definition: infra_tests.py:37

◆ test()

def infra_tests.test (   cmd,
  cwd 
)

Definition at line 21 of file infra_tests.py.

21def test(cmd, cwd):
22 try:
23 subprocess.check_output(cmd, cwd=cwd, stderr=subprocess.STDOUT, encoding='utf-8')
24 except subprocess.CalledProcessError as e:
25 return e.output
26
27
def test(cmd, cwd)
Definition: infra_tests.py:21

Variable Documentation

◆ INFRA_BOTS_DIR

infra_tests.INFRA_BOTS_DIR = os.path.dirname(os.path.realpath(__file__))

Definition at line 17 of file infra_tests.py.

◆ SKIA_DIR

infra_tests.SKIA_DIR = os.path.abspath(os.path.join(INFRA_BOTS_DIR, os.pardir, os.pardir))

Definition at line 18 of file infra_tests.py.