tests: test 'update --submodule-init-config'

Add test cases for this option, making sure not to use it in every
situation where we run west update with submodules to maintain
coverage for the case where it's not given.

Note that this is actually a work around for the test suite failing
using recent versions of git as well.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2023-01-04 10:27:12 -08:00 committed by Marti Bolivar
parent 9ba92b0545
commit 9d5b58c8f5
1 changed files with 8 additions and 5 deletions

View File

@ -60,6 +60,9 @@ SUBMODULE_ADD = [GIT,
'submodule', 'submodule',
'add'] 'add']
# Helper string for the same purpose when running west update.
PROTOCOL_FILE_ALLOW = '--submodule-init-config protocol.file.allow=always'
# #
# Test fixtures # Test fixtures
# #
@ -645,7 +648,7 @@ def test_update_submodules_list(repos_tmpdir):
assert not net_tools_project.is_cloned() assert not net_tools_project.is_cloned()
# Update only zephyr project. # Update only zephyr project.
cmd('update zephyr', cwd=ws) cmd(f'update {PROTOCOL_FILE_ALLOW} zephyr', cwd=ws)
# Verify if only zephyr project was cloned. # Verify if only zephyr project was cloned.
assert zephyr_project.is_cloned() assert zephyr_project.is_cloned()
@ -658,7 +661,7 @@ def test_update_submodules_list(repos_tmpdir):
assert not (res.returncode or res.stdout.strip()) assert not (res.returncode or res.stdout.strip())
# Update all projects # Update all projects
cmd('update', cwd=ws) cmd(f'update {PROTOCOL_FILE_ALLOW}', cwd=ws)
# Verify if both projects were cloned # Verify if both projects were cloned
assert zephyr_project.is_cloned() assert zephyr_project.is_cloned()
@ -739,7 +742,7 @@ def test_update_all_submodules(repos_tmpdir):
assert not zephyr_project.is_cloned() assert not zephyr_project.is_cloned()
# Update zephyr project. # Update zephyr project.
cmd('update zephyr', cwd=ws) cmd(f'update {PROTOCOL_FILE_ALLOW} zephyr', cwd=ws)
# Verify if zephyr project was cloned. # Verify if zephyr project was cloned.
assert zephyr_project.is_cloned() assert zephyr_project.is_cloned()
@ -903,7 +906,7 @@ def test_update_submodules_strategy(repos_tmpdir):
assert not net_tools_project.is_cloned() assert not net_tools_project.is_cloned()
# Update only zephyr project using checkout strategy (selected by default). # Update only zephyr project using checkout strategy (selected by default).
cmd('update zephyr', cwd=ws) cmd(f'update {PROTOCOL_FILE_ALLOW} zephyr', cwd=ws)
# Verify if only zephyr project was cloned. # Verify if only zephyr project was cloned.
assert zephyr_project.is_cloned() assert zephyr_project.is_cloned()
@ -916,7 +919,7 @@ def test_update_submodules_strategy(repos_tmpdir):
assert not (res.returncode or res.stdout.strip()) assert not (res.returncode or res.stdout.strip())
# Update only net-tools project using rebase strategy # Update only net-tools project using rebase strategy
cmd('update net-tools -r', cwd=ws) cmd(f'update {PROTOCOL_FILE_ALLOW} net-tools -r', cwd=ws)
# Verify if both projects were cloned # Verify if both projects were cloned
assert zephyr_project.is_cloned() assert zephyr_project.is_cloned()