MCPcopy Create free account
hub / github.com/RenderKit/oidn / run_test

Function run_test

scripts/test.py:82–124  ·  view source on GitHub ↗
(cmd, arch='native', retry_if_status=None)

Source from the content-addressed store, hash-verified

80
81# Runs a test command
82def run_test(cmd, arch='native', retry_if_status=None):
83 # Run test through SDE if required
84 if arch != 'native':
85 sde_arch = {'sse4' : 'pnr'}[arch]
86 cmd = f'{sde} -{sde_arch} -- ' + cmd
87
88 # Write command and redirect output to log
89 if cfg.log:
90 run(f'echo >> "{cfg.log}"')
91 run(f'echo "{cmd}" >> "{cfg.log}"')
92 cmd += f' >> "{cfg.log}" 2>&1'
93 else:
94 print(f'Command: {cmd}')
95
96 # Run the command and check the return value
97 status = subprocess.call(cmd, shell=True)
98
99 # Retry if necessary
100 if retry_if_status is not None:
101 retry_count = 1
102 while status != 0 and retry_if_status(status) and retry_count <= 2:
103 if cfg.log:
104 run(f'echo "Retrying ({retry_count})..." >> "{cfg.log}"')
105 status = subprocess.call(cmd, shell=True)
106 retry_count += 1
107
108 if status == 0:
109 if cfg.log:
110 print(' PASSED')
111 else:
112 print('PASSED\n')
113 else:
114 if cfg.log:
115 print(' FAILED')
116 else:
117 print('FAILED\n')
118 if cfg.log:
119 print(f'Error: test failed, see "{cfg.log}" for details:')
120 with open(cfg.log, 'r') as f:
121 print(f.read())
122 else:
123 print('Error: test failed')
124 exit(1)
125
126# Runs main tests
127def test():

Callers 2

testFunction · 0.85
test_regressionFunction · 0.85

Calls 4

runFunction · 0.85
printFunction · 0.85
callMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected