Ver código fonte

Fix windows: Can't replace an executable that is currently open

default_compile_flags
vector-of-bool 5 anos atrás
pai
commit
9b15738526
3 arquivos alterados com 15 adições e 17 exclusões
  1. +0
    -1
      tests/__init__.py
  2. +3
    -9
      tools/ci.py
  3. +12
    -7
      tools/self_build.py

+ 0
- 1
tests/__init__.py Ver arquivo

@@ -1,6 +1,5 @@
import sys
from pathlib import Path
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

+ 3
- 9
tools/ci.py Ver arquivo

@@ -104,7 +104,8 @@ def main(argv: Sequence[str]) -> int:
('-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():
shutil.rmtree(paths.SELF_TEST_REPO_DIR)
@@ -113,14 +114,7 @@ def main(argv: Sequence[str]) -> int:
self_deps_build(paths.CUR_BUILT_DDS, opts.toolchain_2,
paths.SELF_TEST_REPO_DIR,
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'])


+ 12
- 7
tools/self_build.py Ver arquivo

@@ -6,21 +6,26 @@ import shutil
import subprocess
import sys

from dds_ci import cli
from dds_ci import cli, proc

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
# 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!')
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:

Carregando…
Cancelar
Salvar