diff --git a/cmd/tools/vpm/install_test.v b/cmd/tools/vpm/install_test.v index ba9e39a618..efee4e25f8 100644 --- a/cmd/tools/vpm/install_test.v +++ b/cmd/tools/vpm/install_test.v @@ -183,7 +183,7 @@ fn test_install_from_hg_url() ! { os.write_file(os.join_path(test_module_path, '.hg/hgrc'), '[ui]\nusername = v_ci \nverbose = False\n')! println('> writing .hg/hgrc done.') - mut p, mut port := test_utils.hg_serve(hg_path, test_module_path) + mut p, mut port := test_utils.hg_serve(hg_path, test_module_path, 2000) // Trying to install it should fail. res = os.execute('${vexe} install --hg http://127.0.0.1:${port}') p.signal_kill() @@ -198,7 +198,7 @@ fn test_install_from_hg_url() ! { os.chdir(test_module_path)! cmd_ok(@LOCATION, 'hg add') cmd_ok(@LOCATION, 'hg commit -m "add v.mod"') - p, port = test_utils.hg_serve(hg_path, test_module_path) + p, port = test_utils.hg_serve(hg_path, test_module_path, 3000) // Trying to install the module should work now. res = cmd_ok(@LOCATION, '${vexe} install --hg http://127.0.0.1:${port}') p.signal_kill() diff --git a/cmd/tools/vpm/install_version_test.v b/cmd/tools/vpm/install_version_test.v index 9841426e0c..99532f0d18 100644 --- a/cmd/tools/vpm/install_version_test.v +++ b/cmd/tools/vpm/install_version_test.v @@ -148,7 +148,7 @@ fn test_install_from_hg_url_with_version_tag() ! { cmd_ok(@LOCATION, 'hg add') cmd_ok(@LOCATION, 'hg commit -m "bump version to v0.2.0"') - mut p, port := test_utils.hg_serve(hg_path, test_module_path) + mut p, port := test_utils.hg_serve(hg_path, test_module_path, 4000) res = os.execute('${vexe} install -v --hg http://127.0.0.1:${port}@v0.1.0') p.signal_kill() if res.exit_code != 0 { diff --git a/cmd/tools/vpm/test_utils/utils.v b/cmd/tools/vpm/test_utils/utils.v index 5f515c9c87..1c70d8b836 100644 --- a/cmd/tools/vpm/test_utils/utils.v +++ b/cmd/tools/vpm/test_utils/utils.v @@ -12,8 +12,8 @@ pub fn set_test_env(test_path string) { unbuffer_stdout() } -pub fn hg_serve(hg_path string, path string) (&os.Process, int) { - mut port := 8000 +pub fn hg_serve(hg_path string, path string, start_port int) (&os.Process, int) { + mut port := start_port for { if mut l := net.listen_tcp(.ip6, ':${port}') { l.close() or { panic(err) }