Skip to content

Commit

Permalink
test, ci: fix network tests; update and activate tests in periodic ci (
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Apr 24, 2024
1 parent 9d3bef1 commit 8dafca1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 54 deletions.
73 changes: 28 additions & 45 deletions .github/workflows/periodic_ci.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,40 @@
name: Periodic
name: Periodic CI

on:
schedule:
- cron: '0 */6 * * *'
push:
paths:
- '**/periodic_ci.yml'
pull_request:
paths:
- '**/periodic_ci.yml'

jobs:
network-tests-ubuntu:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master' && github.repository == 'vlang/v'
network:
strategy:
matrix:
include:
- os: ubuntu-latest
cc: tcc
- os: windows-latest
cc: msvc
- os: macos-13
cc: clang
fail-fast: false
runs-on: ${{ matrix.os }}
if: github.event_name != 'schedule' || (github.ref == 'refs/heads/master' && github.repository == 'vlang/v')
timeout-minutes: 30
env:
VFLAGS: -cc ${{ matrix.cc }}
V_CI_PERIODIC: 1
steps:
- uses: actions/checkout@v4
- name: Install dependencies 1
run: .github/workflows/retry.sh sudo apt-get install --quiet -y sqlite3 libsqlite3-dev
- name: Build v
run: make
- name: Symlink V
run: sudo ./v symlink
## - name: Run network tests
## run: ./v -d network test vlib/net

network-tests-macos:
runs-on: macos-14
if: github.ref == 'refs/heads/master' && github.repository == 'vlang/v'
timeout-minutes: 30
env:
V_CI_PERIODIC: 1
steps:
- uses: actions/checkout@v4
- name: Build V
run: make
- name: Symlink V
run: sudo ./v symlink
- name: Ensure thirdparty/cJSON/cJSON.o is compiled, before running tests.
run: ./v examples/json.v
## - name: Run network tests
## run: ./v -d network test vlib/net

network-windows-msvc:
runs-on: windows-2019
if: github.ref == 'refs/heads/master' && github.repository == 'vlang/v'
timeout-minutes: 30
env:
V_CI_PERIODIC: 1
VFLAGS: -cc msvc
steps:
- uses: actions/checkout@v4
- name: Build
run: |
echo %VFLAGS%
echo $VFLAGS
.\make.bat -msvc
## - name: Run network tests
## run: .\v.exe -d network test vlib/net
if: runner.os != 'Windows'
run: make -j4 && ./v -showcc -o v cmd/v && ./v doctor
- name: Build V (Windows)
if: runner.os == 'Windows'
run: ./make.bat -msvc && ./v -o v2.exe cmd/v && ./v2 -showcc -o v.exe cmd/v && ./v doctor
- name: Test
run: ./v -d network test-self vlib/net
1 change: 1 addition & 0 deletions cmd/tools/vtest-self.v
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const skip_test_files = [
'vlib/db/pg/pg_orm_test.v', // pg not installed
'vlib/db/pg/pg_test.v', // pg not installed
'vlib/db/pg/pg_double_test.v', // pg not installed
'vlib/net/ftp/ftp_test.v', // currently broken
]
// These tests are too slow to be run in the CI on each PR/commit
// in the sanitized modes:
Expand Down
1 change: 1 addition & 0 deletions vlib/net/http/http_httpbin_test.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// vtest retry: 9
module http

// internal tests have access to *everything in the module*
Expand Down
17 changes: 10 additions & 7 deletions vlib/net/mbedtls/mbedtls_sslconn_shutdown_does_not_panic_test.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import time
import context
import net.mbedtls
Expand All @@ -23,10 +22,6 @@ fn server() ! {
cli.shutdown()!
}

fn read_input() string {
return os.input_opt('Message: ') or { 'Empty' }
}

@[if network ?]
fn test_shutdown_does_not_panic() {
_ := spawn server()
Expand All @@ -40,7 +35,15 @@ fn test_shutdown_does_not_panic() {
time.sleep(1 * time.second)
mut background := context.background()
mut ctx, cancel := context.with_timeout(mut background, 2 * time.second)
spawn read_input()
spawn fn () {
mut i := 0
for {
i++
print('\r${i}...')
flush_stdout()
time.sleep(1 * time.second)
}
}()
mut done := ctx.done()
for {
select {
Expand All @@ -50,7 +53,7 @@ fn test_shutdown_does_not_panic() {
}
}

eprintln('Timeout without panic - OK')
eprintln('\nTimeout without panic - OK')

assert true
}
4 changes: 2 additions & 2 deletions vlib/net/unix/use_net_and_net_unix_together_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import net

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

const tfolder = os.join_path(os.vtmp_dir(), 'net_and_unix_together')
const test_port = os.join_path(tfolder, 'unix_domain_socket')
const tfolder = os.join_path(os.vtmp_dir(), 'net_unix_test')
const test_port = os.join_path(tfolder, 'domain_socket')

fn testsuite_begin() {
os.mkdir_all(tfolder) or {}
Expand Down

0 comments on commit 8dafca1

Please sign in to comment.