119 Commits

Author SHA1 Message Date
Zygmunt Krynicki
b30c3f564e tests: document unit/shell-traps (tweaks)
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2024-04-22 14:06:26 +02:00
Zygmunt Krynicki
be8b04db6f tests: document unit/go
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2024-04-22 14:06:26 +02:00
Zygmunt Krynicki
e9521f0164 tests: document unit/c-unit-tests-gcc
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2024-04-22 14:06:26 +02:00
Zygmunt Krynicki
cc59872ce0 tests: document unit/c-unit-tests-clang
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2024-04-22 14:06:26 +02:00
Maciej Borzecki
bbcb6d5e15 tests/unit/go: skip the clang variant on 14.04
The 14.04 build is using a github.com/mvo5/libseccomp-golang fork, which is even
further behind on fixes, that combined with clang being picky fails the build
like so

../../../../pkg/mod/github.com/mvo5/libseccomp-golang@v0.9.1-0.20180308152521-f4de83b52afb/seccomp_internal.go:404:2: duplicate case _Ciconst_C_ARCH_MIPS (value 4294967295) in switch
	previous case at $WORK/b338/_cgo_gotypes.go:75:7
../../../../pkg/mod/github.com/mvo5/libseccomp-golang@v0.9.1-0.20180308152521-f4de83b52afb/seccomp_internal.go:406:2: duplicate case _Ciconst_C_ARCH_MIPS64 (value 4294967295) in switch
	previous case at $WORK/b338/_cgo_gotypes.go:75:7
../../../../pkg/mod/github.com/mvo5/libseccomp-golang@v0.9.1-0.20180308152521-f4de83b52afb/seccomp_internal.go:408:2: duplicate case _Ciconst_C_ARCH_MIPS64N32 (value 4294967295) in switch
	previous case at $WORK/b338/_cgo_gotypes.go:75:7
../../../../pkg/mod/github.com/mvo5/libseccomp-golang@v0.9.1-0.20180308152521-f4de83b52afb/seccomp_internal.go:410:2: duplicate case _Ciconst_C_ARCH_MIPSEL (value 4294967295) in switch
	previous case at $WORK/b338/_cgo_gotypes.go:75:7
../../../../pkg/mod/github.com/mvo5/libseccomp-golang@v0.9.1-0.20180308152521-f4de83b52afb/seccomp_internal.go:412:2: duplicate case _Ciconst_C_ARCH_MIPSEL64 (value 4294967295) in switch
	previous case at $WORK/b338/_cgo_gotypes.go:75:7
../../../../pkg/mod/github.com/mvo5/libseccomp-golang@v0.9.1-0.20180308152521-f4de83b52afb/seccomp_internal.go:414:2: duplicate case _Ciconst_C_ARCH_MIPSEL64N32 (value 4294967295) in switch
	previous case at $WORK/b338/_cgo_gotypes.go:75:7
../../../../pkg/mod/github.com/mvo5/libseccomp-golang@v0.9.1-0.20180308152521-f4de83b52afb/seccomp_internal.go:416:2: duplicate case _Ciconst_C_ARCH_PPC (value 4294967295) in switch
	previous case at $WORK/b338/_cgo_gotypes.go:75:7
../../../../pkg/mod/github.com/mvo5/libseccomp-golang@v0.9.1-0.20180308152521-f4de83b52afb/seccomp_internal.go:418:2: duplicate case _Ciconst_C_ARCH_PPC64 (value 4294967295) in switch
	previous case at $WORK/b338/_cgo_gotypes.go:75:7
../../../../pkg/mod/github.com/mvo5/libseccomp-golang@v0.9.1-0.20180308152521-f4de83b52afb/seccomp_internal.go:420:2: duplicate case _Ciconst_C_ARCH_PPC64LE (value 4294967295) in switch
	previous case at $WORK/b338/_cgo_gotypes.go:75:7
../../../../pkg/mod/github.com/mvo5/libseccomp-golang@v0.9.1-0.20180308152521-f4de83b52afb/seccomp_internal.go:422:2: duplicate case _Ciconst_C_ARCH_S390 (value 4294967295) in switch
	previous case at $WORK/b338/_cgo_gotypes.go:75:7
