|
123456789101112131415161718192021222324252627282930313233343536 |
- #!/usr/bin/env python3
- import argparse
- from pathlib import Path
- from typing import List, NamedTuple
- import shutil
- import subprocess
- import sys
-
- from dds_ci import cli
-
- ROOT = Path(__file__).parent.parent.absolute()
-
-
- def self_build(exe: Path, toolchain: str):
- # Copy the exe to another location, as windows refuses to let a binary be
- # replaced while it is executing
- new_exe = ROOT / '_dds.bootstrap-test.exe'
- shutil.copy2(exe, new_exe)
- res = subprocess.run([str(new_exe), 'build', f'-FT{toolchain}'])
- new_exe.unlink()
- if res.returncode != 0:
- raise RuntimeError('The bootstrap test failed!')
- print('Bootstrap test PASSED!')
-
-
- def main(argv: List[str]) -> int:
- parser = argparse.ArgumentParser()
- cli.add_tc_arg(parser)
- cli.add_dds_exe_arg(parser)
- args = parser.parse_args(argv)
- self_build(Path(args.exe), args.toolchain)
- return 0
-
-
- if __name__ == "__main__":
- sys.exit(main(sys.argv[1:]))
|