Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fix_interface_gener…
Browse files Browse the repository at this point in the history
…ic_2
  • Loading branch information
felipensp committed Sep 13, 2024
2 parents 4abe1ba + 56013a4 commit ba642a6
Show file tree
Hide file tree
Showing 352 changed files with 11,261 additions and 14,504 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/more_extensive_but_slower_tests_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: More extensive but slower tests

on:
push:
paths-ignore:
- '**.md'
- '**.yml'
- '!**/more_extensive_but_slower_tests_ci.yml'
- 'examples/**'
- 'cmd/tools/**'
pull_request:
paths-ignore:
- '**.md'
- '**.yml'
- '!**/more_extensive_but_slower_tests_ci.yml'
- 'examples/**'
- 'cmd/tools/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
cancel-in-progress: true

jobs:
more-tests:
strategy:
matrix:
os: [ubuntu-latest, macos-12, macos-14, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 121
steps:
- uses: actions/checkout@v4

- name: Build V
if: runner.os != 'Windows'
run: make -j4 && ./v symlink
- name: Build V (Windows)
if: runner.os == 'Windows'
run: ./make.bat && ./v symlink

- name: Run additional crypto tests
run: |
v retry -- git clone --depth 1 https://github.com/vlang/hash_validation_tests
v test hash_validation_tests/
2 changes: 1 addition & 1 deletion .github/workflows/release_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
find . -type d -name ".git" -exec rm -rf {} +
rm -rf vc/
rm -rf v_old
rm -rf vlib/v/tests/bench/gcboehm/*.svg
rm -rf vlib/v/tests/bench/gcboehm/*.svg.xz
- name: Create ZIP archive
shell: bash
run: |
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/v_apps_and_modules_compile_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ on:
- '**.md'
- '**.yml'
- '!**/v_apps_and_modules_compile_ci.yml'
- 'examples/**'
- 'cmd/tools/vrepl.v'
pull_request:
paths-ignore:
- '**.md'
- '**.yml'
- '!**/v_apps_and_modules_compile_ci.yml'
- 'examples/**'
- 'cmd/tools/vrepl.v'

concurrency:
Expand Down Expand Up @@ -155,18 +157,18 @@ jobs:
echo "Build v-analyzer release"
v build.vsh release
- name: Format vlang/v-analyzer
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
run: |
cd /tmp/v-analyzer
set +e
v fmt -c .
exit_code=$?
if [[ $exit_code -ne 0 && $exit_code -ne 5 ]]; then
# Don't fail if there are only internal errors (exit code 5).
v fmt -diff .
exit 1
fi
# - name: Format vlang/v-analyzer
# if: ${{ !cancelled() && steps.build.outcome == 'success' }}
# run: |
# cd /tmp/v-analyzer
# set +e
# v fmt -c .
# exit_code=$?
# if [[ $exit_code -ne 0 && $exit_code -ne 5 ]]; then
# # Don't fail if there are only internal errors (exit code 5).
# v fmt -diff .
# exit 1
# fi

- name: Build vlang/go2v
if: ${{ !cancelled() && steps.build.outcome == 'success' && matrix.os != 'macos-14' }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/workflow_lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Workflow Lint

## Note: to install `prettier` locally, see https://prettier.io/docs/en/install,
## or just: `npm install --save-dev --save-exact prettier`

## If you already have `prettier` installed, to run it locally,
## just run: `npx prettier --check **.yml` .

on:
push:
paths:
Expand All @@ -16,4 +22,4 @@ jobs:
- name: Verify formatting
uses: creyD/[email protected]
with:
prettier_options: --check .github/**/**.yml
prettier_options: --check **.yml
8 changes: 4 additions & 4 deletions cmd/tools/modules/scripting/scripting.v
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn set_verbose(on bool) {

pub fn cprint(omessage string) {
mut message := omessage
if scripting.term_colors {
if term_colors {
message = term.cyan(message)
}
print(message)
Expand All @@ -27,7 +27,7 @@ pub fn cprint(omessage string) {

pub fn cprint_strong(omessage string) {
mut message := omessage
if scripting.term_colors {
if term_colors {
message = term.bright_green(message)
}
print(message)
Expand Down Expand Up @@ -57,7 +57,7 @@ pub fn verbose_trace_strong(label string, omessage string) {
if os.getenv('VERBOSE').len > 0 {
slabel := '${time.now().format_ss_milli()} ${label}'
mut message := omessage
if scripting.term_colors {
if term_colors {
message = term.bright_green(message)
}
cprintln('# ${slabel:-43s} : ${message}')
Expand All @@ -71,7 +71,7 @@ pub fn verbose_trace_exec_result(x os.Result) {
lines := x.output.split_into_lines()
for oline in lines {
mut line := oline
if scripting.term_colors {
if term_colors {
line = term.bright_green(line)
}
cprintln('# ${lnum:3d}: ${line}')
Expand Down
44 changes: 22 additions & 22 deletions cmd/tools/modules/testing/common.v
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,13 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
skip_files << 'examples/pendulum-simulation/parallel.v'
skip_files << 'examples/pendulum-simulation/parallel_with_iw.v'
skip_files << 'examples/pendulum-simulation/sequential.v'
if testing.github_job == 'tcc' {
if github_job == 'tcc' {
// TODO: fix these by adding declarations for the missing functions in the prebuilt tcc
skip_files << 'vlib/net/mbedtls/mbedtls_compiles_test.v'
skip_files << 'vlib/net/ssl/ssl_compiles_test.v'
}
}
if testing.runner_os != 'Linux' || testing.github_job != 'tcc' {
if runner_os != 'Linux' || github_job != 'tcc' {
if !os.exists('/usr/local/include/wkhtmltox/pdf.h') {
skip_files << 'examples/c_interop_wkhtmltopdf.v' // needs installation of wkhtmltopdf from https://github.com/wkhtmltopdf/packaging/releases
}
Expand All @@ -275,16 +275,16 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
$if !macos {
skip_files << 'examples/macos_tray/tray.v'
}
if testing.github_job == 'ubuntu-docker-musl' {
if github_job == 'ubuntu-docker-musl' {
skip_files << 'vlib/net/openssl/openssl_compiles_test.c.v'
skip_files << 'vlib/x/ttf/ttf_test.v'
}
if testing.github_job == 'tests-sanitize-memory-clang' {
if github_job == 'tests-sanitize-memory-clang' {
skip_files << 'vlib/net/openssl/openssl_compiles_test.c.v'
// Fails compilation with: `/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line`
skip_files << 'examples/sokol/sounds/simple_sin_tones.v'
}
if testing.github_job != 'misc-tooling' {
if github_job != 'misc-tooling' {
// These examples need .h files that are produced from the supplied .glsl files,
// using by the shader compiler tools in https://github.com/floooh/sokol-tools-bin/archive/pre-feb2021-api-changes.tar.gz
skip_files << 'examples/sokol/02_cubes_glsl/cube_glsl.v'
Expand Down Expand Up @@ -313,7 +313,7 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
vexe: vexe
vroot: vroot
skip_files: skip_files
fail_fast: testing.fail_fast
fail_fast: fail_fast
show_stats: '-stats' in vargs.split(' ')
show_asserts: '-show-asserts' in vargs.split(' ')
vargs: vargs
Expand Down Expand Up @@ -396,14 +396,14 @@ pub fn (mut ts TestSession) test() {
// Special case for android_outside_termux because of its
// underscores
if file.ends_with('_android_outside_termux_test.v') {
if !testing.host_os.is_target_of('android_outside_termux') {
if !host_os.is_target_of('android_outside_termux') {
remaining_files << dot_relative_file
ts.skip_files << file
continue
}
}
os_target := file.all_before_last('_test.v').all_after_last('_')
if !testing.host_os.is_target_of(os_target) {
if !host_os.is_target_of(os_target) {
remaining_files << dot_relative_file
ts.skip_files << file
continue
Expand Down Expand Up @@ -553,7 +553,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
if !ts.build_tools && abs_path in ts.skip_files {
ts.benchmark.skip()
tls_bench.skip()
if !testing.hide_skips {
if !hide_skips {
ts.append_message(.skip, tls_bench.step_message_with_label_and_duration(benchmark.b_skip,
normalised_relative_file, 0,
preparation: 1 * time.microsecond
Expand Down Expand Up @@ -597,9 +597,9 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
goto test_passed_system
}
}
time.sleep(testing.fail_retry_delay_ms)
time.sleep(fail_retry_delay_ms)
}
if details.flaky && !testing.fail_flaky {
if details.flaky && !fail_flaky {
ts.append_message(.info, ' *FAILURE* of the known flaky test file ${relative_file} is ignored, since VTEST_FAIL_FLAKY is 0 . Retry count: ${details.retry} .\ncmd: ${cmd}',
mtc)
unsafe {
Expand All @@ -616,14 +616,14 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
return pool.no_result
}
} else {
if testing.show_start {
if show_start {
ts.append_message(.info, ' starting ${relative_file} ...',
mtc)
}
ts.append_message(.compile_begin, cmd, mtc)
compile_d_cmd := time.new_stopwatch()
mut compile_r := os.Result{}
for cretry in 0 .. testing.max_compilation_retries {
for cretry in 0 .. max_compilation_retries {
compile_r = os.execute(cmd)
compile_cmd_duration = compile_d_cmd.elapsed()
// eprintln('>>>> cretry: $cretry | compile_r.exit_code: $compile_r.exit_code | compile_cmd_duration: ${compile_cmd_duration:8} | file: $normalised_relative_file')
Expand Down Expand Up @@ -670,7 +670,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
// retry running at least 1 more time, to avoid CI false positives as much as possible
details.retry++
}
failure_output.write_string(testing.separator)
failure_output.write_string(separator)
failure_output.writeln(' retry: 0 ; max_retry: ${details.retry} ; r.exit_code: ${r.exit_code} ; trimmed_output.len: ${trimmed_output.len}')
failure_output.writeln(trimmed_output)
os.setenv('VTEST_RETRY_MAX', '${details.retry}', true)
Expand All @@ -691,13 +691,13 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
}
trimmed_output = r.output.trim_space()
failure_output.write_string(testing.separator)
failure_output.write_string(separator)
failure_output.writeln(' retry: ${retry} ; max_retry: ${details.retry} ; r.exit_code: ${r.exit_code} ; trimmed_output.len: ${trimmed_output.len}')
failure_output.writeln(trimmed_output)
time.sleep(testing.fail_retry_delay_ms)
time.sleep(fail_retry_delay_ms)
}
full_failure_output := failure_output.str().trim_space()
if details.flaky && !testing.fail_flaky {
if details.flaky && !fail_flaky {
ts.append_message(.info, ' *FAILURE* of the known flaky test file ${relative_file} is ignored, since VTEST_FAIL_FLAKY is 0 . Retry count: ${details.retry} .\n comp_cmd: ${cmd}\n run_cmd: ${run_cmd}',
mtc)
unsafe {
Expand All @@ -706,7 +706,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
ts.benchmark.fail()
tls_bench.fail()
cmd_duration = d_cmd.elapsed() - (testing.fail_retry_delay_ms * details.retry)
cmd_duration = d_cmd.elapsed() - (fail_retry_delay_ms * details.retry)
ts.append_message_with_duration(.fail, tls_bench.step_message_with_label_and_duration(benchmark.b_fail,
'${normalised_relative_file}\n retry: ${retry}\n comp_cmd: ${cmd}\n run_cmd: ${run_cmd}\nfailure code: ${r.exit_code}; foutput.len: ${full_failure_output.len}; failure output:\n${full_failure_output}',
cmd_duration,
Expand All @@ -720,7 +720,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
test_passed_execute:
ts.benchmark.ok()
tls_bench.ok()
if !testing.hide_oks {
if !hide_oks {
ts.append_message_with_duration(.ok, tls_bench.step_message_with_label_and_duration(benchmark.b_ok,
normalised_relative_file, cmd_duration,
preparation: compile_cmd_duration
Expand Down Expand Up @@ -769,7 +769,7 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main
}
}
c := os.read_file(fnormalised) or { panic(err) }
start := c#[0..testing.header_bytes_to_search_for_module_main]
start := c#[0..header_bytes_to_search_for_module_main]
if start.contains('module ') && !start.contains('module main') {
skipped << fnormalised.replace(nparent_dir + '/', '')
continue next_file
Expand Down Expand Up @@ -834,7 +834,7 @@ pub fn building_any_v_binaries_failed() bool {
continue
}
bmark.ok()
if !testing.hide_oks {
if !hide_oks {
eprintln(bmark.step_message_ok('command: ${cmd}'))
}
}
Expand Down Expand Up @@ -875,7 +875,7 @@ pub fn get_test_details(file string) TestDetails {
}

pub fn find_started_process(pname string) !string {
for line in testing.all_processes {
for line in all_processes {
if line.contains(pname) {
return line
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/tools/modules/testing/output_normal.v
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ pub fn (r NormalReporter) progress(index int, message string) {
// in progress mode, the last line will be rewritten many times, and does not end with \n
// the \n will be printed just once when some progress has been made.
pub fn (r NormalReporter) update_last_line(index int, message string) {
print('\r${testing.empty}\r${message}')
print('\r${empty}\r${message}')
flush_stdout()
}

pub fn (r NormalReporter) update_last_line_and_move_to_next(index int, message string) {
// the last \n is needed, so SKIP/FAIL messages
// will not get overwritten by the OK ones
eprint('\r${testing.empty}\r${message}\n')
eprint('\r${empty}\r${message}\n')
}

pub fn (r NormalReporter) message(index int, message string) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vdoc/html.v
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ fn (f &MdHtmlCodeHighlighter) transform_attribute(p markdown.ParentType, name st
fn (f &MdHtmlCodeHighlighter) transform_content(parent markdown.ParentType, text string) string {
if parent is markdown.MD_BLOCKTYPE && parent == .md_block_code {
if f.language == '' {
return text
return html.escape(text)
}
output := html_highlight(text, f.table)
// Reset the language, so that it will not persist between blocks,
Expand Down
10 changes: 10 additions & 0 deletions cmd/tools/vdoc/testdata/output_formats/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,14 @@ A code block without a specific language should be rendered verbatim:
└── main.v
```

The s tags here in the code block, should be rendered verbatim, not interpreted as HTML ones:
```
h:m:s // 5:02:33
m:s.mi<s> // 2:33.015
s.mi<s> // 33.015s
mi.mc<ms> // 15.007ms
mc.ns<ns> // 7.234us
ns<ns> // 234ns
```

The End.
18 changes: 18 additions & 0 deletions cmd/tools/vdoc/testdata/output_formats/main.ansi
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ A code block without a specific language should be rendered verbatim:
│ └── main.js
└── main.v

The s tags here in the code block, should be rendered verbatim, not interpreted as HTML ones:
h:m:s // 5:02:33
m:s.mi<s> // 2:33.015
s.mi<s> // 33.015s
mi.mc<ms> // 15.007ms
mc.ns<ns> // 7.234us
ns<ns> // 234ns

The End.
module main
## Description
Expand Down Expand Up @@ -281,6 +289,16 @@ The End.
└── main.v
```

The s tags here in the code block, should be rendered verbatim, not interpreted as HTML ones:
```
h:m:s // 5:02:33
m:s.mi<s> // 2:33.015
s.mi<s> // 33.015s
mi.mc<ms> // 15.007ms
mc.ns<ns> // 7.234us
ns<ns> // 234ns
```

The End.

const omega = 3 // should be first
Expand Down
Loading

0 comments on commit ba642a6

Please sign in to comment.