../../../../pkg/mod/github.com/mvo5/libseccomp-golang@v0.9.1-0.20180308152521-f4de83b52afb/seccomp_internal.go:422:2: too many errors

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-05-10 10:35:57 +02:00
Maciej Borzecki
9d24d34786 tests/unit/go: use a fork of libseccomp on 14.04
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-05-09 13:37:10 +02:00
Maciej Borzecki
5dfd31608c tests/unit/go: split up static and unit tests, execute unit tests with clang and gcc
Since some parts of the code depend on 3rd party packages which pull in C
support, execute the unit tests with different compilers to catch possible build
issues.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-05-09 09:38:21 +02:00
Valentin David
11a4cae5a2 .github: Skip misspell and ineffassign on go 1.13
A change in golang.org/x/sys broke build of misspell and ineffassign
on go 1.13.
2022-05-03 14:29:56 +02:00
Paweł Stołowski
bb52a67991 Renaming related to inclusive language. 2022-04-14 14:30:47 +02:00
Dimitri John Ledkov
c6b8ebc339 shellcheck 2021-10-12 13:04:50 +01:00
Dimitri John Ledkov
ef5832d87c Fix ups for testing trusty 2021-10-11 14:19:25 +01:00
Michael Vogt
11761f055c tests: run go unit tets with go.mod 2021-08-17 22:34:12 +02:00
Sergio Cazzolato
2a0fb80b73 Fix wording and parameters for the format checker 2021-05-28 09:30:37 -03:00
Sergio Cazzolato
1d1fbdedcb Skip static check for tests when running unit/go taks
This is to avoid installing python deps on all the machines where this
is executed.
2021-04-20 17:36:55 -03:00
Sergio Cazzolato
46a2788c75 Update layout for tests - part 2
The change updates the layout of the tests following a proposed order
which should make the test easier to read and understand

The proposed order is:
summary
details

backends
systems

manual
priority
warn-timeout
kill-timeout

environment
prepare
restore
debug
execute
2021-04-08 18:05:54 -03:00
Sergio Cazzolato
29aa7f4157 Updated restore phase of spread tests
Changes included:
 . removed lines used to delete files/dirs in $PWD
 . ordered the tests 1. prepare 2. restore 3.debug 4.execute
 . new lines added between phases
 . removed lines which make snap remove in restore

This is the first part of the change
2021-03-30 16:41:59 -03:00
Maciej Borzecki
ccac9ee0f1 tests/unit/go: fix formatting
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-03-05 08:26:39 +01:00
Maciej Borzecki
d6e50d7749 Merge remote-tracking branch 'upstream/master' into bboozzoo/fix-dbus-misdetected-stray 2021-03-05 08:26:06 +01:00
Maciej Borzecki
4866400587 tests/unit/go: use su for running unit tests on 14.04
The tests.session helper requires busctl which is not available on 14.04,
however we still want to run tests on those systems.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-03-04 09:31:37 +01:00
Ian Johnson
8579d563e8 tests/unit/go: turn off modules for spread test which runs the unit tests too
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-03-02 20:10:06 -06:00
Maciej Borzecki
abe3d11514 tests/unit/go: use tests.session wrapper for running tests as a user
We occasionally see the tests invariant check incorrectly pick up a 'test' user
session dbus:

2021-03-01T08:55:18.3295048Z tests.invariant: root-files-in-home ok
2021-03-01T08:55:18.3296599Z tests.invariant: crashed-snap-confine ok
2021-03-01T08:55:18.3298081Z tests.invariant: lxcfs-mounted ok
2021-03-01T08:55:18.3299546Z tests.invariant: more than one dbus-daemon running
2021-03-01T08:55:18.3301790Z pid:67160 user:test cmdline:/usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
2021-03-01T08:55:18.3303861Z tests.invariant: stray-dbus-daemon not-ok
2021-03-01T08:55:18.3305558Z tests.invariant: leftover-defer-sh ok
2021-03-01T08:55:18.3306643Z tests.invariant: system is corrupted

Use the tests.session wrapper for running things as the 'test' user so that we
can ensure a proper session cleanup afterwards.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-03-02 09:34:28 +01:00
Maciej Borzecki
dfcab5d808 tests/unit/go: remove remaining TRAVIS environment variables
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-01-29 13:03:38 +01:00
Maciej Borzecki
13b2c83797 tests/unit/go: drop unused environment variables, skip coverage
Drop a number of TRAVIS_* flags that are no longer used. Skip coverage
collection, since it's not really useful now.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-01-29 12:41:11 +01:00
Sergio Cazzolato
7db34d5fa5 Use os.query tool instead of comparing the system var 2020-12-02 18:04:34 -03:00
Maciej Borzecki
741c50b0e8 tests/unit/spread-shellcheck: remove the test, spread-shellcheck is part of run-checks
Drop the test, which has become unnecessary and duplicates work. The invocation
so spread-shellcheck is part of run-checks which gets executed in tests/unit/go.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2020-10-13 09:47:53 +02:00