| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # Self-test for skimage. | 6 # Self-test for skimage. |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 # Run skimage twice, first to create an expectations file, and then | 43 # Run skimage twice, first to create an expectations file, and then |
| 44 # comparing to it. | 44 # comparing to it. |
| 45 | 45 |
| 46 # Both commands will run the binary, reading from resources. | 46 # Both commands will run the binary, reading from resources. |
| 47 cmd_line = [skimage_binary] | 47 cmd_line = [skimage_binary] |
| 48 resources_dir = os.path.join(trunk_dir, 'resources') | 48 resources_dir = os.path.join(trunk_dir, 'resources') |
| 49 cmd_line.extend(["-r", resources_dir]) | 49 cmd_line.extend(["-r", resources_dir]) |
| 50 | 50 |
| 51 # Create the expectations file | 51 # Create the expectations file |
| 52 results_dir = os.path.join(file_dir, "skimage") | 52 results_file = os.path.join(file_dir, "skimage", "self_test_results.json") |
| 53 create_expectations_cmd = cmd_line + ["--createExpectationsPath", | 53 create_expectations_cmd = cmd_line + ["--createExpectationsPath", |
| 54 results_dir] | 54 results_file] |
| 55 subprocess.check_call(create_expectations_cmd) | 55 subprocess.check_call(create_expectations_cmd) |
| 56 | 56 |
| 57 # Now read from the expectations file | 57 # Now read from the expectations file |
| 58 results_file = os.path.join(results_dir, "results.json") | |
| 59 check_expectations_cmd = cmd_line + ["--readExpectationsPath", | 58 check_expectations_cmd = cmd_line + ["--readExpectationsPath", |
| 60 results_file] | 59 results_file] |
| 61 subprocess.check_call(check_expectations_cmd) | 60 subprocess.check_call(check_expectations_cmd) |
| 62 print "Self tests succeeded!" | 61 print "Self tests succeeded!" |
| 63 | 62 |
| 64 if __name__ == "__main__": | 63 if __name__ == "__main__": |
| 65 main() | 64 main() |
| OLD | NEW |