2020-04-05 11:40:17 +02:00
|
|
|
module main
|
|
|
|
|
|
|
|
import os
|
|
|
|
import testing
|
2020-04-07 19:51:23 +02:00
|
|
|
import v.pref
|
2020-04-05 11:40:17 +02:00
|
|
|
|
|
|
|
const (
|
2020-12-29 19:27:57 +01:00
|
|
|
skip_with_fsanitize_memory = [
|
2020-12-29 06:46:54 +01:00
|
|
|
'vlib/net/tcp_simple_client_server_test.v',
|
|
|
|
'vlib/net/http/cookie_test.v',
|
|
|
|
'vlib/net/http/http_test.v',
|
|
|
|
'vlib/net/http/status_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/net/http/http_httpbin_test.v',
|
2021-02-27 22:54:27 +01:00
|
|
|
'vlib/net/http/header_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/net/udp_test.v',
|
|
|
|
'vlib/net/tcp_test.v',
|
2020-12-29 06:46:54 +01:00
|
|
|
'vlib/orm/orm_test.v',
|
|
|
|
'vlib/sqlite/sqlite_test.v',
|
2021-02-04 20:28:33 +01:00
|
|
|
'vlib/v/tests/orm_sub_struct_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/vweb/tests/vweb_test.v',
|
2021-02-27 23:18:25 +01:00
|
|
|
'vlib/vweb/request_test.v',
|
2021-03-01 11:50:52 +01:00
|
|
|
'vlib/vweb/route_test.v',
|
2021-01-17 18:09:29 +01:00
|
|
|
'vlib/x/websocket/websocket_test.v',
|
2020-12-29 06:46:54 +01:00
|
|
|
]
|
2020-12-29 19:27:57 +01:00
|
|
|
skip_with_fsanitize_address = [
|
2020-12-29 06:46:54 +01:00
|
|
|
'vlib/encoding/base64/base64_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/json/json_test.v',
|
|
|
|
'vlib/regex/regex_test.v',
|
|
|
|
'vlib/v/tests/ptr_arithmetic_test.v',
|
|
|
|
'vlib/v/tests/unsafe_test.v',
|
|
|
|
'vlib/x/websocket/websocket_test.v',
|
|
|
|
]
|
2021-03-01 13:54:49 +01:00
|
|
|
skip_with_fsanitize_undefined = []string{}
|
2021-02-07 23:10:01 +01:00
|
|
|
skip_with_werror = [
|
|
|
|
'vlib/builtin/array_test.v',
|
|
|
|
'vlib/clipboard/clipboard_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/dl/dl_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/dl/example/use_test.v',
|
|
|
|
'vlib/eventbus/eventbus_test.v',
|
|
|
|
'vlib/gx/color_test.v',
|
2020-12-29 06:46:54 +01:00
|
|
|
'vlib/json/json_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/math/big/big_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/net/ftp/ftp_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/net/http/cookie_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/net/http/http_httpbin_test.v',
|
|
|
|
'vlib/net/http/header_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/net/tcp_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/net/tcp_simple_client_server_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/net/smtp/smtp_test.v',
|
|
|
|
'vlib/net/udp_test.v',
|
2021-02-11 17:51:12 +01:00
|
|
|
'vlib/net/unix/unix_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/net/http/http_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/net/http/status_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/orm/orm_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/os/os_test.v',
|
|
|
|
'vlib/rand/mt19937/mt19937_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/readline/readline_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/regex/regex_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/sqlite/sqlite_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/strconv/atof_test.v',
|
|
|
|
'vlib/strconv/f32_f64_to_string_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/strconv/number_to_base_test.v',
|
|
|
|
'vlib/sync/atomic2/atomic_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/sync/channel_2_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/sync/channel_1_test.v',
|
|
|
|
'vlib/sync/channel_3_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/sync/channel_4_test.v',
|
|
|
|
'vlib/sync/channel_array_mut_test.v',
|
|
|
|
'vlib/sync/channel_close_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/sync/channel_fill_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/sync/channel_polling_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/sync/channel_opt_propagate_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/sync/channel_push_or_1_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/sync/channel_push_or_2_test.v',
|
|
|
|
'vlib/sync/channel_select_2_test.v',
|
|
|
|
'vlib/sync/channel_select_3_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/sync/channel_select_4_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/sync/channel_select_5_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/sync/channel_select_6_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/sync/channel_select_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/sync/channel_try_buf_test.v',
|
|
|
|
'vlib/sync/select_close_test.v',
|
|
|
|
'vlib/sync/struct_chan_init_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/sync/pool/pool_test.v',
|
|
|
|
'vlib/sync/channel_try_unbuf_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/szip/szip_test.v',
|
|
|
|
'vlib/v/compiler_errors_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/gen/js/jsgen_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/anon_fn_test.v',
|
|
|
|
'vlib/v/tests/array_map_ref_test.v',
|
|
|
|
'vlib/v/tests/array_test.v',
|
|
|
|
'vlib/v/tests/assert_sumtype_test.v',
|
|
|
|
'vlib/v/tests/autolock_array2_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/autolock_array1_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/blank_ident_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/v/tests/comptime_at_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/comptime_call_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/comptime_if_expr_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/cstrings_test.v',
|
|
|
|
'vlib/v/tests/enum_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/fixed_array_test.v',
|
|
|
|
'vlib/v/tests/fn_shared_return_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/fn_variadic_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/for_loops_2_test.v',
|
|
|
|
'vlib/v/tests/generic_chan_test.v',
|
|
|
|
'vlib/v/tests/generics_method_test.v',
|
2021-02-22 14:08:52 +01:00
|
|
|
'vlib/v/tests/go_array_wait_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/v/tests/go_call_generic_fn_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/generics_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/go_wait_2_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/in_expression_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/interface_edge_cases/assign_to_interface_field_test.v',
|
|
|
|
'vlib/v/tests/interface_fields_test.v',
|
|
|
|
'vlib/v/tests/interface_variadic_test.v',
|
2021-02-28 23:21:03 +01:00
|
|
|
'vlib/v/tests/option_2_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/operator_overloading_with_string_interpolation_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/orm_sub_struct_test.v',
|
2021-02-13 00:47:37 +01:00
|
|
|
'vlib/v/tests/ref_struct_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/v/tests/repl/repl_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/semaphore_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/semaphore_timed_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/v/tests/shared_arg_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/shared_array_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/v/tests/shared_autolock_test.v',
|
|
|
|
'vlib/v/tests/shared_fn_return_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/shared_lock_2_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/shared_elem_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/v/tests/shared_lock_4_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/shared_lock_3_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/shared_lock_6_test.v',
|
|
|
|
'vlib/v/tests/shared_lock_expr_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/shared_lock_5_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/shared_lock_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/v/tests/shared_map_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/shared_unordered_mixed_test.v',
|
|
|
|
'vlib/v/tests/shift_test.v',
|
2020-12-29 06:46:54 +01:00
|
|
|
'vlib/v/tests/str_gen_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/string_interpolation_multi_return_test.v',
|
2021-02-16 12:40:13 +01:00
|
|
|
'vlib/v/tests/string_interpolation_shared_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/string_interpolation_test.v',
|
2021-02-21 15:09:19 +01:00
|
|
|
'vlib/v/tests/struct_allow_both_field_defaults_and_skip_flag_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/struct_test.v',
|
|
|
|
'vlib/v/tests/sum_type_test.v',
|
|
|
|
'vlib/v/tests/type_name_test.v',
|
2020-12-29 06:46:54 +01:00
|
|
|
'vlib/v/tests/unsafe_test.v',
|
2021-03-01 13:54:49 +01:00
|
|
|
'vlib/v/tests/voidptr_to_u64_cast_a_test.v',
|
|
|
|
'vlib/v/tests/voidptr_to_u64_cast_b_test.v',
|
2021-02-07 23:10:01 +01:00
|
|
|
'vlib/v/tests/working_with_an_empty_struct_test.v',
|
|
|
|
'vlib/vweb/tests/vweb_test.v',
|
2021-02-27 23:18:25 +01:00
|
|
|
'vlib/vweb/request_test.v',
|
2021-03-01 11:50:52 +01:00
|
|
|
'vlib/vweb/route_test.v',
|
2020-12-29 19:27:57 +01:00
|
|
|
'vlib/x/websocket/websocket_test.v',
|
2021-02-11 01:24:15 +01:00
|
|
|
'vlib/x/ttf/ttf_test.v',
|
2020-12-29 06:46:54 +01:00
|
|
|
]
|
2021-02-21 15:09:19 +01:00
|
|
|
skip_with_asan_compiler = [
|
|
|
|
'vlib/readline/readline_test.v',
|
|
|
|
'vlib/vweb/tests/vweb_test.v',
|
|
|
|
]
|
2021-01-05 11:40:48 +01:00
|
|
|
skip_test_files = []string{}
|
2020-12-29 19:27:57 +01:00
|
|
|
skip_on_musl = [
|
2020-12-25 17:44:52 +01:00
|
|
|
'vlib/v/tests/profile/profile_test.v',
|
|
|
|
]
|
2020-12-29 19:27:57 +01:00
|
|
|
skip_on_ubuntu_musl = [
|
2021-03-01 13:54:49 +01:00
|
|
|
//'vlib/v/gen/js/jsgen_test.v',
|
2020-05-06 22:26:44 +02:00
|
|
|
'vlib/net/http/cookie_test.v',
|
2020-07-08 20:30:57 +02:00
|
|
|
'vlib/net/http/http_test.v',
|
2020-10-09 17:33:16 +02:00
|
|
|
'vlib/net/http/status_test.v',
|
2020-07-17 19:13:22 +02:00
|
|
|
'vlib/net/websocket/ws_test.v',
|
2020-06-07 17:51:28 +02:00
|
|
|
'vlib/sqlite/sqlite_test.v',
|
|
|
|
'vlib/orm/orm_test.v',
|
2021-02-04 20:28:33 +01:00
|
|
|
'vlib/v/tests/orm_sub_struct_test.v',
|
2020-05-06 22:26:44 +02:00
|
|
|
'vlib/clipboard/clipboard_test.v',
|
2020-08-14 00:11:12 +02:00
|
|
|
'vlib/vweb/tests/vweb_test.v',
|
2021-02-27 23:18:25 +01:00
|
|
|
'vlib/vweb/request_test.v',
|
2021-03-01 11:50:52 +01:00
|
|
|
'vlib/vweb/route_test.v',
|
2020-08-22 00:52:45 +02:00
|
|
|
'vlib/x/websocket/websocket_test.v',
|
2021-01-05 11:40:48 +01:00
|
|
|
'vlib/net/http/http_httpbin_test.v',
|
2021-02-27 22:54:27 +01:00
|
|
|
'vlib/net/http/header_test.v',
|
2020-05-06 21:59:39 +02:00
|
|
|
]
|
2020-12-29 19:27:57 +01:00
|
|
|
skip_on_linux = []string{}
|
|
|
|
skip_on_non_linux = [
|
2020-07-17 19:13:22 +02:00
|
|
|
'vlib/net/websocket/ws_test.v',
|
2020-05-26 12:50:37 +02:00
|
|
|
]
|
2020-12-29 19:27:57 +01:00
|
|
|
skip_on_windows = [
|
2020-06-07 17:51:28 +02:00
|
|
|
'vlib/orm/orm_test.v',
|
2021-02-04 20:28:33 +01:00
|
|
|
'vlib/v/tests/orm_sub_struct_test.v',
|
2020-06-09 15:06:07 +02:00
|
|
|
'vlib/net/websocket/ws_test.v',
|
2021-02-11 17:51:12 +01:00
|
|
|
'vlib/net/unix/unix_test.v',
|
2020-08-22 00:52:45 +02:00
|
|
|
'vlib/x/websocket/websocket_test.v',
|
2020-08-14 00:11:12 +02:00
|
|
|
'vlib/vweb/tests/vweb_test.v',
|
2021-02-27 23:18:25 +01:00
|
|
|
'vlib/vweb/request_test.v',
|
2021-03-01 11:50:52 +01:00
|
|
|
'vlib/vweb/route_test.v',
|
2020-06-07 17:51:28 +02:00
|
|
|
]
|
2020-12-29 19:27:57 +01:00
|
|
|
skip_on_non_windows = []string{}
|
|
|
|
skip_on_macos = []string{}
|
|
|
|
skip_on_non_macos = []string{}
|
2020-04-05 11:40:17 +02:00
|
|
|
)
|
|
|
|
|
2020-05-06 21:59:39 +02: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 11:40:17 +02:00
|
|
|
fn main() {
|
2020-04-07 19:51:23 +02:00
|
|
|
vexe := pref.vexe_path()
|
|
|
|
vroot := os.dir(vexe)
|
2020-04-10 21:40:56 +02:00
|
|
|
os.chdir(vroot)
|
2020-12-20 15:33:55 +01:00
|
|
|
args := os.args.clone()
|
2020-04-05 11:40:17 +02:00
|
|
|
args_string := args[1..].join(' ')
|
2021-01-19 09:41:51 +01:00
|
|
|
cmd_prefix := args_string.all_before('test-self')
|
2021-01-28 11:13:51 +01:00
|
|
|
title := 'testing all tests'
|
2020-05-06 21:59:39 +02:00
|
|
|
all_test_files := os.walk_ext(os.join_path(vroot, 'vlib'), '_test.v')
|
2020-04-05 11:40:17 +02:00
|
|
|
testing.eheader(title)
|
|
|
|
mut tsession := testing.new_test_session(cmd_prefix)
|
2020-04-07 19:51:23 +02:00
|
|
|
tsession.files << all_test_files
|
|
|
|
tsession.skip_files << skip_test_files
|
2021-02-28 20:24:29 +01:00
|
|
|
tsession.skip_files << 'vlib/v/tests/option_print_errors_test.v'
|
2021-02-07 23:10:01 +01:00
|
|
|
mut werror := false
|
2020-12-29 06:46:54 +01:00
|
|
|
mut sanitize_memory := false
|
|
|
|
mut sanitize_address := false
|
|
|
|
mut sanitize_undefined := false
|
2021-02-21 15:09:19 +01:00
|
|
|
mut asan_compiler := false
|
2020-12-29 06:46:54 +01:00
|
|
|
for arg in args {
|
2021-02-21 15:09:19 +01:00
|
|
|
if '-asan-compiler' in arg {
|
|
|
|
asan_compiler = true
|
|
|
|
}
|
2021-02-07 23:10:01 +01:00
|
|
|
if '-Werror' in arg {
|
|
|
|
werror = true
|
|
|
|
}
|
2020-12-29 06:46:54 +01:00
|
|
|
if '-fsanitize=memory' in arg {
|
|
|
|
sanitize_memory = true
|
|
|
|
}
|
|
|
|
if '-fsanitize=address' in arg {
|
|
|
|
sanitize_address = true
|
|
|
|
}
|
|
|
|
if '-fsanitize=undefined' in arg {
|
2020-12-29 19:27:57 +01:00
|
|
|
sanitize_undefined = true
|
2020-12-29 06:46:54 +01:00
|
|
|
}
|
|
|
|
}
|
2021-02-07 23:10:01 +01:00
|
|
|
if werror {
|
|
|
|
tsession.skip_files << skip_with_werror
|
|
|
|
}
|
2020-12-29 06:46:54 +01: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-02-21 15:09:19 +01:00
|
|
|
if asan_compiler {
|
|
|
|
tsession.skip_files << skip_with_asan_compiler
|
|
|
|
}
|
2021-01-05 17:13:38 +01:00
|
|
|
// println(tsession.skip_files)
|
2020-05-06 21:59:39 +02:00
|
|
|
if os.getenv('V_CI_MUSL').len > 0 {
|
|
|
|
tsession.skip_files << skip_on_musl
|
|
|
|
}
|
2020-07-08 20:30:57 +02:00
|
|
|
if os.getenv('V_CI_UBUNTU_MUSL').len > 0 {
|
|
|
|
tsession.skip_files << skip_on_ubuntu_musl
|
|
|
|
}
|
2020-04-11 11:41:48 +02:00
|
|
|
$if !linux {
|
2020-05-06 21:59:39 +02:00
|
|
|
tsession.skip_files << skip_on_non_linux
|
2020-04-11 11:41:48 +02:00
|
|
|
}
|
2020-04-11 12:41:59 +02:00
|
|
|
$if linux {
|
2020-05-06 21:59:39 +02: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 12:41:59 +02:00
|
|
|
}
|
2020-04-05 11:40:17 +02:00
|
|
|
tsession.test()
|
|
|
|
eprintln(tsession.benchmark.total_message(title))
|
|
|
|
if tsession.benchmark.nfail > 0 {
|
2020-10-14 22:42:30 +02:00
|
|
|
eprintln('\nWARNING: failed $tsession.benchmark.nfail times.\n')
|
|
|
|
exit(1)
|
2020-04-05 14:20:28 +02:00
|
|
|
}
|
2020-04-05 11:40:17 +02:00
|
|
|
}
|