Browse Source

Rename from some old names, and increase timeout on cryptopp build

default_compile_flags
vector-of-bool 3 years ago
parent
commit
bba5c46a5d
6 changed files with 35 additions and 31 deletions
  1. +1
    -1
      tests/test_build_deps.py
  2. +2
    -2
      tests/test_pkg.py
  3. +7
    -7
      tests/test_pkg_db.py
  4. +1
    -1
      tests/use-cryptopp/test_use_cryptopp.py
  5. +17
    -17
      tools/dds_ci/dds.py
  6. +7
    -3
      tools/dds_ci/testing/fixtures.py

+ 1
- 1
tests/test_build_deps.py View File

proj.dds.run( proj.dds.run(
[ [
'build-deps', 'build-deps',
proj.dds.repo_dir_arg,
proj.dds.cache_dir_arg,
'foo@1.2.3', 'foo@1.2.3',
('-t', ':gcc' if 'gcc' in toolchain.get_default_toolchain().name else ':msvc'), ('-t', ':gcc' if 'gcc' in toolchain.get_default_toolchain().name else ':msvc'),
f'--cmake=libraries.cmake', f'--cmake=libraries.cmake',

+ 2
- 2
tests/test_pkg.py View File

pipe = subprocess.Popen( pipe = subprocess.Popen(
list(proc.flatten_cmd([ list(proc.flatten_cmd([
project.dds.path, project.dds.path,
project.dds.repo_dir_arg,
project.dds.cache_dir_arg,
'pkg', 'pkg',
'import', 'import',
'--stdin', '--stdin',




def test_import_sdist_dir(test_project: Project) -> None: def test_import_sdist_dir(test_project: Project) -> None:
test_project.dds.run(['pkg', 'import', test_project.dds.repo_dir_arg, test_project.root])
test_project.dds.run(['pkg', 'import', test_project.dds.cache_dir_arg, test_project.root])
_check_import(test_project.dds.repo_dir / 'foo@1.2.3') _check_import(test_project.dds.repo_dir / 'foo@1.2.3')





+ 7
- 7
tests/test_pkg_db.py View File

def test_pkg_repo(_test_repo: RepoServer, tmp_project: Project) -> None: def test_pkg_repo(_test_repo: RepoServer, tmp_project: Project) -> None:
dds = tmp_project.dds dds = tmp_project.dds
dds.repo_add(_test_repo.url) dds.repo_add(_test_repo.url)
dds.run(['pkg', 'repo', dds.catalog_path_arg, 'ls'])
dds.run(['pkg', 'repo', dds.pkg_db_path_arg, 'ls'])




def test_pkg_repo_rm(_test_repo: RepoServer, tmp_project: Project) -> None: def test_pkg_repo_rm(_test_repo: RepoServer, tmp_project: Project) -> None:
# Okay: # Okay:
tmp_project.dds.pkg_get('neo-sqlite3@0.3.0') tmp_project.dds.pkg_get('neo-sqlite3@0.3.0')
# Remove the repo: # Remove the repo:
dds.run(['pkg', dds.catalog_path_arg, 'repo', 'ls'])
dds.run(['pkg', dds.pkg_db_path_arg, 'repo', 'ls'])
dds.repo_remove(_test_repo.repo_name) dds.repo_remove(_test_repo.repo_name)
# Cannot double-remove a repo: # Cannot double-remove a repo:
with expect_error_marker('repo-rm-no-such-repo'): with expect_error_marker('repo-rm-no-such-repo'):
_test_repo.import_json_data(NEO_SQLITE_PKG_JSON) _test_repo.import_json_data(NEO_SQLITE_PKG_JSON)
dds = tmp_project.dds dds = tmp_project.dds
with expect_error_marker('pkg-search-no-result'): with expect_error_marker('pkg-search-no-result'):
dds.run(['pkg', dds.catalog_path_arg, 'search'])
dds.run(['pkg', dds.pkg_db_path_arg, 'search'])
dds.repo_add(_test_repo.url) dds.repo_add(_test_repo.url)
dds.run(['pkg', dds.catalog_path_arg, 'search'])
dds.run(['pkg', dds.catalog_path_arg, 'search', 'neo-sqlite3'])
dds.run(['pkg', dds.catalog_path_arg, 'search', 'neo-*'])
dds.run(['pkg', dds.pkg_db_path_arg, 'search'])
dds.run(['pkg', dds.pkg_db_path_arg, 'search', 'neo-sqlite3'])
dds.run(['pkg', dds.pkg_db_path_arg, 'search', 'neo-*'])
with expect_error_marker('pkg-search-no-result'): with expect_error_marker('pkg-search-no-result'):
dds.run(['pkg', dds.catalog_path_arg, 'search', 'nonexistent'])
dds.run(['pkg', dds.pkg_db_path_arg, 'search', 'nonexistent'])

+ 1
- 1
tests/use-cryptopp/test_use_cryptopp.py View File

} }
tc_fname = 'gcc.tc.jsonc' if 'gcc' in toolchain.get_default_test_toolchain().name else 'msvc.tc.jsonc' tc_fname = 'gcc.tc.jsonc' if 'gcc' in toolchain.get_default_test_toolchain().name else 'msvc.tc.jsonc'
tmp_project.write('src/use-cryptopp.main.cpp', APP_CPP) tmp_project.write('src/use-cryptopp.main.cpp', APP_CPP)
tmp_project.build(toolchain=test_parent_dir / tc_fname)
tmp_project.build(toolchain=test_parent_dir / tc_fname, timeout = 60*10)
proc.check_run([(tmp_project.build_root / 'use-cryptopp').with_suffix(paths.EXE_SUFFIX)]) proc.check_run([(tmp_project.build_root / 'use-cryptopp').with_suffix(paths.EXE_SUFFIX)])

+ 17
- 17
tools/dds_ci/dds.py View File

return copy.deepcopy(self) return copy.deepcopy(self)


@property @property
def catalog_path_arg(self) -> str:
def pkg_db_path_arg(self) -> str:
"""The arguments for --catalog""" """The arguments for --catalog"""
return f'--catalog={self.pkg_db_path}' return f'--catalog={self.pkg_db_path}'


@property @property
def repo_dir_arg(self) -> str:
def cache_dir_arg(self) -> str:
"""The arguments for --repo-dir""" """The arguments for --repo-dir"""
return f'--repo-dir={self.repo_dir}' return f'--repo-dir={self.repo_dir}'




def catalog_json_import(self, path: Path) -> None: def catalog_json_import(self, path: Path) -> None:
"""Run 'catalog import' to import the given JSON. Only applicable to older 'dds'""" """Run 'catalog import' to import the given JSON. Only applicable to older 'dds'"""
self.run(['catalog', 'import', self.catalog_path_arg, f'--json={path}'])
self.run(['catalog', 'import', self.pkg_db_path_arg, f'--json={path}'])


def catalog_get(self, what: str) -> None: def catalog_get(self, what: str) -> None:
self.run(['catalog', 'get', self.catalog_path_arg, what])
self.run(['catalog', 'get', self.pkg_db_path_arg, what])


def pkg_get(self, what: str) -> None: def pkg_get(self, what: str) -> None:
self.run(['pkg', 'get', self.catalog_path_arg, what])
self.run(['pkg', 'get', self.pkg_db_path_arg, what])


def repo_add(self, url: str) -> None: def repo_add(self, url: str) -> None:
self.run(['pkg', 'repo', 'add', self.catalog_path_arg, url])
self.run(['pkg', 'repo', 'add', self.pkg_db_path_arg, url])


def repo_remove(self, name: str) -> None: def repo_remove(self, name: str) -> None:
self.run(['pkg', 'repo', 'remove', self.catalog_path_arg, name])
self.run(['pkg', 'repo', 'remove', self.pkg_db_path_arg, name])


def repo_import(self, sdist: Path) -> None: def repo_import(self, sdist: Path) -> None:
self.run(['repo', self.repo_dir_arg, 'import', sdist])
self.run(['repo', self.cache_dir_arg, 'import', sdist])


def pkg_import(self, filepath: Pathish) -> None: def pkg_import(self, filepath: Pathish) -> None:
self.run(['pkg', 'import', filepath, self.repo_dir_arg])
self.run(['pkg', 'import', filepath, self.cache_dir_arg])


def build(self, def build(self,
*, *,
[ [
'build', 'build',
f'--toolchain={toolchain}', f'--toolchain={toolchain}',
self.repo_dir_arg,
self.catalog_path_arg,
self.cache_dir_arg,
self.pkg_db_path_arg,
f'--jobs={jobs}', f'--jobs={jobs}',
f'{self.project_dir_flag}={root}', f'{self.project_dir_flag}={root}',
f'--out={build_root}', f'--out={build_root}',
toolchain = toolchain or tc_mod.get_default_audit_toolchain() toolchain = toolchain or tc_mod.get_default_audit_toolchain()
self.run([ self.run([
'compile-file', 'compile-file',
self.catalog_path_arg,
self.repo_dir_arg,
self.pkg_db_path_arg,
self.cache_dir_arg,
paths, paths,
f'--toolchain={toolchain}', f'--toolchain={toolchain}',
f'{self.project_dir_flag}={project_dir}', f'{self.project_dir_flag}={project_dir}',
self.run([ self.run([
'build-deps', 'build-deps',
f'--toolchain={toolchain}', f'--toolchain={toolchain}',
self.catalog_path_arg,
self.repo_dir_arg,
self.pkg_db_path_arg,
self.cache_dir_arg,
args, args,
]) ])


Wraps the new 'dds' executable with some convenience APIs Wraps the new 'dds' executable with some convenience APIs
""" """
@property @property
def repo_dir_arg(self) -> str:
def cache_dir_arg(self) -> str:
return f'--pkg-cache-dir={self.repo_dir}' return f'--pkg-cache-dir={self.repo_dir}'


@property @property
def catalog_path_arg(self) -> str:
def pkg_db_path_arg(self) -> str:
return f'--pkg-db-path={self.pkg_db_path}' return f'--pkg-db-path={self.pkg_db_path}'


@property @property

+ 7
- 3
tools/dds_ci/testing/fixtures.py View File

"""Argument for --project""" """Argument for --project"""
return f'--project={self.root}' return f'--project={self.root}'


def build(self, *, toolchain: Optional[Pathish] = None) -> None:
def build(self, *, toolchain: Optional[Pathish] = None, timeout: Optional[int] = None) -> None:
""" """
Execute 'dds build' on the project Execute 'dds build' on the project
""" """
with tc_mod.fixup_toolchain(toolchain or tc_mod.get_default_test_toolchain()) as tc: with tc_mod.fixup_toolchain(toolchain or tc_mod.get_default_test_toolchain()) as tc:
self.dds.build(root=self.root, build_root=self.build_root, toolchain=tc, more_args=['-ldebug'])
self.dds.build(root=self.root,
build_root=self.build_root,
toolchain=tc,
timeout=timeout,
more_args=['-ldebug'])


def compile_file(self, *paths: Pathish, toolchain: Optional[Pathish] = None) -> None: def compile_file(self, *paths: Pathish, toolchain: Optional[Pathish] = None) -> None:
with tc_mod.fixup_toolchain(toolchain or tc_mod.get_default_test_toolchain()) as tc: with tc_mod.fixup_toolchain(toolchain or tc_mod.get_default_test_toolchain()) as tc:
], cwd=self.build_root) ], cwd=self.build_root)


def sdist_export(self) -> None: def sdist_export(self) -> None:
self.dds.run(['sdist', 'export', self.dds.repo_dir_arg, self.project_dir_arg])
self.dds.run(['sdist', 'export', self.dds.cache_dir_arg, self.project_dir_arg])


def write(self, path: Pathish, content: str) -> Path: def write(self, path: Pathish, content: str) -> Path:
path = Path(path) path = Path(path)

Loading…
Cancel
Save