import sys | import sys | ||||
from pathlib import Path | from pathlib import Path | ||||
sys.path.append(str(Path(__file__).absolute().parent.parent / 'tools')) | sys.path.append(str(Path(__file__).absolute().parent.parent / 'tools')) | ||||
print(sys.path) | |||||
from .dds import DDS, DDSFixtureParams, scoped_dds, dds_fixture_conf, dds_fixture_conf_1 | from .dds import DDS, DDSFixtureParams, scoped_dds, dds_fixture_conf, dds_fixture_conf_1 |
('-T', opts.toolchain), | ('-T', opts.toolchain), | ||||
) | ) | ||||
self_build(paths.CUR_BUILT_DDS, opts.toolchain) | |||||
self_build(paths.CUR_BUILT_DDS, toolchain=opts.toolchain) | |||||
print('Bootstrap test PASSED!') | |||||
if paths.SELF_TEST_REPO_DIR.exists(): | if paths.SELF_TEST_REPO_DIR.exists(): | ||||
shutil.rmtree(paths.SELF_TEST_REPO_DIR) | shutil.rmtree(paths.SELF_TEST_REPO_DIR) | ||||
self_deps_build(paths.CUR_BUILT_DDS, opts.toolchain_2, | self_deps_build(paths.CUR_BUILT_DDS, opts.toolchain_2, | ||||
paths.SELF_TEST_REPO_DIR, | paths.SELF_TEST_REPO_DIR, | ||||
paths.PROJECT_ROOT / 'remote.dds') | paths.PROJECT_ROOT / 'remote.dds') | ||||
proc.check_run( | |||||
paths.CUR_BUILT_DDS, | |||||
'build', | |||||
'--full', | |||||
'-T', | |||||
opts.toolchain_2, | |||||
('--lm-index', paths.BUILD_DIR / 'INDEX.lmi'), | |||||
) | |||||
self_build(paths.CUR_BUILT_DDS, toolchain=opts.toolchain, lmi_path=paths.BUILD_DIR / 'INDEX.lmi') | |||||
return pytest.main(['-v', '--durations=10', '-n4']) | return pytest.main(['-v', '--durations=10', '-n4']) | ||||
import subprocess | import subprocess | ||||
import sys | import sys | ||||
from dds_ci import cli | |||||
from dds_ci import cli, proc | |||||
ROOT = Path(__file__).parent.parent.absolute() | ROOT = Path(__file__).parent.parent.absolute() | ||||
def self_build(exe: Path, toolchain: str): | |||||
def self_build(exe: Path, *, toolchain: str, lmi_path: Path = None): | |||||
# Copy the exe to another location, as windows refuses to let a binary be | # Copy the exe to another location, as windows refuses to let a binary be | ||||
# replaced while it is executing | # replaced while it is executing | ||||
new_exe = ROOT / '_dds.bootstrap-test.exe' | new_exe = ROOT / '_dds.bootstrap-test.exe' | ||||
shutil.copy2(exe, new_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!') | |||||
try: | |||||
proc.check_run( | |||||
new_exe, | |||||
'build', | |||||
'--full', | |||||
('--toolchain', toolchain), | |||||
('-I', lmi_path) if lmi_path else (), | |||||
) | |||||
finally: | |||||
new_exe.unlink() | |||||
def main(argv: List[str]) -> int: | def main(argv: List[str]) -> int: |