Skip to content

Commit

Permalink
ci, tests: ignore notice: in error tests more gracefully (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon authored Sep 21, 2024
1 parent 154d20e commit b02745c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/matrix_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions tests/vab_error_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit b02745c

Please sign in to comment.