Pārlūkot izejas kodu

Fix up all tests to work with the catalog

default_compile_flags
vector-of-bool pirms 5 gadiem
vecāks
revīzija
f9b4d5f85c
15 mainītis faili ar 85 papildinājumiem un 24 dzēšanām
  1. +2
    -2
      tests/basics/test_app_only.py
  2. +2
    -2
      tests/catalog/create_test.py
  3. +3
    -4
      tests/catalog/get_test.py
  4. +2
    -3
      tests/catalog/import_test.py
  5. +16
    -9
      tests/dds.py
  6. +2
    -0
      tests/deps/do_test.py
  7. +24
    -0
      tests/deps/git-remote/catalog.json
  8. +0
    -2
      tests/deps/git-remote/remote.dds
  9. +4
    -0
      tests/deps/no-deps/catalog.json
  10. +0
    -0
      tests/deps/no-deps/remote.dds
  11. +14
    -0
      tests/deps/use-remote/catalog.json
  12. +0
    -1
      tests/deps/use-remote/remote.dds
  13. +15
    -0
      tests/deps/use-spdlog/project/catalog.json
  14. +0
    -1
      tests/deps/use-spdlog/project/remote.dds
  15. +1
    -0
      tests/deps/use-spdlog/use_spdlog_test.py

+ 2
- 2
tests/basics/test_app_only.py Parādīt failu

@@ -3,8 +3,8 @@ from tests import DDS
from tests.fileutil import set_contents


