Skip to content

Commit c4c0be6

Browse files
committed
Merge remote-tracking branch 'upstream/master' into example/fix-vanilla_http_server-workflow
2 parents d70ca1b + d5895b3 commit c4c0be6

66 files changed

Lines changed: 457 additions & 351 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/windows_ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
.\v.exe symlink
5757
.\v.exe -stats vlib/crypto/ecdsa/ecdsa_test.v
5858
- name: Test v binaries
59-
run: v -silent build-vbinaries
59+
run: v build-vbinaries
6060
- name: All code is formatted
6161
run: v -silent test-cleancode
6262
- name: Test new v.c
@@ -86,7 +86,7 @@ jobs:
8686
- name: Test v->js
8787
run: v -o hi.js examples/js_hello_world.v && node hi.js
8888
- name: Build examples
89-
run: v -silent build-examples
89+
run: v build-examples
9090
- name: v2 self compilation
9191
run: v -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
9292
- name: compile vdoctor.v with -prod
@@ -139,7 +139,7 @@ jobs:
139139
- name: Test v binaries
140140
run: v build-vbinaries
141141
- name: Build examples
142-
run: v -silent build-examples
142+
run: v build-examples
143143
- name: v2 self compilation
144144
run: v -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
145145

@@ -193,7 +193,7 @@ jobs:
193193
- name: Test v binaries
194194
run: v build-vbinaries
195195
- name: Build examples
196-
run: v -silent build-examples
196+
run: v build-examples
197197
- name: v2 self compilation
198198
run: v -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v && .\v3.exe -o v4.exe cmd/v
199199

@@ -233,6 +233,6 @@ jobs:
233233
# - name: Test v binaries
234234
# run: v -silent build-vbinaries
235235
# - name: Build examples
236-
# run: v -silent build-examples
236+
# run: v build-examples
237237
# - name: v2 self compilation
238238
# run: v -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v

cmd/tools/vdoc/document/doc_test.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// import v.ast
1+
// vtest build: tinyc && !musl? && !sanitized_job?
22
import document as doc
33

44
// fn test_generate_with_pos() {}

cmd/tools/vpm/dependency_test.v

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// vtest retry: 3
21
import os
32
import time
43
import rand
@@ -13,13 +12,14 @@ fn testsuite_begin() {
1312
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1413
exit(0)
1514
}
16-
unbuffer_stdout()
17-
os.setenv('VMODULES', test_path, true)
18-
os.setenv('VPM_DEBUG', '', true)
19-
os.setenv('VPM_NO_INCREMENT', '1', true)
15+
dump(test_path)
16+
test_utils.set_test_env(test_path)
17+
os.mkdir_all(test_path) or {}
18+
os.chdir(test_path)!
2019
}
2120

2221
fn testsuite_end() {
22+
dump(os.system('find ${test_path}'))
2323
os.rmdir_all(test_path) or {}
2424
}
2525

