You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
955B

  1. #!/usr/bin/env python3
  2. import argparse
  3. from pathlib import Path
  4. from typing import List, NamedTuple
  5. import shutil
  6. import subprocess
  7. import sys
  8. from dds_ci import cli
  9. ROOT = Path(__file__).parent.parent.absolute()
  10. def self_build(exe: Path, toolchain: str):
  11. # Copy the exe to another location, as windows refuses to let a binary be
  12. # replaced while it is executing
  13. new_exe = ROOT / '_dds.bootstrap-test.exe'
  14. shutil.copy2(exe, new_exe)
  15. res = subprocess.run([str(new_exe), 'build', f'-FT{toolchain}'])
  16. new_exe.unlink()
  17. if res.returncode != 0:
  18. raise RuntimeError('The bootstrap test failed!')
  19. print('Bootstrap test PASSED!')
  20. def main(argv: List[str]) -> int:
  21. parser = argparse.ArgumentParser()
  22. cli.add_tc_arg(parser)
  23. cli.add_dds_exe_arg(parser)
  24. args = parser.parse_args(argv)
  25. self_build(Path(args.exe), args.toolchain)
  26. return 0
  27. if __name__ == "__main__":
  28. sys.exit(main(sys.argv[1:]))