Skip to content

Commit

Permalink
src: Assign tests to test suites
Browse files Browse the repository at this point in the history
The project already has a number of different tests plugged into the
build system. To have greater control over which tests are executed,
assign them into different suites. 'linting' for formatting and linting
and 'unit' for unit tests and generally self-contained tests testing
a small portion of Toolbx. Also, in a follow-up commit the system tests
will be plugged into Meson and having a way of running only some of the
tests will be needed.

#1062
  • Loading branch information
HarryMichal committed Sep 30, 2023
1 parent 540b13c commit 7a44a81
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
9 changes: 7 additions & 2 deletions playbooks/unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
tasks:
- include_tasks: build.yaml

- name: Test
command: meson test -C builddir --verbose
- name: Linting tests
command: meson test -C builddir --verbose --suite linting
args:
chdir: '{{ zuul.project.src_dir }}'

- name: Unit tests
command: meson test -C builddir --verbose --suite unit
args:
chdir: '{{ zuul.project.src_dir }}'
32 changes: 28 additions & 4 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,33 @@ custom_target(
)

if shellcheck.found()
test('shellcheck src/go-build-wrapper', shellcheck, args: [go_build_wrapper_file])
test(
'shellcheck go-build-wrapper',
shellcheck,
args: [go_build_wrapper_file],
suite: 'linting'
)
endif

test('go fmt', meson_go_fmt_program, args: [meson.current_source_dir()])
test('go vet', go, args: ['vet', '-c', '3', './...'], workdir: meson.current_source_dir())
test('go test', go, args: ['test', '-vet', 'off', './...'], workdir: meson.current_source_dir())
test(
'go fmt',
meson_go_fmt_program,
args: [meson.current_source_dir()],
suite: 'linting'
)

test(
'go vet',
go,
args: ['vet', '-c', '3', './...'],
suite: 'linting',
workdir: meson.current_source_dir()
)

test(
'go test',
go,
args: ['test', '-vet', 'off', './...'],
suite: 'unit',
workdir: meson.current_source_dir()
)

0 comments on commit 7a44a81

Please sign in to comment.