Skip to content

Commit 8dafca1

Browse files
authored
test, ci: fix network tests; update and activate tests in periodic ci (#21339)
1 parent 9d3bef1 commit 8dafca1

File tree

5 files changed

+42
-54
lines changed

5 files changed

+42
-54
lines changed

.github/workflows/periodic_ci.yml

Lines changed: 28 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,40 @@
1-
name: Periodic
1+
name: Periodic CI
22

33
on:
44
schedule:
55
- cron: '0 */6 * * *'
6+
push:
7+
paths:
8+
- '**/periodic_ci.yml'
9+
pull_request:
10+
paths:
11+
- '**/periodic_ci.yml'
612

713
jobs:
8-
network-tests-ubuntu:
9-
runs-on: ubuntu-20.04
10-
if: github.ref == 'refs/heads/master' && github.repository == 'vlang/v'
14+
network:
15+
strategy:
16+
matrix:
17+
include:
18+
- os: ubuntu-latest
19+
cc: tcc
20+
- os: windows-latest
21+
cc: msvc
22+
- os: macos-13
23+
cc: clang
24+
fail-fast: false
25+
runs-on: ${{ matrix.os }}
26+
if: github.event_name != 'schedule' || (github.ref == 'refs/heads/master' && github.repository == 'vlang/v')
1127
timeout-minutes: 30
1228
env:
29+
VFLAGS: -cc ${{ matrix.cc }}
1330
V_CI_PERIODIC: 1
14-
steps:
15-
- uses: actions/checkout@v4
16-
- name: Install dependencies 1
17-
run: .github/workflows/retry.sh sudo apt-get install --quiet -y sqlite3 libsqlite3-dev
18-
- name: Build v
19-
run: make
20-
- name: Symlink V
21-
run: sudo ./v symlink
22-
## - name: Run network tests
23-
## run: ./v -d network test vlib/net
24-
25-
network-tests-macos:
26-
runs-on: macos-14
27-
if: github.ref == 'refs/heads/master' && github.repository == 'vlang/v'
28-
timeout-minutes: 30
29-
env:
30-
V_CI_PERIODIC: 1
31-
steps:
32-
- uses: actions/checkout@v4
33-
- name: Build V
34-
run: make
35-
- name: Symlink V
36-
run: sudo ./v symlink
37-
- name: Ensure thirdparty/cJSON/cJSON.o is compiled, before running tests.
38-
run: ./v examples/json.v
39-
## - name: Run network tests
40-
## run: ./v -d network test vlib/net
41-
42-
network-windows-msvc:
43-
runs-on: windows-2019
44-
if: github.ref == 'refs/heads/master' && github.repository == 'vlang/v'
45-
timeout-minutes: 30
46-
env:
47-
V_CI_PERIODIC: 1
48-
VFLAGS: -cc msvc
4931
steps:
5032
- uses: actions/checkout@v4
5133
- name: Build
52-
run: |
53-
echo %VFLAGS%
54-
echo $VFLAGS
55-
.\make.bat -msvc
56-
## - name: Run network tests
57-
## run: .\v.exe -d network test vlib/net
34+
if: runner.os != 'Windows'
35+
run: make -j4 && ./v -showcc -o v cmd/v && ./v doctor
36+
- name: Build V (Windows)
37+
if: runner.os == 'Windows'
38+
run: ./make.bat -msvc && ./v -o v2.exe cmd/v && ./v2 -showcc -o v.exe cmd/v && ./v doctor
39+
- name: Test
40+
run: ./v -d network test-self vlib/net

cmd/tools/vtest-self.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const skip_test_files = [
108108
'vlib/db/pg/pg_orm_test.v', // pg not installed
109109
'vlib/db/pg/pg_test.v', // pg not installed
110110
'vlib/db/pg/pg_double_test.v', // pg not installed
111+
'vlib/net/ftp/ftp_test.v', // currently broken
111112
]
112113
// These tests are too slow to be run in the CI on each PR/commit
113114
// in the sanitized modes:

vlib/net/http/http_httpbin_test.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// vtest retry: 9
12
module http
23

34
// internal tests have access to *everything in the module*

vlib/net/mbedtls/mbedtls_sslconn_shutdown_does_not_panic_test.v

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import time
32
import context
43
import net.mbedtls
@@ -23,10 +22,6 @@ fn server() ! {
2322
cli.shutdown()!
2423
}
2524

26-
fn read_input() string {
27-
return os.input_opt('Message: ') or { 'Empty' }
28-
}
29-
3025
@[if network ?]
3126
fn test_shutdown_does_not_panic() {
3227
_ := spawn server()
@@ -40,7 +35,15 @@ fn test_shutdown_does_not_panic() {
4035
time.sleep(1 * time.second)
4136
mut background := context.background()
4237
mut ctx, cancel := context.with_timeout(mut background, 2 * time.second)
43-
spawn read_input()
38+
spawn fn () {
39+
mut i := 0
40+
for {
41+
i++
42+
print('\r${i}...')
43+
flush_stdout()
44+
time.sleep(1 * time.second)
45+
}
46+
}()
4447
mut done := ctx.done()
4548
for {
4649
select {
@@ -50,7 +53,7 @@ fn test_shutdown_does_not_panic() {
5053
}
5154
}
5255

53-
eprintln('Timeout without panic - OK')
56+
eprintln('\nTimeout without panic - OK')
5457

5558
assert true
5659
}

vlib/net/unix/use_net_and_net_unix_together_test.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import net
44

55
const use_net = net.no_timeout // ensure that `net` is used, i.e. no warnings
66

7-
const tfolder = os.join_path(os.vtmp_dir(), 'net_and_unix_together')
8-
const test_port = os.join_path(tfolder, 'unix_domain_socket')
7+
const tfolder = os.join_path(os.vtmp_dir(), 'net_unix_test')
8+
const test_port = os.join_path(tfolder, 'domain_socket')
99

1010
fn testsuite_begin() {
1111
os.mkdir_all(tfolder) or {}

0 commit comments

Comments
 (0)