()
| 125 | |
| 126 | # Runs main tests |
| 127 | def test(): |
| 128 | if cfg.command == 'run': |
| 129 | print_test('oidnTest') |
| 130 | test_cmd = os.path.join(bin_dir, 'oidnTest') |
| 131 | if cfg.device != 'default': |
| 132 | test_cmd += f' --device {cfg.device}' |
| 133 | run_test(test_cmd, cfg.arch) |
| 134 | |
| 135 | if cfg.memcheck and cfg.arch == 'native': |
| 136 | # Memcheck |
| 137 | if OS == 'linux': |
| 138 | if cfg.device == 'cuda': |
| 139 | print_test('oidnTest.compute-sanitizer') |
| 140 | supp_filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'csan.supp.xml') |
| 141 | test_csan_cmd = f'compute-sanitizer --tool memcheck --leak-check=full --error-exitcode=1 --suppressions={supp_filename} {test_cmd}' |
| 142 | run_test(test_csan_cmd) |
| 143 | |
| 144 | print_test('oidnTest.valgrind') |
| 145 | supp_filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'valgrind.supp') |
| 146 | test_cmd += ' "[minimal]"' # too slow otherwise |
| 147 | test_cmd = f'valgrind --leak-check=full -s --error-exitcode=1 --suppressions={supp_filename} --gen-suppressions=all {test_cmd}' |
| 148 | run_test(test_cmd) |
| 149 | elif OS == 'macos': |
| 150 | print_test('oidnTest.leaks') |
| 151 | test_cmd = f'leaks --atExit -- {test_cmd}' |
| 152 | run_test(test_cmd, retry_if_status=lambda status: status > 1) # FIXME: "leaks" randomly fails |
| 153 | |
| 154 | if not cfg.minimal: |
| 155 | # Benchmark |
| 156 | print_test('oidnBenchmark') |
| 157 | test_cmd = os.path.join(bin_dir, 'oidnBenchmark -v 1') |
| 158 | if cfg.device != 'default': |
| 159 | test_cmd += f' --device {cfg.device}' |
| 160 | run_test(test_cmd, cfg.arch) |
| 161 | |
| 162 | # Gets the option name of a feature |
| 163 | def get_feature_opt(feature): |
no test coverage detected