From 55f482bb636560e82a761c9d071f95a7ef41056e Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 17 Feb 2025 07:37:59 +0200 Subject: [PATCH] ci: update linux image runners from `ubuntu-20.04` to `ubuntu-24.04` (#23706) --- .github/workflows/bootstrapping_ci.yml | 2 +- .github/workflows/c2v_ci.yml | 4 +- .github/workflows/cross_ci.yml | 20 +- .github/workflows/docker_ci.yml | 6 +- .github/workflows/docs_ci.yml | 10 +- .github/workflows/gen_vc_ci.yml | 2 +- .github/workflows/gg_regressions_ci.yml | 4 +- .github/workflows/linux_ci.yml | 8 +- .github/workflows/macos_ci.yml | 2 +- .github/workflows/module_docs_ci.yml | 4 +- .../more_extensive_but_slower_tests_ci.yml | 2 +- .github/workflows/native_backend_ci.yml | 2 +- .github/workflows/other_ci.yml | 12 +- .github/workflows/paths_ci.yml | 4 +- .github/workflows/prebuilt.yml | 2 +- .github/workflows/puzzle_vibes_ci.yml | 6 +- .github/workflows/release_ci.yml | 2 +- .../run_sanitizers_undefined.suppressions | 187 +++++++++++++++++- .github/workflows/sanitized_ci.yml | 69 ++++--- .github/workflows/sdl_ci.yml | 4 +- .github/workflows/symlink_ci.yml | 2 +- .github/workflows/time_ci.yml | 2 +- .github/workflows/toml_ci.yml | 2 +- .github/workflows/tools_ci.yml | 22 +-- .../v_apps_and_modules_compile_ci.yml | 2 +- .github/workflows/vab_ci.yml | 6 +- .github/workflows/vinix_ci.yml | 4 +- .github/workflows/vpm_ci.yml | 2 +- .github/workflows/vsl_and_vtl_compile_ci.yml | 2 +- .github/workflows/vup_works.yml | 2 +- .github/workflows/wasm_backend_ci.yml | 2 +- .github/workflows/websockets_ci.yml | 4 +- .github/workflows/windows_ci.yml | 2 +- ci/linux_ci.vsh | 4 +- cmd/tools/vcover/cover_test.v | 34 ++-- cmd/tools/vtest-self.v | 18 +- vlib/builtin/cfns_wrapper.c.v | 12 ++ vlib/net/http/download_terminal_downloader.v | 6 +- vlib/net/websocket/websocket_server.v | 14 +- vlib/net/websocket/websocket_test.v | 91 +++++---- vlib/v/checker/check_types.v | 12 +- vlib/v/gen/c/cgen.v | 2 +- vlib/v/gen/c/cheaders.v | 4 + vlib/v/gen/native/tests/native_test.v | 9 +- vlib/v/transformer/transformer.v | 4 +- vlib/x/ttf/render_bmp.v | 24 +-- 46 files changed, 445 insertions(+), 195 deletions(-) diff --git a/.github/workflows/bootstrapping_ci.yml b/.github/workflows/bootstrapping_ci.yml index 1366a86080..17b9abd0f0 100644 --- a/.github/workflows/bootstrapping_ci.yml +++ b/.github/workflows/bootstrapping_ci.yml @@ -24,7 +24,7 @@ on: - '!**/bootstrapping_ci.yml' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: bootstrapping-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/c2v_ci.yml b/.github/workflows/c2v_ci.yml index d9e0b81a80..7667c3645f 100644 --- a/.github/workflows/c2v_ci.yml +++ b/.github/workflows/c2v_ci.yml @@ -23,7 +23,7 @@ on: - '!cmd/tools/builders/**.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: c2v-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: @@ -71,7 +71,7 @@ jobs: WAD_FILE=~/DOOM1.WAD ~/code/doom/build_whole_project.sh test-regression: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 20 env: VFLAGS: -cc tcc diff --git a/.github/workflows/cross_ci.yml b/.github/workflows/cross_ci.yml index ad3d7a450b..c48a51bed2 100644 --- a/.github/workflows/cross_ci.yml +++ b/.github/workflows/cross_ci.yml @@ -17,7 +17,7 @@ on: - '!cmd/tools/builders/**.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: cross-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: @@ -52,7 +52,7 @@ jobs: ./v -os windows examples/2048/2048.v linux-cross: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 25 env: VFLAGS: -cc tcc -no-retry-compilation @@ -65,14 +65,12 @@ jobs: - name: Install dependencies run: | - ## sudo dpkg --add-architecture i386 - ./v retry -- sudo apt update - ./v retry -- sudo apt install --quiet -y libssl-dev sqlite3 libsqlite3-dev - ./v retry -- sudo apt install --quiet -y mingw-w64 wine-stable winetricks - ## ./v retry -- sudo apt install --quiet -y wine32 + ./v retry -- sudo apt install --quiet -y mingw-w64 wine wine64 winetricks libssl-dev sqlite3 libsqlite3-dev - - name: Turn off the wine crash dialog - run: winetricks nocrashdialog + - name: Show diagnostics for wine + run: | + which wine + ls -la $(realpath $(which wine)) - name: v.c can be compiled and run with -os cross run: | @@ -86,13 +84,13 @@ jobs: ./v -cc msvc -os windows -o /tmp/v_win.c cmd/v x86_64-w64-mingw32-gcc /tmp/v_win.c -std=c99 -w -municode -o v_from_vc.exe -lws2_32 ls -lart v_from_vc.exe - wine64 ./v_from_vc.exe version + wine ./v_from_vc.exe version - name: hello_world.v can be cross compiled to hello_world.exe run: | ./v -os windows examples/hello_world.v ls -lart examples/hello_world.exe - wine64 examples/hello_world.exe + wine examples/hello_world.exe - name: 2048.v can be cross compiled to 2048.exe run: | diff --git a/.github/workflows/docker_ci.yml b/.github/workflows/docker_ci.yml index f69853d1d0..8ad8654da0 100644 --- a/.github/workflows/docker_ci.yml +++ b/.github/workflows/docker_ci.yml @@ -17,7 +17,7 @@ on: - '!cmd/tools/builders/**.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: docker-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true env: @@ -25,7 +25,7 @@ env: jobs: docker-alpine-musl-gcc: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 241 container: image: thevlang/vlang:alpine-build @@ -54,7 +54,7 @@ jobs: run: VTEST_JUST_ESSENTIAL=1 ./v test-self docker-ubuntu-musl: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 121 container: image: thevlang/vlang:ubuntu-build diff --git a/.github/workflows/docs_ci.yml b/.github/workflows/docs_ci.yml index 903bff1ba2..188ef0139b 100644 --- a/.github/workflows/docs_ci.yml +++ b/.github/workflows/docs_ci.yml @@ -17,24 +17,26 @@ on: - 'cmd/tools/vrepl.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: docs-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: check-markdown: - runs-on: ubuntu-20.04 - timeout-minutes: 5 + runs-on: ubuntu-24.04 + timeout-minutes: 10 steps: - uses: actions/checkout@v4 - name: Build V run: make + - name: Install dependencies (some examples show how to use sqlite and the x11 clipboard) + run: ./v retry -- sudo apt install --quiet -y libx11-dev libssl-dev sqlite3 libsqlite3-dev - name: Check markdown line length & code examples run: ./v check-md -hide-warnings . ## NB: -hide-warnings is used here, so that the output is less noisy, ## thus real errors are easier to spot. report-missing-fn-doc: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 env: MOPTIONS: --diff --deprecated --relative-paths --exclude /vlib/v/ --exclude /builtin/linux_bare/ --exclude /testdata/ --exclude /tests/ diff --git a/.github/workflows/gen_vc_ci.yml b/.github/workflows/gen_vc_ci.yml index ed0be5ad9b..44ab42558f 100644 --- a/.github/workflows/gen_vc_ci.yml +++ b/.github/workflows/gen_vc_ci.yml @@ -24,7 +24,7 @@ on: # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: gen_vc-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ !contains(github.ref, 'master')}} jobs: diff --git a/.github/workflows/gg_regressions_ci.yml b/.github/workflows/gg_regressions_ci.yml index 64be6c48e6..b19c353e64 100644 --- a/.github/workflows/gg_regressions_ci.yml +++ b/.github/workflows/gg_regressions_ci.yml @@ -17,12 +17,12 @@ on: - '!**.md' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: gg-regressions-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: gg-regressions: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 20 env: VFLAGS: -cc tcc diff --git a/.github/workflows/linux_ci.yml b/.github/workflows/linux_ci.yml index 42d5784e8a..3a914d781c 100644 --- a/.github/workflows/linux_ci.yml +++ b/.github/workflows/linux_ci.yml @@ -18,12 +18,12 @@ on: - '!cmd/tools/builders/**.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: linux-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: tcc: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 121 env: VFLAGS: -cc tcc -no-retry-compilation @@ -81,7 +81,7 @@ jobs: run: v run ci/linux_ci.vsh test_leak_detector_not_active_tcc gcc: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 121 steps: - uses: actions/checkout@v4 @@ -135,7 +135,7 @@ jobs: run: v run ci/linux_ci.vsh test_vlib_skip_unused_gcc clang: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 121 env: VFLAGS: -cc clang diff --git a/.github/workflows/macos_ci.yml b/.github/workflows/macos_ci.yml index a8a9d7e03b..6fd032801d 100644 --- a/.github/workflows/macos_ci.yml +++ b/.github/workflows/macos_ci.yml @@ -17,7 +17,7 @@ on: - '!cmd/tools/builders/**.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: macos-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/module_docs_ci.yml b/.github/workflows/module_docs_ci.yml index 3f2b108397..852a587246 100644 --- a/.github/workflows/module_docs_ci.yml +++ b/.github/workflows/module_docs_ci.yml @@ -17,12 +17,12 @@ on: # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: module_docs-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ !contains(github.ref, 'master')}} jobs: build-module-docs: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: Build V diff --git a/.github/workflows/more_extensive_but_slower_tests_ci.yml b/.github/workflows/more_extensive_but_slower_tests_ci.yml index 838e91df9f..1740371ebd 100644 --- a/.github/workflows/more_extensive_but_slower_tests_ci.yml +++ b/.github/workflows/more_extensive_but_slower_tests_ci.yml @@ -17,7 +17,7 @@ on: - 'cmd/tools/**' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: slower_tests-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/native_backend_ci.yml b/.github/workflows/native_backend_ci.yml index 1be4b6204f..e03ea562d4 100644 --- a/.github/workflows/native_backend_ci.yml +++ b/.github/workflows/native_backend_ci.yml @@ -45,7 +45,7 @@ on: - '.github/workflows/native_backend_ci.yml' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: native_backend-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/other_ci.yml b/.github/workflows/other_ci.yml index d9f0cfc8c8..effd858921 100644 --- a/.github/workflows/other_ci.yml +++ b/.github/workflows/other_ci.yml @@ -18,12 +18,12 @@ on: - '!cmd/tools/builders/**.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: other-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: prevent-gpl-licenses: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 15 steps: - name: Checkout V ${{ github.head_ref }} @@ -46,7 +46,7 @@ jobs: diff -d -a -U 2 --color=always gpl_res_vmaster gpl_res_vnew code-formatting: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 30 env: VFLAGS: -cc gcc @@ -62,7 +62,7 @@ jobs: run: ./v test-fmt performance-regressions: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 30 env: VFLAGS: -cc gcc @@ -86,7 +86,7 @@ jobs: run: ./v repeat --max_time 1731 --series 3 --runs 20 --nmins 2 --nmaxs 5 --warmup 3 --fail_percent 10 -t 'cd {T} ; ./v -o v.c cmd/v' . ./vmaster misc-tooling: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 121 env: VFLAGS: -cc tcc -no-retry-compilation @@ -124,7 +124,7 @@ jobs: ./v should-compile-all examples/sokol/*.v examples/sokol/0?*/*.v parser-silent: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 121 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/paths_ci.yml b/.github/workflows/paths_ci.yml index 398446bdd4..e4b2f6148b 100644 --- a/.github/workflows/paths_ci.yml +++ b/.github/workflows/paths_ci.yml @@ -11,12 +11,12 @@ on: - '!**/paths_ci.yml' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: paths-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: space-paths-linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 30 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/prebuilt.yml b/.github/workflows/prebuilt.yml index c3c36f4cea..5dbbf02ad0 100644 --- a/.github/workflows/prebuilt.yml +++ b/.github/workflows/prebuilt.yml @@ -7,7 +7,7 @@ on: jobs: ubuntu: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: - name: Download V diff --git a/.github/workflows/puzzle_vibes_ci.yml b/.github/workflows/puzzle_vibes_ci.yml index 33483a611b..02f3ccba6a 100644 --- a/.github/workflows/puzzle_vibes_ci.yml +++ b/.github/workflows/puzzle_vibes_ci.yml @@ -20,13 +20,13 @@ on: - '!**.md' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: puzzle_vibes-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: v-compiles-puzzle-vibes: - runs-on: ubuntu-20.04 - timeout-minutes: 10 + runs-on: ubuntu-24.04 + timeout-minutes: 30 steps: - uses: actions/checkout@v4 - name: Build V diff --git a/.github/workflows/release_ci.yml b/.github/workflows/release_ci.yml index f9106f105d..bc3bf6c72f 100644 --- a/.github/workflows/release_ci.yml +++ b/.github/workflows/release_ci.yml @@ -13,7 +13,7 @@ on: - 0.** concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: release-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref_type != 'tag' }} permissions: diff --git a/.github/workflows/run_sanitizers_undefined.suppressions b/.github/workflows/run_sanitizers_undefined.suppressions index 4878ccd91e..62d6d0eab3 100644 --- a/.github/workflows/run_sanitizers_undefined.suppressions +++ b/.github/workflows/run_sanitizers_undefined.suppressions @@ -1,4 +1,187 @@ -## See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html +## See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html +## Most of the supressed functions here use asserts, that in turn use an indirection through an interface. TODO: if that is solved, most of these can be removed. +## Usually they contain a __test_ in their name, but not always (see the x.ttf ones like vlib/x/ttf/ttf_test.v ). +## TODO: extract the common part of the assertions to a VDO_ function (1 for pass and 1 for failure), so that they can be whitelisted here just once. +function:map_exists +function:map_get +function:IError_str + +shift-exponent:math__bits__rotate_left_64 +shift-exponent:math__bits__div_64 +function:math__big__Integer_general_radix_str +function:math__big__Integer_div_mod_internal +function:math__bits__test_bits +function:math__bits__test_div_64_edge_cases +function:math__test_nan + +alignment:rand__read_64 function:rand__internal_ulid_at_millisecond -function:sync__pool__process_in_thread +function:rand__internal_string_from_set +function:rand__internal_uuid_v4 function:rand__deinit +function:rand__read_internal +function:rand__read_64 +function:rand__PRNG_f64 + +function:rand__cuid2__test_cuid2 + +function:sync__pool__process_in_thread +function:sync__Once_do_slow_with_param + +function:v__type_resolver__TypeResolver_resolve_fn_generic_args +function:v__type_resolver__TypeResolver_unwrap_generic_expr +function:v__type_resolver__TypeResolver_get_type + +## these have asserts in them, and trigger due to the used indirection; TODO: remove them, when a more general solution is found for all interfaces +function:x__ttf__TTF_File_get_glyph_offset +function:x__ttf__TTF_File_get_horizontal_metrics +function:x__ttf__TTF_File_glyph_count +function:x__ttf__TTF_File_read_glyph +function:x__ttf__TTF_File_read_simple_glyph +function:x__ttf__TTF_File_read_kern_table +function:x__ttf__TTF_File_read_hhea_table +function:x__ttf__TTF_File_read_cmap_table +function:x__ttf__TTF_File_read_name_table +function:x__ttf__TTF_File_read_head_table +function:x__ttf__TTF_File_read_offset_tables + +function:net__unix__select_deadline +function:net__select_deadline +function:net__socks__test_parse_ipv4 +function:net__http__download_file_with_progress +function:net__http__download_progres_cb +function:net__http__check_headers +function:net__http__test_str +function:net__http__test_int +function:net__http__test_is_valid +function:net__http__test_is_error +function:net__http__test_is_success +function:net__http__test_parse_response_with_weird_cookie +function:net__http__test_parse_response_with_cookies +function:net__http__test_parse_response +function:net__http__test_response_bytestr_1 +function:net__http__test_response_bytestr_2 +function:net__http__test_parse_large_body +function:net__http__test_multipart_form_body +function:net__http__test_parse_multipart_form2 +function:net__http__test_parse_request_no_headers +function:net__http__test_parse_multipart_form +function:net__http__test_parse_form +function:net__http__test_parse_request_line +function:net__http__test_parse_request_body +function:net__http__test_parse_request_two_header_values +function:net__http__test_parse_request_no_headers +function:net__http__test_parse_request_two_headers +function:net__http__test_proxy_fields +function:net__http__test_proxy_headers +function:net__http__test_set_cookie +function:net__http__test_parse_headers +function:net__http__parse_headers_test +function:net__http__test_header_join +function:net__http__test_header_from_map +function:net__http__test_custom_header_from_map +function:net__http__test_render_coerce_canonicalize +function:net__http__test_render_canonicalize +function:net__http__test_render_version +function:net__http__test_coerce_canonicalize_custom +function:net__http__test_coerce_custom +function:net__http__test_coerce_canonicalize +function:net__http__test_coerce +function:net__http__test_custom_values +function:net__http__test_starting_with +function:net__http__test_get_custom +function:net__http__test_contains_custom +function:net__http__test_custom_header +function:net__http__test_delete_header +function:net__http__test_header_delete_not_existing +function:net__http__test_header_delete +function:net__http__test_header_set +function:net__http__test_header_get +function:net__http__test_header_adds_multiple +function:net__http__test_header_new +function:net__test_ip6_str +function:net__test_ip_str +function:net__test_sizes_unix +function:net__test_sizes_ipv4 +function:net__test_sizes_ipv6 +function:net__test_offsets_unix +function:net__test_offsets_ipv4 +function:net__test_offsets_ipv6 +function:net__test_sizes_unix_sun_path +function:net__test_diagnostics +function:net__test_ip_port +function:net__websocket__delete_client_cb +function:net__websocket__Server_listen +function:net__websocket__Server_serve_client +function:net__websocket__Server_parse_client_handshake +function:net__websocket__Client_listen +function:net__websocket__Client_send_message_event +function:net__websocket__Client_send_close_event +function:net__websocket__Client_debug_log +function:net__websocket__Client_connect + +function:io__BufferedReader_fill_buffer +function:io__read_all + +function:log__info +function:log__debug +function:log__warn +function:log__error +function:log__set_level +function:log__Log_log_stream +function:log__free_logger + +function:picoev__Picoev_poll_once +function:picoev__Picoev_set_timeout +function:picoev__Picoev_update_events +function:picoev__test_if_all_file_descriptors_are_properly_initialized + +function:vweb__tests__vweb_test_server__App_index +function:vweb__tests__vweb_test_server__start_in_background +function:vweb__RoutePair_test_param +function:veb__RoutePair_test_param +function:veb__test_load_files_translations + +## needed for tests; TODO: move the test specific setup code into its own separate VDO_tests function, so only it can be added here +function:main + +function:crypto__sha3__test_0_length_hash +function:crypto__sha3__test_0_length_xof +function:crypto__sha3__test_200_length_hash +function:crypto__sha3__test_200_length_xof + +function:crypto__sha3__test_2_x_24_rounds_on_zero +function:crypto__sha3__test_stepping_functions_on_zero +function:crypto__sha3__test_zero_state +function:crypto__sha3__test_rho_offsets +function:crypto__sha3__test_to_from_bytes +function:crypto__sha3__test_round_constants + +function:crypto__pem__test_decode_rfc1421 +function:crypto__pem__test_decode +function:crypto__pem__test_encode_rfc1421 +function:crypto__pem__test_encode + +function:crypto__hmac__test_hmac_equal +function:crypto__hmac__test_hmac_sha3_224 +function:crypto__hmac__test_hmac_sha3_256 +function:crypto__hmac__test_hmac_sha3_384 +function:crypto__hmac__test_hmac_sha3_512 +function:crypto__hmac__test_hmac_blake3_256 +function:crypto__hmac__test_hmac_blake2b_160 +function:crypto__hmac__test_hmac_blake2b_256 +function:crypto__hmac__test_hmac_blake2b_384 +function:crypto__hmac__test_hmac_blake2b_512 +function:crypto__hmac__test_hmac_blake2s_128 +function:crypto__hmac__test_hmac_blake2s_160 +function:crypto__hmac__test_hmac_blake2s_224 +function:crypto__hmac__test_hmac_blake2s_256 +function:crypto__hmac__test_hmac_sha512 +function:crypto__hmac__test_hmac_sha384 +function:crypto__hmac__test_hmac_sha256 +function:crypto__hmac__test_hmac_sha224 +function:crypto__hmac__test_hmac_sha1 +function:crypto__hmac__test_hmac_md5 + +function:crypto__ed25519__internal__edwards25519__sc_reduce +function:crypto__ed25519__internal__edwards25519__sc_reduce diff --git a/.github/workflows/sanitized_ci.yml b/.github/workflows/sanitized_ci.yml index 284befdfcc..2502c4de8c 100644 --- a/.github/workflows/sanitized_ci.yml +++ b/.github/workflows/sanitized_ci.yml @@ -71,17 +71,18 @@ on: - '**/sanitized_ci.yml' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: sanitized-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: tests-sanitize-undefined-clang: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 120 env: - VFLAGS: -cc clang + VFLAGS: -cc clang -cflags -fno-omit-frame-pointer VJOBS: 1 - VTEST_SHOW_START: 1 + UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_undefined.suppressions + VNATIVE_SKIP_LIBC_VV: 1 steps: - uses: actions/checkout@v4 - name: Build V @@ -97,17 +98,20 @@ jobs: - name: Recompile V with -cstrict run: ./v -cg -cstrict -o v cmd/v - name: Self tests (-fsanitize=undefined) - run: ./v -cflags "-fsanitize=undefined" -o v2 cmd/v && ./v2 -cflags -fsanitize=undefined test-self vlib + run: | + ./v -cflags -fsanitize=undefined -o v2 cmd/v + ./v2 -cflags -fsanitize=undefined test-self vlib - name: Build examples (V compiled with -fsanitize=undefined) run: ./v2 build-examples tests-sanitize-undefined-gcc: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 120 env: - VFLAGS: -cc gcc + VFLAGS: -cc gcc -cflags -fno-omit-frame-pointer VJOBS: 1 - VTEST_SHOW_START: 1 + UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_undefined.suppressions + VNATIVE_SKIP_LIBC_VV: 1 steps: - uses: actions/checkout@v4 - name: Build V @@ -122,17 +126,21 @@ jobs: - name: Recompile V with -cstrict run: ./v -cg -cstrict -o v cmd/v - name: Self tests (-fsanitize=undefined) - run: ./v -cflags "-fsanitize=undefined" -o v2 cmd/v && ./v2 -cflags -fsanitize=undefined test-self vlib + run: | + ./v -cflags -fsanitize=undefined -o v2 cmd/v + ./v2 -cflags -fsanitize=undefined test-self vlib - name: Build examples (V compiled with -fsanitize=undefined) run: ./v2 build-examples tests-sanitize-address-clang: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 300 env: - VFLAGS: -cc clang + VFLAGS: -cc clang -cflags -fno-omit-frame-pointer VJOBS: 1 - VTEST_SHOW_START: 1 + ASAN_OPTIONS: detect_leaks=1 + LSAN_OPTIONS: max_leaks=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_leak.suppressions + VNATIVE_SKIP_LIBC_VV: 1 steps: - uses: actions/checkout@v4 - name: Build V @@ -148,12 +156,13 @@ jobs: - name: Recompile V with -cstrict run: ./v -cg -cstrict -o v cmd/v - name: Self tests (-fsanitize=address) - run: ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=max_leaks=1:print_suppressions=0:suppressions=.github/workflows/run_sanitizers_leak.suppressions ./v -cflags "-fsanitize=address,pointer-compare,pointer-subtract" test-self vlib + run: ./v -cflags -fsanitize=address,pointer-compare,pointer-subtract test-self vlib - name: Self tests (V compiled with -fsanitize=address) - run: ./v -cflags -fsanitize=address -o v cmd/v && - ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=max_leaks=1:print_suppressions=0:suppressions=.github/workflows/run_sanitizers_leak.suppressions ./v -cc tcc test-self -asan-compiler vlib + run: | + ./v -cflags -fsanitize=address -o v cmd/v + ./v -cc tcc test-self -asan-compiler vlib - name: Build examples (V compiled with -fsanitize=address) - run: ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=max_leaks=1:print_suppressions=0:suppressions=.github/workflows/run_sanitizers_leak.suppressions ./v build-examples + run: ./v build-examples tests-sanitize-address-msvc: runs-on: windows-2019 @@ -161,7 +170,7 @@ jobs: env: VFLAGS: -cc msvc VJOBS: 1 - VTEST_SHOW_START: 1 + VNATIVE_SKIP_LIBC_VV: 1 steps: - uses: actions/checkout@v4 - name: Build @@ -180,12 +189,14 @@ jobs: # run: .\v.exe -cflags "/fsanitize=address" test-self vlib tests-sanitize-address-gcc: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 300 env: - VFLAGS: -cc gcc + VFLAGS: -cc gcc -cflags -fno-omit-frame-pointer VJOBS: 1 - VTEST_SHOW_START: 1 + ASAN_OPTIONS: detect_leaks=1 + LSAN_OPTIONS: max_leaks=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_leak.suppressions + VNATIVE_SKIP_LIBC_VV: 1 steps: - uses: actions/checkout@v4 - name: Build V @@ -201,21 +212,21 @@ jobs: - name: Recompile V with -cstrict run: ./v -cg -cstrict -o v cmd/v - name: Self tests (-fsanitize=address) - run: ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=max_leaks=1:print_suppressions=0:suppressions=.github/workflows/run_sanitizers_leak.suppressions ./v -cflags -fsanitize=address test-self vlib + run: ./v -cflags -fsanitize=address test-self vlib - name: Self tests (V compiled with -fsanitize=address) - run: - ./v -cflags -fsanitize=address,pointer-compare,pointer-subtract -o v cmd/v && - ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=max_leaks=1:print_suppressions=0:suppressions=.github/workflows/run_sanitizers_leak.suppressions ./v -cc tcc test-self -asan-compiler vlib + run: | + ./v -cflags -fsanitize=address,pointer-compare,pointer-subtract -o v cmd/v + ./v -cc tcc test-self -asan-compiler vlib - name: Build examples (V compiled with -fsanitize=address) - run: ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=max_leaks=1:print_suppressions=0:suppressions=.github/workflows/run_sanitizers_leak.suppressions ./v build-examples + run: ./v build-examples tests-sanitize-memory-clang: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 240 env: - VFLAGS: -cc clang -gc none + VFLAGS: -cc clang -gc none -cflags -fno-omit-frame-pointer VJOBS: 1 - VTEST_SHOW_START: 1 + VNATIVE_SKIP_LIBC_VV: 1 steps: - uses: actions/checkout@v4 - name: Build V @@ -231,7 +242,7 @@ jobs: - name: Recompile V with clang and -cstrict run: ./v -cc clang -cg -cstrict -o v cmd/v - name: Self tests (-fsanitize=memory) - run: ./v -cflags -fsanitize=memory test-self vlib + run: ./v -cflags -fsanitize=memory test-self -msan-compiler vlib - name: Self tests (V compiled with -fsanitize=memory) run: | ./v -cflags -fsanitize=memory -o v cmd/v diff --git a/.github/workflows/sdl_ci.yml b/.github/workflows/sdl_ci.yml index 3c631ceaac..74922bb02b 100644 --- a/.github/workflows/sdl_ci.yml +++ b/.github/workflows/sdl_ci.yml @@ -20,12 +20,12 @@ on: - '!**.md' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: sdl-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: v-compiles-sdl-examples: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 30 env: VFLAGS: -cc tcc diff --git a/.github/workflows/symlink_ci.yml b/.github/workflows/symlink_ci.yml index 588053c452..e388facd8a 100644 --- a/.github/workflows/symlink_ci.yml +++ b/.github/workflows/symlink_ci.yml @@ -12,7 +12,7 @@ on: - '.github/workflows/symlink_ci.yml' concurrency: - group: ${{ github.workflow }}-${{ github.ref_name == 'master' && github.sha || github.ref_name }} + group: symlink-${{ github.workflow }}-${{ github.ref_name == 'master' && github.sha || github.ref_name }} cancel-in-progress: true jobs: diff --git a/.github/workflows/time_ci.yml b/.github/workflows/time_ci.yml index 86c24604be..3c004396d1 100644 --- a/.github/workflows/time_ci.yml +++ b/.github/workflows/time_ci.yml @@ -15,7 +15,7 @@ on: - '!**.md' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: time-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/toml_ci.yml b/.github/workflows/toml_ci.yml index ed9a397173..5be976684a 100644 --- a/.github/workflows/toml_ci.yml +++ b/.github/workflows/toml_ci.yml @@ -13,7 +13,7 @@ on: - '!**.md' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: toml-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/tools_ci.yml b/.github/workflows/tools_ci.yml index 869425b974..5e9f3c8069 100644 --- a/.github/workflows/tools_ci.yml +++ b/.github/workflows/tools_ci.yml @@ -19,12 +19,12 @@ on: - '**/tools_ci.yml' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: tools-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: cc: [tcc, gcc, clang] @@ -47,19 +47,19 @@ jobs: - name: Test sanitized if: ${{ matrix.cc != 'tcc' }} run: | + export VNATIVE_SKIP_LIBC_VV=1 if [[ ${{ matrix.cc }} == "clang" ]]; then - cmd="./v -cc clang -cflags -fsanitize=undefined test-self cmd" + cmd="./v -cc clang -cflags -fsanitize=undefined test-self -ubsan-compiler cmd" echo $cmd && $cmd - cmd="./v -cc clang -cflags -fsanitize=memory test-self cmd" + cmd="./v -cc clang -cflags -fsanitize=memory test-self -msan-compiler cmd" echo $cmd && $cmd else - # TODO: enable thread sanitizer after switching to ubuntu-22.04. Ref. https://github.com/orgs/community/discussions/63391 - # cmd="./v -cc gcc -cflags -fsanitize=thread test-self cmd" - # echo $cmd && $cmd - cmd="./v -cc gcc -cflags -fsanitize=address,leak,undefined,shift,shift-exponent,shift-base,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,bounds-strict,alignment,object-size,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr test-self cmd/tools" + cmd="./v -cc gcc -cflags -fsanitize=thread test-self cmd" echo $cmd && $cmd - # cmd="./v -cc gcc -cflags -fsanitize=kernel-address test-self cmd" - # echo $cmd && $cmd + cmd="./v -cc gcc -cflags -fsanitize=address,leak,undefined,shift,shift-exponent,shift-base,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,bounds-strict,alignment,object-size,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr test-self -asan-compiler cmd/tools" + echo $cmd && $cmd + ## cmd="./v -cc gcc -cflags -fsanitize=kernel-address test-self -asan-compiler cmd" + ## echo $cmd && $cmd fi macos: @@ -102,7 +102,7 @@ jobs: run: ./v -W -cstrict test-self cmd tools-docker-ubuntu-musl: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 121 container: image: thevlang/vlang:ubuntu-build diff --git a/.github/workflows/v_apps_and_modules_compile_ci.yml b/.github/workflows/v_apps_and_modules_compile_ci.yml index 4ed27ebb7b..c045f93cdc 100644 --- a/.github/workflows/v_apps_and_modules_compile_ci.yml +++ b/.github/workflows/v_apps_and_modules_compile_ci.yml @@ -17,7 +17,7 @@ on: - 'cmd/tools/vrepl.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: v_apps-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/vab_ci.yml b/.github/workflows/vab_ci.yml index c184218799..329d5ffd7f 100644 --- a/.github/workflows/vab_ci.yml +++ b/.github/workflows/vab_ci.yml @@ -18,12 +18,12 @@ on: - '!**.md' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: vab-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: vab-compiles-v-examples: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 121 env: VAB_FLAGS: --api 30 --build-tools 29.0.0 -v 3 @@ -65,7 +65,7 @@ jobs: done v-compiles-os-android: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 20 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/vinix_ci.yml b/.github/workflows/vinix_ci.yml index 946d2244c7..b3f9901749 100644 --- a/.github/workflows/vinix_ci.yml +++ b/.github/workflows/vinix_ci.yml @@ -18,12 +18,12 @@ on: - 'cmd/tools/vrepl.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: vinix-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: vinix-build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 10 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/vpm_ci.yml b/.github/workflows/vpm_ci.yml index cc3d3b8716..e1ec834a5b 100644 --- a/.github/workflows/vpm_ci.yml +++ b/.github/workflows/vpm_ci.yml @@ -11,7 +11,7 @@ on: - '**/cmd/tools/vpm/**' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: vpm-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/vsl_and_vtl_compile_ci.yml b/.github/workflows/vsl_and_vtl_compile_ci.yml index 8000d4b747..2f78790708 100644 --- a/.github/workflows/vsl_and_vtl_compile_ci.yml +++ b/.github/workflows/vsl_and_vtl_compile_ci.yml @@ -17,7 +17,7 @@ on: - 'cmd/tools/vrepl.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: vsl-vtl-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/vup_works.yml b/.github/workflows/vup_works.yml index 1f3966d61b..fa74190cd3 100644 --- a/.github/workflows/vup_works.yml +++ b/.github/workflows/vup_works.yml @@ -21,7 +21,7 @@ on: - 'cmd/tools/vrepl.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: vup-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/wasm_backend_ci.yml b/.github/workflows/wasm_backend_ci.yml index ecda008c92..3186193ee1 100644 --- a/.github/workflows/wasm_backend_ci.yml +++ b/.github/workflows/wasm_backend_ci.yml @@ -39,7 +39,7 @@ on: - '**/wasm_backend_ci.yml' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: wasm-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/websockets_ci.yml b/.github/workflows/websockets_ci.yml index 46252ed885..7a4639abd9 100644 --- a/.github/workflows/websockets_ci.yml +++ b/.github/workflows/websockets_ci.yml @@ -17,12 +17,12 @@ on: - '!cmd/tools/builders/**.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: websockets-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: websocket_tests: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 121 env: VFLAGS: -cc tcc -no-retry-compilation diff --git a/.github/workflows/windows_ci.yml b/.github/workflows/windows_ci.yml index 07611fee00..bcfa244a19 100644 --- a/.github/workflows/windows_ci.yml +++ b/.github/workflows/windows_ci.yml @@ -20,7 +20,7 @@ on: - '!cmd/tools/builders/**.v' concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + group: windows-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} cancel-in-progress: true jobs: diff --git a/ci/linux_ci.vsh b/ci/linux_ci.vsh index f4dd6987c5..71d2b2302a 100644 --- a/ci/linux_ci.vsh +++ b/ci/linux_ci.vsh @@ -60,10 +60,10 @@ fn install_dependencies_for_examples_and_tools_tcc() { exec('v retry -- sudo apt install --quiet -y libssl-dev sqlite3 libsqlite3-dev valgrind') exec('v retry -- sudo apt install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev libxrandr-dev libasound2-dev') // The following is needed for examples/wkhtmltopdf.v - exec('v retry -- wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb') + exec('v retry -- wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb') exec('v retry -- sudo apt install --quiet -y xfonts-75dpi xfonts-base') exec('v retry -- sudo apt install --quiet -y expect') - exec('v retry -- sudo dpkg -i wkhtmltox_0.12.6-1.focal_amd64.deb') + exec('v retry -- sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb') } fn test_v_to_c_tcc() { diff --git a/cmd/tools/vcover/cover_test.v b/cmd/tools/vcover/cover_test.v index 6a2c6e9a2c..5873b273de 100644 --- a/cmd/tools/vcover/cover_test.v +++ b/cmd/tools/vcover/cover_test.v @@ -4,6 +4,10 @@ const vexe = @VEXE const vroot = os.dir(vexe) const tfolder = os.join_path(os.vtmp_dir(), 'cover_test') +const t1 = np(os.join_path(tfolder, 't1')) +const t2 = np(os.join_path(tfolder, 't2')) +const t3 = np(os.join_path(tfolder, 't3')) + fn testsuite_begin() { os.setenv('VCOLORS', 'never', true) os.chdir(vroot)! @@ -16,7 +20,7 @@ fn testsuite_end() { } fn test_help() { - res := os.execute('${os.quoted_path(vexe)} cover -h') + res := execute('${os.quoted_path(vexe)} cover -h') assert res.exit_code == 0 assert res.output.contains('Usage: v cover') assert res.output.contains('Description: Analyze & make reports') @@ -34,27 +38,20 @@ fn np(path string) string { } fn test_simple() { - // if true { - // return - //} - - t1 := np(os.join_path(tfolder, 't1')) - t2 := np(os.join_path(tfolder, 't2')) - t3 := np(os.join_path(tfolder, 't3')) assert !os.exists(t1), t1 assert !os.exists(t2), t2 assert !os.exists(t3), t3 - r1 := os.execute('${os.quoted_path(vexe)} -no-skip-unused -coverage ${os.quoted_path(t1)} cmd/tools/vcover/testdata/simple/t1_test.v') + r1 := execute('${os.quoted_path(vexe)} -no-skip-unused -coverage ${os.quoted_path(t1)} cmd/tools/vcover/testdata/simple/t1_test.v') assert r1.exit_code == 0, r1.str() assert r1.output.trim_space() == '10', r1.str() assert os.exists(t1), t1 cmd := '${os.quoted_path(vexe)} cover ${os.quoted_path(t1)} --filter vcover/testdata/simple/' - filter1 := os.execute(cmd) + filter1 := execute(cmd) assert filter1.exit_code == 0, filter1.output assert filter1.output.contains('cmd/tools/vcover/testdata/simple/simple.v'), filter1.output assert filter1.output.trim_space().ends_with('| 4 | 9 | 44.44%'), filter1.output - hfilter1 := os.execute('${os.quoted_path(vexe)} cover ${os.quoted_path(t1)} --filter vcover/testdata/simple/ -H -P false') + hfilter1 := execute('${os.quoted_path(vexe)} cover ${os.quoted_path(t1)} --filter vcover/testdata/simple/ -H -P false') assert hfilter1.exit_code == 0, hfilter1.output assert !hfilter1.output.contains('%'), hfilter1.output houtput1 := hfilter1.output.trim_space().split_into_lines() @@ -72,15 +69,15 @@ fn test_simple() { assert nzeros1.any(it.contains('simple.v:8')), nzeros1.str() assert nzeros1.any(it.contains('simple.v:25')), nzeros1.str() - r2 := os.execute('${os.quoted_path(vexe)} -no-skip-unused -coverage ${os.quoted_path(t2)} cmd/tools/vcover/testdata/simple/t2_test.v') + r2 := execute('${os.quoted_path(vexe)} -no-skip-unused -coverage ${os.quoted_path(t2)} cmd/tools/vcover/testdata/simple/t2_test.v') assert r2.exit_code == 0, r2.str() assert r2.output.trim_space() == '24', r2.str() assert os.exists(t2), t2 - filter2 := os.execute('${os.quoted_path(vexe)} cover ${os.quoted_path(t2)} --filter vcover/testdata/simple') + filter2 := execute('${os.quoted_path(vexe)} cover ${os.quoted_path(t2)} --filter vcover/testdata/simple') assert filter2.exit_code == 0, filter2.output assert filter2.output.contains('cmd/tools/vcover/testdata/simple/simple.v') assert filter2.output.trim_space().ends_with('| 6 | 9 | 66.67%'), filter2.output - hfilter2 := os.execute('${os.quoted_path(vexe)} cover ${os.quoted_path(t2)} --filter testdata/simple -H -P false') + hfilter2 := execute('${os.quoted_path(vexe)} cover ${os.quoted_path(t2)} --filter testdata/simple -H -P false') assert hfilter2.exit_code == 0, hfilter2.output assert !hfilter2.output.contains('%'), hfilter2.output houtput2 := hfilter2.output.trim_space().split_into_lines() @@ -97,12 +94,17 @@ fn test_simple() { assert nzeros2.any(it.contains('simple.v:25')), nzeros2.str() // Run both tests. The coverage should be combined and == 100% - r3 := os.execute('${os.quoted_path(vexe)} -no-skip-unused -coverage ${os.quoted_path(t3)} test cmd/tools/vcover/testdata/simple/') + r3 := execute('${os.quoted_path(vexe)} -no-skip-unused -coverage ${os.quoted_path(t3)} test cmd/tools/vcover/testdata/simple/') assert r3.exit_code == 0, r3.str() assert r3.output.trim_space().contains('Summary for all V _test.v files: '), r3.str() assert os.exists(t3), t3 - filter3 := os.execute('${os.quoted_path(vexe)} cover ${os.quoted_path(t3)} --filter simple/') + filter3 := execute('${os.quoted_path(vexe)} cover ${os.quoted_path(t3)} --filter simple/') assert filter3.exit_code == 0, filter3.str() assert filter3.output.contains('cmd/tools/vcover/testdata/simple/simple.v'), filter3.str() assert filter3.output.trim_space().match_glob('*cmd/tools/vcover/testdata/simple/simple.v *| 9 | 9 | 100.00%'), filter3.str() } + +fn execute(cmd string) os.Result { + eprintln('Executing: ${cmd}') + return os.execute(cmd) +} diff --git a/cmd/tools/vtest-self.v b/cmd/tools/vtest-self.v index 1d99749392..3a260b7cc6 100644 --- a/cmd/tools/vtest-self.v +++ b/cmd/tools/vtest-self.v @@ -11,9 +11,10 @@ struct Config { is_sandboxed_packaging bool = os.getenv('VTEST_SANDBOXED_PACKAGING') != '' github_job string = os.getenv('GITHUB_JOB') mut: - test_dirs []string = ['cmd', 'vlib'] - is_asan_compiler bool - is_msan_compiler bool + test_dirs []string = ['cmd', 'vlib'] + is_asan_compiler bool + is_msan_compiler bool + is_ubsan_compiler bool // Options relating to the v command itself (passed in the prefix) `v [...args] test-self`. werror bool sanitize_memory bool @@ -234,6 +235,9 @@ const skip_with_asan_compiler = [ const skip_with_msan_compiler = [ 'do_not_remove', ] +const skip_with_ubsan_compiler = [ + 'do_not_remove', +] const skip_on_musl = [ 'do_not_remove', 'vlib/v/slow_tests/profile/profile_test.v', @@ -396,6 +400,9 @@ fn Config.init(vargs []string, targs []string) !Config { '-msan-compiler', '--msan-compiler' { cfg.is_msan_compiler = true } + '-ubsan-compiler', '--ubsan-compiler' { + cfg.is_ubsan_compiler = true + } else { if arg.starts_with('-') { errs << 'error: unknown flag `${arg}`' @@ -465,7 +472,7 @@ fn main() { } if !cfg.run_slow_sanitize && ((cfg.sanitize_undefined || cfg.sanitize_memory || cfg.sanitize_address) - || (cfg.is_msan_compiler || cfg.is_asan_compiler)) { + || (cfg.is_msan_compiler || cfg.is_asan_compiler || cfg.is_ubsan_compiler)) { tsession.skip_files << skip_fsanitize_too_slow } if cfg.werror { @@ -486,6 +493,9 @@ fn main() { if cfg.is_msan_compiler { tsession.skip_files << skip_with_msan_compiler } + if cfg.is_ubsan_compiler { + tsession.skip_files << skip_with_ubsan_compiler + } if cfg.is_musl_ci { tsession.skip_files << skip_on_musl } diff --git a/vlib/builtin/cfns_wrapper.c.v b/vlib/builtin/cfns_wrapper.c.v index 2e46dc5e33..047947c08a 100644 --- a/vlib/builtin/cfns_wrapper.c.v +++ b/vlib/builtin/cfns_wrapper.c.v @@ -29,6 +29,9 @@ pub fn vmemcpy(dest voidptr, const_src voidptr, n isize) voidptr { print_backtrace() } } + if n == 0 { + return dest + } unsafe { return C.memcpy(dest, const_src, n) } @@ -44,6 +47,9 @@ pub fn vmemmove(dest voidptr, const_src voidptr, n isize) voidptr { $if trace_vmemmove ? { C.fprintf(C.stderr, c'vmemmove dest: %p src: %p n: %6ld\n', dest, const_src, n) } + if n == 0 { + return dest + } unsafe { return C.memmove(dest, const_src, n) } @@ -66,6 +72,9 @@ pub fn vmemcmp(const_s1 voidptr, const_s2 voidptr, n isize) int { $if trace_vmemcmp ? { C.fprintf(C.stderr, c'vmemcmp s1: %p s2: %p n: %6ld\n', const_s1, const_s2, n) } + if n == 0 { + return 0 + } unsafe { return C.memcmp(const_s1, const_s2, n) } @@ -85,6 +94,9 @@ pub fn vmemset(s voidptr, c int, n isize) voidptr { print_backtrace() } } + if n == 0 { + return s + } unsafe { return C.memset(s, c, n) } diff --git a/vlib/net/http/download_terminal_downloader.v b/vlib/net/http/download_terminal_downloader.v index e89eba75ae..edb33073ef 100644 --- a/vlib/net/http/download_terminal_downloader.v +++ b/vlib/net/http/download_terminal_downloader.v @@ -28,7 +28,11 @@ pub fn (mut d TerminalStreamingDownloader) on_chunk(request &Request, chunk []u8 d.past_time = now d.past_received = already_received ratio := f64(already_received) / f64(expected) - estimated := time.Duration(i64(f64(elapsed) / ratio)) + res := f64(elapsed) / ratio + mut estimated := time.Duration(max_i64) + if f64(min_i64) < res && res < f64(max_i64) { + estimated = i64(res) + } speed := f64(time.millisecond) * f64(already_received) / f64(elapsed) elapsed_s := elapsed.seconds() estimated_s := estimated.seconds() diff --git a/vlib/net/websocket/websocket_server.v b/vlib/net/websocket/websocket_server.v index 4fbd17f513..aa5db35432 100644 --- a/vlib/net/websocket/websocket_server.v +++ b/vlib/net/websocket/websocket_server.v @@ -206,12 +206,14 @@ fn (mut s Server) setup_callbacks(mut sc ServerClient) { } } // set standard close so we can remove client if closed - sc.client.on_close_ref(fn (mut c Client, code int, reason string, mut sc ServerClient) ! { - c.logger.debug('server-> Delete client') - lock sc.server.server_state { - sc.server.server_state.clients.delete(sc.client.id) - } - }, sc) + sc.client.on_close_ref(delete_client_cb, sc) +} + +fn delete_client_cb(mut c Client, code int, reason string, mut sc ServerClient) ! { + c.logger.debug('server-> Delete client') + lock sc.server.server_state { + sc.server.server_state.clients.delete(sc.client.id) + } } // accept_new_client creates a new client instance for client that connects to the socket diff --git a/vlib/net/websocket/websocket_test.v b/vlib/net/websocket/websocket_test.v index 82930b8efc..bd8496a47f 100644 --- a/vlib/net/websocket/websocket_test.v +++ b/vlib/net/websocket/websocket_test.v @@ -87,41 +87,46 @@ fn start_server_in_thread_and_wait_till_it_is_ready_to_accept_connections(mut ws eprintln('-----------------------------------------------------------------------------') } +fn open_cb(mut client websocket.Client) ! { + client.pong()! + assert true +} + +fn close_cb(mut client websocket.Client, err string) ! { + println('error: ${err}') + // this can be thrown by internet connection problems + assert false +} + +fn message_cb(mut client websocket.Client, msg &websocket.Message, mut res WebsocketTestResults) ! { + println('client got type: ${msg.opcode} payload:\n${msg.payload}') + if msg.opcode == .text_frame { + smessage := msg.payload.bytestr() + match smessage { + 'pong' { + res.nr_pong_received++ + } + 'a' { + res.nr_messages++ + } + else { + assert false + } + } + } else { + println('Binary message: ${msg}') + } +} + // ws_test tests connect to the websocket server from websocket client fn ws_test(family net.AddrFamily, uri string) ! { eprintln('connecting to ${uri} ...') mut test_results := WebsocketTestResults{} mut client := websocket.new_client(uri)! - client.on_open(fn (mut client websocket.Client) ! { - client.pong()! - assert true - }) - client.on_error(fn (mut client websocket.Client, err string) ! { - println('error: ${err}') - // this can be thrown by internet connection problems - assert false - }) - - client.on_message_ref(fn (mut client websocket.Client, msg &websocket.Message, mut res WebsocketTestResults) ! { - println('client got type: ${msg.opcode} payload:\n${msg.payload}') - if msg.opcode == .text_frame { - smessage := msg.payload.bytestr() - match smessage { - 'pong' { - res.nr_pong_received++ - } - 'a' { - res.nr_messages++ - } - else { - assert false - } - } - } else { - println('Binary message: ${msg}') - } - }, test_results) + client.on_open(open_cb) + client.on_error(close_cb) + client.on_message_ref(message_cb, test_results) client.connect()! spawn client.listen() @@ -140,17 +145,21 @@ fn ws_test(family net.AddrFamily, uri string) ! { assert test_results.nr_messages == 2 } +fn on_message_cb_2(mut cli websocket.Client, msg &websocket.Message) ! { + if msg.opcode == .text_frame { + cli.close(1000, 'closing connection')! + } +} + +fn on_close_cb_2(mut cli websocket.Client, code int, reason string, mut res WebsocketTestResults) ! { + res.nr_closes++ +} + fn test_on_close_when_server_closing_connection() ! { mut ws := websocket.new_server(.ip, 30003, '') - ws.on_message(fn (mut cli websocket.Client, msg &websocket.Message) ! { - if msg.opcode == .text_frame { - cli.close(1000, 'closing connection')! - } - }) + ws.on_message(on_message_cb_2) mut test_results := WebsocketTestResults{} - ws.on_close_ref(fn (mut cli websocket.Client, code int, reason string, mut res WebsocketTestResults) ! { - res.nr_closes++ - }, test_results) + ws.on_close_ref(on_close_cb_2, test_results) start_server_in_thread_and_wait_till_it_is_ready_to_accept_connections(mut ws) mut client := websocket.new_client('ws://localhost:30003')! @@ -162,15 +171,17 @@ fn test_on_close_when_server_closing_connection() ! { assert test_results.nr_closes == 1 } +fn on_close_cb_3(mut cli websocket.Client, code int, reason string, mut res WebsocketTestResults) ! { + res.nr_closes++ +} + fn test_on_close_when_client_closing_connection() ! { mut ws := websocket.new_server(.ip, 30004, '') start_server_in_thread_and_wait_till_it_is_ready_to_accept_connections(mut ws) mut client := websocket.new_client('ws://localhost:30004')! mut test_results := WebsocketTestResults{} - client.on_close_ref(fn (mut cli websocket.Client, code int, reason string, mut res WebsocketTestResults) ! { - res.nr_closes++ - }, test_results) + client.on_close_ref(on_close_cb_3, test_results) client.connect()! spawn client.listen() time.sleep(1000 * time.millisecond) diff --git a/vlib/v/checker/check_types.v b/vlib/v/checker/check_types.v index 78a6ab7f33..c4fcddc529 100644 --- a/vlib/v/checker/check_types.v +++ b/vlib/v/checker/check_types.v @@ -656,11 +656,13 @@ fn (mut c Checker) check_shift(mut node ast.InfixExpr, left_type_ ast.Type, righ node.right.pos()) return left_type } - if node.ct_left_value_evaled { - if lval := node.ct_left_value.i64() { - if lval < 0 { - c.error('invalid bitshift of a negative number', node.left.pos()) - return left_type + if !c.inside_unsafe { + if node.ct_left_value_evaled { + if lval := node.ct_left_value.i64() { + if lval < 0 { + c.error('invalid bitshift of a negative number', node.left.pos()) + return left_type + } } } } diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 41206fa1d7..18c9d4fa53 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -5249,7 +5249,7 @@ fn (mut g Gen) ident(node ast.Ident) { key := node.name g.write('/* obf identfn: ${key} */') name = g.obf_table[key] or { - panic('cgen: obf key name "${key}" not found, this should never happen') + panic('cgen: obf name "${key}" not found, this should never happen') } } } diff --git a/vlib/v/gen/c/cheaders.v b/vlib/v/gen/c/cheaders.v index fb9c228405..da700feb20 100644 --- a/vlib/v/gen/c/cheaders.v +++ b/vlib/v/gen/c/cheaders.v @@ -362,7 +362,11 @@ const c_common_macros = ' // for __offset_of #ifndef __offsetof +#if defined(__TINYC__) || defined(_MSC_VER) #define __offsetof(PTYPE,FIELDNAME) ((size_t)(&((PTYPE *)0)->FIELDNAME)) +#else + #define __offsetof(st, m) __builtin_offsetof(st, m) +#endif #endif #define OPTION_CAST(x) (x) diff --git a/vlib/v/gen/native/tests/native_test.v b/vlib/v/gen/native/tests/native_test.v index e1cd497e27..eead96eb3e 100644 --- a/vlib/v/gen/native/tests/native_test.v +++ b/vlib/v/gen/native/tests/native_test.v @@ -34,6 +34,13 @@ fn test_native() { } bench.set_total_expected_steps(tests.len) for test in tests { + if test == 'libc.vv' { + // TODO: remove the skip here, when the native backend is more advanced + if os.getenv('VNATIVE_SKIP_LIBC_VV') != '' { + println('>>> SKIPPING ${test} since VNATIVE_SKIP_LIBC_VV is defined') + continue + } + } bench.step() full_test_path := os.real_path(os.join_path(dir, test)) test_file_name := os.file_name(test) @@ -41,7 +48,7 @@ fn test_native() { work_test_path := os.join_path(wrkdir, test_file_name) exe_test_path := os.join_path(wrkdir, test_file_name + '.exe') tmperrfile := os.join_path(dir, test + '.tmperr') - cmd := '${os.quoted_path(vexe)} -o ${os.quoted_path(exe_test_path)} -b native -skip-unused ${os.quoted_path(full_test_path)} -d no_backtrace -d custom_define 2> ${os.quoted_path(tmperrfile)}' + cmd := '${os.quoted_path(vexe)} -o ${os.quoted_path(exe_test_path)} -b native ${os.quoted_path(full_test_path)} -d no_backtrace -d custom_define 2> ${os.quoted_path(tmperrfile)}' if is_verbose { println(cmd) } diff --git a/vlib/v/transformer/transformer.v b/vlib/v/transformer/transformer.v index 6f6c54204e..8eb2e32b11 100644 --- a/vlib/v/transformer/transformer.v +++ b/vlib/v/transformer/transformer.v @@ -925,7 +925,7 @@ pub fn (mut t Transformer) infix_expr(mut node ast.InfixExpr) ast.Expr { } .left_shift { return ast.IntegerLiteral{ - val: (u32(left_val) << right_val).str() + val: (unsafe { left_val << right_val }).str() pos: pos } } @@ -937,7 +937,7 @@ pub fn (mut t Transformer) infix_expr(mut node ast.InfixExpr) ast.Expr { } .unsigned_right_shift { return ast.IntegerLiteral{ - val: (left_val >>> right_val).str() + val: (u64(left_val) >>> right_val).str() pos: pos } } diff --git a/vlib/x/ttf/render_bmp.v b/vlib/x/ttf/render_bmp.v index ac089714c5..c15043b70b 100644 --- a/vlib/x/ttf/render_bmp.v +++ b/vlib/x/ttf/render_bmp.v @@ -291,19 +291,21 @@ pub fn (mut bmp BitMap) aline(in_x0 int, in_y0 int, in_x1 int, in_y1 int, c u32) mut y := y0 for y <= y1 + 0.5 { x := n * (y - y0) + x0 - e := f32(1 - math.abs(x - 0.5 - int(x))) - bmp.plot(int(x), int(y), color_multiply_alpha(c, f32(e * 0.75))) + if !math.is_nan(x) && !math.is_nan(y) { + e := f32(1 - math.abs(x - 0.5 - int(x))) + bmp.plot(int(x), int(y), color_multiply_alpha(c, f32(e * 0.75))) - xs1 := x + dist - if int(xs1) != int(x) { - v1 := math.abs(xs1 - x) / dist * (1 - e) - bmp.plot(int(xs1), int(y), color_multiply_alpha(c, f32(v1))) - } + xs1 := x + dist + if int(xs1) != int(x) { + v1 := math.abs(xs1 - x) / dist * (1 - e) + bmp.plot(int(xs1), int(y), color_multiply_alpha(c, f32(v1))) + } - xs2 := x - dist - if int(xs2) != int(x) { - v2 := math.abs(x - xs1) / dist * (1 - e) - bmp.plot(int(xs2), int(y), color_multiply_alpha(c, f32(v2))) + xs2 := x - dist + if int(xs2) != int(x) { + v2 := math.abs(x - xs1) / dist * (1 - e) + bmp.plot(int(xs2), int(y), color_multiply_alpha(c, f32(v2))) + } } y += 1.0 }