2020-04-05 12:40:17 +03:00
|
|
|
module main
|
|
|
|
|
|
|
|
import os
|
|
|
|
import testing
|
2020-04-07 20:51:23 +03:00
|
|
|
import v.pref
|
2020-04-05 12:40:17 +03:00
|
|
|
|
|
|
|
const (
|
2020-12-29 21:27:57 +03:00
|
|
|
skip_with_fsanitize_memory = [
|
2020-12-29 08:46:54 +03:00
|
|
|
'vlib/encoding/csv/reader_test.v',
|
|
|
|
'vlib/net/tcp_test.v',
|
|
|
|
'vlib/net/tcp_simple_client_server_test.v',
|
|
|
|
'vlib/net/udp_test.v',
|
|
|
|
'vlib/net/http/cookie_test.v',
|
|
|
|
'vlib/net/http/http_test.v',
|
|
|
|
'vlib/net/http/status_test.v',
|
|
|
|
'vlib/orm/orm_test.v',
|
|
|
|
'vlib/sqlite/sqlite_test.v',
|
|
|
|
'vlib/vweb/tests/vweb_test.v',
|
2020-12-29 21:27:57 +03:00
|
|
|
'vlib/v/tests/unsafe_test.v',
|
2021-01-17 20:09:29 +03:00
|
|
|
'vlib/x/websocket/websocket_test.v',
|
2021-01-05 13:40:48 +03:00
|
|
|
'vlib/net/http/http_httpbin_test.v',
|
2020-12-29 08:46:54 +03:00
|
|
|
]
|
2020-12-29 21:27:57 +03:00
|
|
|
skip_with_fsanitize_address = [
|
2020-12-29 08:46:54 +03:00
|
|
|
'vlib/encoding/base64/base64_test.v',
|
|
|
|
'vlib/encoding/csv/reader_test.v',
|
|
|
|
'vlib/flag/flag_test.v',
|
|
|
|
'vlib/io/util/util_test.v',
|
|
|
|
'vlib/io/reader_test.v',
|
|
|
|
'vlib/json/json_test.v',
|
|
|
|
'vlib/net/http/cookie_test.v',
|
|
|
|
'vlib/os/inode_test.v',
|
|
|
|
'vlib/os/os_test.v',
|
|
|
|
'vlib/regex/regex_test.v',
|
|
|
|
'vlib/semver/semver_test.v',
|
|
|
|
'vlib/sync/channel_opt_propagate_test.v',
|
|
|
|
'vlib/time/parse_test.v',
|
|
|
|
'vlib/v/fmt/fmt_keep_test.v',
|
|
|
|
'vlib/v/fmt/fmt_test.v',
|
|
|
|
'vlib/v/tests/array_init_test.v',
|
|
|
|
'vlib/v/doc/doc_test.v',
|
|
|
|
'vlib/v/tests/const_test.v',
|
|
|
|
'vlib/v/tests/fn_multiple_returns_test.v',
|
|
|
|
'vlib/v/tests/inout/compiler_test.v',
|
|
|
|
'vlib/v/tests/option_default_values_test.v',
|
|
|
|
'vlib/v/tests/option_test.v',
|
|
|
|
'vlib/v/tests/ptr_arithmetic_test.v',
|
|
|
|
'vlib/v/tests/str_gen_test.v',
|
|
|
|
'vlib/v/tests/unsafe_test.v',
|
|
|
|
'vlib/v/tests/vmod_parser_test.v',
|
|
|
|
'vlib/v/vcache/vcache_test.v',
|
|
|
|
'vlib/x/json2/decoder_test.v',
|
2020-12-29 21:27:57 +03:00
|
|
|
'vlib/x/websocket/websocket_test.v',
|
2020-12-29 08:46:54 +03:00
|
|
|
]
|
2020-12-29 21:27:57 +03:00
|
|
|
skip_with_fsanitize_undefined = [
|
|
|
|
'vlib/encoding/csv/reader_test.v',
|
2020-12-29 08:46:54 +03:00
|
|
|
]
|
2021-01-05 13:40:48 +03:00
|
|
|
skip_test_files = []string{}
|
2020-12-29 21:27:57 +03:00
|
|
|
skip_on_musl = [
|
2020-12-25 19:44:52 +03:00
|
|
|
'vlib/v/tests/profile/profile_test.v',
|
|
|
|
]
|
2020-12-29 21:27:57 +03:00
|
|
|
skip_on_ubuntu_musl = [
|
|
|
|
/* 'vlib/v/gen/js/jsgen_test.v', */
|
2020-05-06 23:26:44 +03:00
|
|
|
'vlib/net/http/cookie_test.v',
|
2020-07-08 21:30:57 +03:00
|
|
|
'vlib/net/http/http_test.v',
|
2020-10-09 18:33:16 +03:00
|
|
|
'vlib/net/http/status_test.v',
|
2020-07-17 20:13:22 +03:00
|
|
|
'vlib/net/websocket/ws_test.v',
|
2020-06-07 18:51:28 +03:00
|
|
|
'vlib/sqlite/sqlite_test.v',
|
|
|
|
'vlib/orm/orm_test.v',
|
2020-05-06 23:26:44 +03:00
|
|
|
'vlib/clipboard/clipboard_test.v',
|
2020-08-14 01:11:12 +03:00
|
|
|
'vlib/vweb/tests/vweb_test.v',
|
2020-08-22 01:52:45 +03:00
|
|
|
'vlib/x/websocket/websocket_test.v',
|
2021-01-05 13:40:48 +03:00
|
|
|
'vlib/net/http/http_httpbin_test.v',
|
2020-05-06 22:59:39 +03:00
|
|
|
]
|
2020-12-29 21:27:57 +03:00
|
|
|
skip_on_linux = []string{}
|
|
|
|
skip_on_non_linux = [
|
2020-07-17 20:13:22 +03:00
|
|
|
'vlib/net/websocket/ws_test.v',
|
2020-05-26 13:50:37 +03:00
|
|
|
]
|
2020-12-29 21:27:57 +03:00
|
|
|
skip_on_windows = [
|
2020-06-07 18:51:28 +03:00
|
|
|
'vlib/orm/orm_test.v',
|
2020-06-09 16:06:07 +03:00
|
|
|
'vlib/net/websocket/ws_test.v',
|
2020-08-22 01:52:45 +03:00
|
|
|
'vlib/x/websocket/websocket_test.v',
|
2020-08-14 01:11:12 +03:00
|
|
|
'vlib/vweb/tests/vweb_test.v',
|
2020-06-07 18:51:28 +03:00
|
|
|
]
|
2020-12-29 21:27:57 +03:00
|
|
|
skip_on_non_windows = []string{}
|
|
|
|
skip_on_macos = []string{}
|
|
|
|
skip_on_non_macos = []string{}
|
2020-04-05 12:40:17 +03:00
|
|
|
)
|
|
|
|
|
2020-05-06 22:59:39 +03:00
|
|
|
// NB: musl misses openssl, thus the http tests can not be done there
|
|
|
|
// NB: http_httpbin_test.v: fails with 'cgen error: json: map_string_string is not struct'
|
2020-04-05 12:40:17 +03:00
|
|
|
fn main() {
|
2020-04-07 20:51:23 +03:00
|
|
|
vexe := pref.vexe_path()
|
|
|
|
vroot := os.dir(vexe)
|
2020-04-10 22:40:56 +03:00
|
|
|
os.chdir(vroot)
|
2020-12-20 17:33:55 +03:00
|
|
|
args := os.args.clone()
|
2020-04-05 12:40:17 +03:00
|
|
|
args_string := args[1..].join(' ')
|
2021-01-19 11:41:51 +03:00
|
|
|
cmd_prefix := args_string.all_before('test-self')
|
2020-04-05 12:40:17 +03:00
|
|
|
title := 'testing all fixed tests'
|
2020-05-06 22:59:39 +03:00
|
|
|
all_test_files := os.walk_ext(os.join_path(vroot, 'vlib'), '_test.v')
|
2020-04-05 12:40:17 +03:00
|
|
|
testing.eheader(title)
|
|
|
|
mut tsession := testing.new_test_session(cmd_prefix)
|
2020-04-07 20:51:23 +03:00
|
|
|
tsession.files << all_test_files
|
|
|
|
tsession.skip_files << skip_test_files
|
2020-12-29 08:46:54 +03:00
|
|
|
mut sanitize_memory := false
|
|
|
|
mut sanitize_address := false
|
|
|
|
mut sanitize_undefined := false
|
|
|
|
for arg in args {
|
|
|
|
if '-fsanitize=memory' in arg {
|
|
|
|
sanitize_memory = true
|
|
|
|
}
|
|
|
|
if '-fsanitize=address' in arg {
|
|
|
|
sanitize_address = true
|
|
|
|
}
|
|
|
|
if '-fsanitize=undefined' in arg {
|
2020-12-29 21:27:57 +03:00
|
|
|
sanitize_undefined = true
|
2020-12-29 08:46:54 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if sanitize_memory {
|
|
|
|
tsession.skip_files << skip_with_fsanitize_memory
|
|
|
|
}
|
|
|
|
if sanitize_address {
|
|
|
|
tsession.skip_files << skip_with_fsanitize_address
|
|
|
|
}
|
|
|
|
if sanitize_undefined {
|
|
|
|
tsession.skip_files << skip_with_fsanitize_undefined
|
|
|
|
}
|
2021-01-05 19:13:38 +03:00
|
|
|
// println(tsession.skip_files)
|
2020-05-06 22:59:39 +03:00
|
|
|
if os.getenv('V_CI_MUSL').len > 0 {
|
|
|
|
tsession.skip_files << skip_on_musl
|
|
|
|
}
|
2020-07-08 21:30:57 +03:00
|
|
|
if os.getenv('V_CI_UBUNTU_MUSL').len > 0 {
|
|
|
|
tsession.skip_files << skip_on_ubuntu_musl
|
|
|
|
}
|
2020-04-11 12:41:48 +03:00
|
|
|
$if !linux {
|
2020-05-06 22:59:39 +03:00
|
|
|
tsession.skip_files << skip_on_non_linux
|
2020-04-11 12:41:48 +03:00
|
|
|
}
|
2020-04-11 13:41:59 +03:00
|
|
|
$if linux {
|
2020-05-06 22:59:39 +03:00
|
|
|
tsession.skip_files << skip_on_linux
|
|
|
|
}
|
|
|
|
$if windows {
|
|
|
|
tsession.skip_files << skip_on_windows
|
|
|
|
}
|
|
|
|
$if !windows {
|
|
|
|
tsession.skip_files << skip_on_non_windows
|
|
|
|
}
|
|
|
|
$if macos {
|
|
|
|
tsession.skip_files << skip_on_macos
|
|
|
|
}
|
|
|
|
$if !macos {
|
|
|
|
tsession.skip_files << skip_on_non_macos
|
2020-04-11 13:41:59 +03:00
|
|
|
}
|
2020-04-05 12:40:17 +03:00
|
|
|
tsession.test()
|
|
|
|
eprintln(tsession.benchmark.total_message(title))
|
|
|
|
if tsession.benchmark.nfail > 0 {
|
2020-10-14 23:42:30 +03:00
|
|
|
eprintln('\nWARNING: failed $tsession.benchmark.nfail times.\n')
|
|
|
|
exit(1)
|
2020-04-05 15:20:28 +03:00
|
|
|
}
|
2020-04-05 12:40:17 +03:00
|
|
|
}
|