def test_lib_with_just_app(dds: DDS, scope: ExitStack):
scope.enter_context(
def test_lib_with_just_app(dds: DDS):
dds.scope.enter_context(
set_contents(
dds.source_root / 'src/foo.main.cpp',
b'int main() {}',

+ 2
- 2
tests/catalog/create_test.py Parādīt failu

@@ -4,5 +4,5 @@ from tests.fileutil import ensure_dir

def test_create_catalog(dds: DDS):
dds.scope.enter_context(ensure_dir(dds.build_dir))
dds.catalog_create(dds.build_dir / 'cat.db')
assert (dds.build_dir / 'cat.db').is_file()
dds.catalog_create()
assert dds.catalog_path.is_file()

+ 3
- 4
tests/catalog/get_test.py Parādīt failu

@@ -6,8 +6,7 @@ from tests.fileutil import ensure_dir

def test_get(dds: DDS):
dds.scope.enter_context(ensure_dir(dds.build_dir))
cat_path = dds.build_dir / 'catalog.db'
dds.catalog_create(cat_path)
dds.catalog_create()

json_path = dds.build_dir / 'catalog.json'
import_data = {
@@ -28,8 +27,8 @@ def test_get(dds: DDS):
dds.set_contents(json_path,
json.dumps(import_data).encode()))

dds.catalog_import(cat_path, json_path)
dds.catalog_import(json_path)

dds.catalog_get(cat_path, 'neo-sqlite3@0.2.2')
dds.catalog_get('neo-sqlite3@0.2.2')
assert (dds.source_root / 'neo-sqlite3@0.2.2').is_dir()
assert (dds.source_root / 'neo-sqlite3@0.2.2/package.dds').is_file()

+ 2
- 3
tests/catalog/import_test.py Parādīt failu

@@ -6,8 +6,7 @@ from tests.fileutil import ensure_dir

def test_import_json(dds: DDS):
dds.scope.enter_context(ensure_dir(dds.build_dir))
cat_path = dds.build_dir / 'catalog.db'
dds.catalog_create(cat_path)
dds.catalog_create()

json_fpath = dds.build_dir / 'data.json'
import_data = {
@@ -27,4 +26,4 @@ def test_import_json(dds: DDS):
dds.scope.enter_context(
dds.set_contents(json_fpath,
json.dumps(import_data).encode()))
dds.catalog_import(cat_path, json_fpath)
dds.catalog_import(json_fpath)

+ 16
- 9
tests/dds.py Parādīt failu

@@ -27,6 +27,10 @@ class DDS:
def repo_dir(self) -> Path:
return self.scratch_dir / 'repo'

@property
def catalog_path(self) -> Path:
return self.scratch_dir / 'catalog.db'

@property
def deps_build_dir(self) -> Path:
return self.scratch_dir / 'deps-build'
@@ -72,6 +76,7 @@ class DDS:
return self.run([
'deps',
'get',
f'--catalog={self.catalog_path}',
self.repo_dir_arg,
])

@@ -143,24 +148,26 @@ class DDS:
f'We don\'t know the executable suffix for the platform "{os.name}"'
)

def catalog_create(self, path: Path) -> subprocess.CompletedProcess:
return self.run(['catalog', 'create', f'--catalog={path}'],
cwd=self.test_dir)
def catalog_create(self) -> subprocess.CompletedProcess:
self.scratch_dir.mkdir(parents=True, exist_ok=True)
return self.run(
['catalog', 'create', f'--catalog={self.catalog_path}'],
cwd=self.test_dir)

def catalog_import(self, path: Path,
json_path: Path) -> subprocess.CompletedProcess:
def catalog_import(self, json_path: Path) -> subprocess.CompletedProcess:
self.scratch_dir.mkdir(parents=True, exist_ok=True)
return self.run([
'catalog',
'import',
f'--catalog={path}',
json_path,
f'--catalog={self.catalog_path}',
f'--json={json_path}',
])

def catalog_get(self, path: Path, req: str) -> subprocess.CompletedProcess:
def catalog_get(self, req: str) -> subprocess.CompletedProcess:
return self.run([
'catalog',
'get',
f'--catalog={path}',
f'--catalog={self.catalog_path}',
req,
])


+ 2
- 0
tests/deps/do_test.py Parādīt failu

@@ -16,6 +16,7 @@ def test_ls(dds: DDS):

@dds_conf
def test_deps_build(dds: DDS):
dds.catalog_import(dds.source_root / 'catalog.json')
assert not dds.repo_dir.exists()
dds.deps_get()
assert dds.repo_dir.exists(), '`deps get` did not generate a repo directory'
@@ -27,6 +28,7 @@ def test_deps_build(dds: DDS):

@dds_fixture_conf_1('use-remote')
def test_use_nlohmann_json_remote(dds: DDS):
dds.catalog_import(dds.source_root / 'catalog.json')
dds.deps_get()
dds.deps_build()
dds.build(apps=True)

+ 24
- 0
tests/deps/git-remote/catalog.json Parādīt failu

@@ -0,0 +1,24 @@
{
"version": 1,
"packages": {
"neo-buffer": {
"0.1.0": {
"git": {
"url": "https://github.com/vector-of-bool/neo-buffer.git",
"ref": "develop"
},
"depends": {}
}
},
"range-v3": {
"0.9.1": {
"git": {
"url": "https://github.com/ericniebler/range-v3.git",
"ref": "0.9.1",
"auto-lib": "Niebler/range-v3"
},
"depends": {}
}
}
}
}

+ 0
- 2
tests/deps/git-remote/remote.dds Parādīt failu

@@ -1,2 +0,0 @@
Remote-Package: neo-buffer@0.1.0; git url=https://github.com/vector-of-bool/neo-buffer.git ref=develop
Remote-Package: range-v3@0.9.1; git url=https://github.com/ericniebler/range-v3.git ref=0.9.1 auto=Niebler/range-v3

+ 4
- 0
tests/deps/no-deps/catalog.json Parādīt failu

@@ -0,0 +1,4 @@
{
"version": 1,
"packages": {}
}

+ 0
- 0
tests/deps/no-deps/remote.dds Parādīt failu


+ 14
- 0
tests/deps/use-remote/catalog.json Parādīt failu

@@ -0,0 +1,14 @@
{
"version": 1,
"packages": {
"nlohmann-json": {
"3.7.1": {
"git": {
"url": "https://github.com/vector-of-bool/json.git",
"ref": "dds/3.7.1"
},
"depends": {}
}
}
}
}

+ 0
- 1
tests/deps/use-remote/remote.dds Parādīt failu

@@ -1 +0,0 @@
Remote-Package: nlohmann-json@3.7.1; git url=https://github.com/vector-of-bool/json.git ref=dds/3.7.1

+ 15
- 0
tests/deps/use-spdlog/project/catalog.json Parādīt failu

@@ -0,0 +1,15 @@
{
"version": 1,
"packages": {
"spdlog": {
"1.4.2": {
"git": {
"url": "https://github.com/gabime/spdlog.git",
"ref": "v1.4.2",
"auto-lib": "spdlog/spdlog"
},
"depends": {}
}
}
}
}

+ 0
- 1
tests/deps/use-spdlog/project/remote.dds Parādīt failu

@@ -1 +0,0 @@
Remote-Package: spdlog@1.4.2; git url=https://github.com/gabime/spdlog.git ref=v1.4.2 auto=spdlog/spdlog

+ 1
- 0
tests/deps/use-spdlog/use_spdlog_test.py Parādīt failu

@@ -4,6 +4,7 @@ from dds_ci import proc


def test_get_build_use_spdlog(dds: DDS):
dds.catalog_import(dds.source_root / 'catalog.json')
dds.deps_get()
tc_fname = 'gcc.tc.dds' if 'gcc' in dds.default_builtin_toolchain else 'msvc.tc.dds'
tc = str(dds.test_dir / tc_fname)

Notiek ielāde…
Atcelt
Saglabāt