Test argument retrieval using a fake v8 file system and build dir.
(self)
| 409 | class ArgsTest(unittest.TestCase): |
| 410 | |
| 411 | def testArgs(self): |
| 412 | """Test argument retrieval using a fake v8 file system and build dir.""" |
| 413 | with tempfile.TemporaryDirectory('gcmole_args_test') as temp_dir: |
| 414 | temp_dir = Path(temp_dir) |
| 415 | temp_out = temp_dir / 'out' |
| 416 | temp_gcmole = temp_dir / 'tools' / 'gcmole' / 'gcmole_args.py' |
| 417 | |
| 418 | shutil.copytree(abs_test_file('out'), temp_out) |
| 419 | os.makedirs(temp_gcmole.parent) |
| 420 | shutil.copy(GCMOLE_PATH / 'gcmole_args.py', temp_gcmole) |
| 421 | |
| 422 | # Simulate a ninja call relative to the build dir. |
| 423 | gn_sysroot = '//build/linux/debian_bullseye_amd64-sysroot' |
| 424 | subprocess.check_call( |
| 425 | [sys.executable, temp_gcmole, gn_sysroot], cwd=temp_out) |
| 426 | |
| 427 | with open(temp_dir / 'out' / 'v8_gcmole.args') as f: |
| 428 | self.assertEqual(f.read().split(), [ |
| 429 | '-DUSE_GLIB=1', |
| 430 | '-DV8_TARGET_ARCH_X64', |
| 431 | '-I.', |
| 432 | '-Iout/gen', |
| 433 | '-Iinclude', |
| 434 | '-Iout/gen/include', |
| 435 | '-isystem../buildtools/third_party/libc++/trunk/include', |
| 436 | '--sysroot=build/linux/debian_bullseye_amd64-sysroot', |
| 437 | ]) |
| 438 | |
| 439 | |
| 440 | if __name__ == '__main__': |
nothing calls this directly
no test coverage detected