| 44 | os.path.join(node_lib_dir, 'node.lib')) |
| 45 | |
| 46 | def node_gyp_rebuild(test_dir): |
| 47 | print('Building addon in', test_dir) |
| 48 | try: |
| 49 | process = subprocess.Popen([ |
| 50 | node_bin, |
| 51 | node_gyp, |
| 52 | 'rebuild', |
| 53 | '--directory', test_dir, |
| 54 | '--nodedir', headers_dir, |
| 55 | '--python', sys.executable, |
| 56 | '--loglevel', args.loglevel, |
| 57 | ], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 58 | |
| 59 | # We buffer the output and print it out once the process is done in order |
| 60 | # to avoid interleaved output from multiple builds running at once. |
| 61 | stdout, stderr = process.communicate() |
| 62 | return_code = process.returncode |
| 63 | if return_code != 0: |
| 64 | print(f'Failed to build addon in {test_dir}:') |
| 65 | if stdout: |
| 66 | print(stdout.decode()) |
| 67 | if stderr: |
| 68 | print(stderr.decode()) |
| 69 | return return_code |
| 70 | |
| 71 | except Exception as e: |
| 72 | print(f'Unexpected error when building addon in {test_dir}. Error: {e}') |
| 73 | |
| 74 | test_dirs = [] |
| 75 | skip_tests = args.skip_tests.split(',') |