From b02745c94a5d988f98b3030ed8074ef5fd0ae81f Mon Sep 17 00:00:00 2001 From: larpon <768942+larpon@users.noreply.github.com> Date: Sat, 21 Sep 2024 11:25:03 +0200 Subject: [PATCH] ci, tests: ignore `notice:` in error tests more gracefully (#311) --- .github/workflows/ci.yml | 4 ---- .github/workflows/matrix_ci.yml | 3 --- tests/vab_error_test.v | 20 ++++++++++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c23b4945..ebb74b31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 env: - VFLAGS: -d vab_no_notices VAB_FLAGS: -v 3 steps: - name: Checkout V @@ -126,7 +125,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 env: - VFLAGS: -d vab_no_notices VAB_FLAGS: -v 3 steps: - name: Checkout V @@ -189,7 +187,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 env: - VFLAGS: -d vab_no_notices VAB_FLAGS: -v 3 steps: - name: Checkout V @@ -269,7 +266,6 @@ jobs: runs-on: windows-latest timeout-minutes: 10 env: - VFLAGS: -d vab_no_notices VAB_FLAGS: -cg -v 3 --api 31 --build-tools 30.0.3 steps: diff --git a/.github/workflows/matrix_ci.yml b/.github/workflows/matrix_ci.yml index 7b77b0b8..f28d0737 100644 --- a/.github/workflows/matrix_ci.yml +++ b/.github/workflows/matrix_ci.yml @@ -23,7 +23,6 @@ jobs: fail-fast: false timeout-minutes: 20 env: - VFLAGS: -d vab_no_notices VAB_FLAGS: -v 3 --build-tools 29.0.0 steps: - uses: actions/setup-java@v4 @@ -102,7 +101,6 @@ jobs: fail-fast: false timeout-minutes: 20 env: - VFLAGS: -d vab_no_notices VAB_FLAGS: -v 3 -gc none --build-tools 29.0.0 steps: - uses: actions/setup-java@v4 @@ -168,7 +166,6 @@ jobs: fail-fast: false timeout-minutes: 20 env: - VFLAGS: -d vab_no_notices VAB_FLAGS: -v 3 --build-tools 29.0.0 steps: - uses: actions/setup-java@v4 diff --git a/tests/vab_error_test.v b/tests/vab_error_test.v index dbf80012..7c6ba129 100644 --- a/tests/vab_error_test.v +++ b/tests/vab_error_test.v @@ -97,6 +97,7 @@ fn sync_run(job TOMLTestJob) &TOMLTestJobResult { }.string() expect_exit_code := doc.value('expect.exit_code').default_to(0).int() diff_from_line := doc.value('compare.output.from_line').default_to(0).int() + ignore_lines_starting_with := ['notice:', 'details:', ' '] expected_out_path := job.job_file.replace('.toml', '.out') @@ -126,6 +127,25 @@ fn sync_run(job TOMLTestJob) &TOMLTestJobResult { } } + if ignore_lines_starting_with.len > 0 { + mut filtered := []string{} + for line in found.split_into_lines() { + mut ignore := false + for ignore_string in ignore_lines_starting_with { + if line.starts_with(ignore_string) { + ignore = true + break + } + } + if !ignore { + filtered << line + } else { + println('ignoring line "${line}"') + } + } + found = filtered.join('\n') + } + success := expected == found && res.exit_code == expect_exit_code if expected != found {