@@ -33,7 +33,6 @@ fn get_mod_name(path string) string {
3333

3434
// Case: running `v install` without specifying modules in a V project directory.
3535
fn test_install_dependencies_in_module_dir() {
36-
os.mkdir_all(test_path) or {}
3736
mod := 'my_module'
3837
mod_path := os.join_path(test_path, mod)
3938
os.mkdir(mod_path)!
@@ -56,9 +55,9 @@ fn test_install_dependencies_in_module_dir() {
5655
// Run `v install`
5756
mut res := cmd_ok(@LOCATION, '${v} install --once')
5857
assert res.output.contains('Detected v.mod file inside the project directory. Using it...'), res.output
59-
assert res.output.contains('Installing `markdown`'), res.output
60-
assert res.output.contains('Installing `pcre`'), res.output
61-
assert res.output.contains('Installing `vtray`'), res.output
58+
expect_installing(@LOCATION, res.output, 'markdown')
59+
expect_installing(@LOCATION, res.output, 'pcre')
60+
expect_installing(@LOCATION, res.output, 'vtray')
6261

6362
assert get_mod_name(os.join_path(test_path, 'markdown', 'v.mod')) == 'markdown'
6463
assert get_mod_name(os.join_path(test_path, 'pcre', 'v.mod')) == 'pcre'
@@ -70,8 +69,8 @@ fn test_install_dependencies_in_module_dir() {
7069
fn test_resolve_external_dependencies_during_module_install() {
7170
res := cmd_ok(@LOCATION, '${v} install -v https://github.com/ttytm/emoji-mart-desktop')
7271
assert res.output.contains('Found 2 dependencies'), res.output
73-
assert res.output.contains('Installing `webview`'), res.output
74-
assert res.output.contains('Installing `miniaudio`'), res.output
72+
expect_installing(@LOCATION, res.output, 'webview')
73+
expect_installing(@LOCATION, res.output, 'miniaudio')
7574
// The external dependencies should have been installed to `<vmodules_dir>/<dependency_name>`
7675
assert get_mod_name(os.join_path(test_path, 'webview', 'v.mod')) == 'webview'
7776
assert get_mod_name(os.join_path(test_path, 'miniaudio', 'v.mod')) == 'miniaudio'
@@ -91,3 +90,8 @@ fn test_install_with_recursive_dependencies() {
9190
cmd_ok(@LOCATION, '${v} remove a b c')
9291
cmd_ok(@LOCATION, '${v} install https://gitlab.com/tobealive/a.git')
9392
}
93+
94+
fn expect_installing(location string, output string, what string) {
95+
eprintln('>>> location: ${location}')
96+
assert output.contains('Installing `${what}`') || output.contains('Scanning `${what}`'), output
97+
}

cmd/tools/vpm/install_test.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// vtest build: !musl? && !sanitized_job?
12
// vtest retry: 3
23
module main
34

@@ -15,7 +16,7 @@ fn testsuite_begin() {
1516
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1617
exit(0)
1718
}
18-
unbuffer_stdout()
19+
dump(test_path)
1920
test_utils.set_test_env(test_path)
2021
}
2122

cmd/tools/vpm/install_version_input_test.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// vtest build: !musl? && !sanitized_job?
12
// vtest retry: 3
23
import os
34
import rand
@@ -17,8 +18,8 @@ fn testsuite_begin() {
1718
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1819
exit(0)
1920
}
21+
dump(test_path)
2022
test_utils.set_test_env(test_path)
21-
eprintln('>> test_path: ${test_path}')
2223
// Explicitly disable fail on prompt.
2324
os.setenv('VPM_FAIL_ON_PROMPT', '', true)
2425
os.mkdir_all(test_path) or {}

cmd/tools/vpm/install_version_test.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// vtest build: !musl? && !sanitized_job?
12
// vtest retry: 3
23
module main
34

@@ -13,6 +14,7 @@ fn testsuite_begin() {
1314
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1415
exit(0)
1516
}
17+
dump(test_path)
1618
test_utils.set_test_env(test_path)
1719
}
1820

cmd/tools/vpm/outdated_test.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ fn testsuite_begin() {
1212
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1313
exit(0)
1414
}
15-
unbuffer_stdout()
15+
dump(test_path)
1616
test_utils.set_test_env(test_path)
1717
os.mkdir_all(test_path)!
1818
os.chdir(test_path)!
19-
println('test_path: ${test_path}')
2019
}
2120

2221
fn testsuite_end() {

cmd/tools/vpm/remove_test.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ fn testsuite_begin() {
1111
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1212
exit(0)
1313
}
14+
dump(test_path)
1415
test_utils.set_test_env(test_path)
1516
}
1617

cmd/tools/vpm/test_utils/utils.v

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ import net
55
import time
66

77
pub fn set_test_env(test_path string) {
8+
unbuffer_stdout()
89
os.setenv('VMODULES', test_path, true)
910
os.setenv('VPM_DEBUG', '', true)
1011
os.setenv('VPM_NO_INCREMENT', '1', true)
1112
os.setenv('VPM_FAIL_ON_PROMPT', '1', true)
12-
unbuffer_stdout()
13+
// Note: setting a local VTMP here, is *very important*, because VTMP is used for
14+
// the destination of the temporary clones done by the child `v install` processes.
15+
// If it is not done, then there is a small chance, that multiple parallel tests
16+
// can do clones to the same exact folders at the same time, which can make them
17+
// fail on the CI, with hard to diagnose spurious errors.
18+
os.setenv('VTMP', os.join_path(test_path, 'vtmp'), true)
1319
}
1420

1521
pub fn hg_serve(hg_path string, path string, start_port int) (&os.Process, int) {

cmd/tools/vpm/update_test.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// vtest build: !musl? && !sanitized_job?
12
// vtest retry: 3
23
import os
34
import rand
@@ -11,7 +12,7 @@ fn testsuite_begin() {
1112
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1213
exit(0)
1314
}
14-
unbuffer_stdout()
15+
dump(test_path)
1516
test_utils.set_test_env(test_path)
1617
}
1718

0 commit comments

Comments
 (0)