To build: meson build && ninja -C build
To run tests: ninja -C build check
To install for packaging: DESTDIR=/var/tmp/inst ninja -C build install
To install for realz: sudo ninja -C build install
v2:
- Optional items are now based on the 'feature' feature in meson.
Built libraries which are disabled turn into disabler() objects
and also poison any executables which link to them.
What is there:
- building of the binaries and libs and the python module
- installation of binaries, libs, python module, localization files,
man pages, pkgconfig files
- running of tests
- most options to configure build equivalently to the
./configure settings
Partially implemented:
- disabling of stuff when things missing. In the C code, the defines
are all used, so that should be fine. In the build system, some
files should be skipped, but that is probably not always done properly.
Getting this right might require some testing of various build option
combinations to get the details right.
Not implemented:
- static builds of fdisk and other binaries
- things marked with XXX or FIXME
- ???
Differences:
- .la files are not created. They are useless and everybody hates them.
- Requires.private in pkgconfig files are not present in the
autogenerated .pc file. Not sure if they should be there or not. If
necessary, they can be added by hand.
- man pages and systemd units are installed by the install target. Not
sure why 'make install' doesn't do that.
- the split between / and /usr is probably wrong. But it's all pointless
anyway, so maybe we could simplify things but not implementing it at
all under meson?
All `eject` tests were failing under ASan, since they call /bin/mount,
which is uninstrumented, but it picks up the instrumented `libblkid`
library, causing ASan to complain:
gcc:
ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
eject: unmount of `/home/runner/work/util-linux/util-linux/tests/output/eject/umount-by-disk-mounted-mnt' failed
clang:
/bin/umount: symbol lookup error: /home/runner/work/util-linux/util-linux/.libs/libblkid.so.1: undefined symbol: __sancov_lowest_stack
eject: unmount of `/home/runner/work/util-linux/util-linux/tests/output/eject/umount-by-disk-mounted-mnt' failed
Subsequently, all tests which require the `scsi_debug` module get skipped,
since it's still in use due to the failed umount:
fdisk: align 512/4K ... SKIPPED (cannot remove scsi_debug module (rmmod))
fdisk: align 512/4K +alignment_offset ... SKIPPED (cannot remove scsi_debug module (rmmod))
fdisk: align 512/4K +MD ... SKIPPED (cannot remove scsi_debug module (rmmod))
In case of gcc this can be easily resolved by setting $LD_PRELOAD to the
respective ASan library. clang makes this a bit more difficult, since it
compiles the ASan library statically, so firstly we need to force dynamic
linking (via -shared-asan), and then add the runtime DSO path to the
linker cache, since it's in a non-standard path.
In its current form the testsuite isn't suitable for running
fuzz targets because it ignores exit codes and relies solely
on diffs (that unfortunately aren't helpful because the nondeterministic
nature of fuzz targets makes it kind of hard to specify expected output
in advance). This patch is supposed to address the "exit code" issue for now.
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
* use fdisk --noauto-pt to avoid re-creation of the default architecture specific PT
* use more verbose "Created a new" messages in the output
Signed-off-by: Karel Zak <kzak@redhat.com>
* add $TS_ERRLOG for script stderr output
* add optional $TS_EXPECTED_ERR which points to expected/*/*.err
This change allows to keep track about stderr output from our commands
(already found bug in sfdisk...).
We do not have to depend on fragile stdout vs. stderr order (due to
different buffering semantic in different libc, etc.).
Signed-off-by: Karel Zak <kzak@redhat.com>
Triggered by commit f612c4c67 (tests: fix --unbuffered mode with
ASAN, 2019-08-27), which says:
Well, this patch sucks. It would be nice to have things in
the way how it has been original expected by Patrick's patch,
but ...
So this commit here effectively reverts it and instead tries to
improve the shortcomings of the original patch. First, it uses
env(1) to set ASAN_OPTIONS instead of directly adding it to the
args array to fix execution of "${args[@]}" "$@".
Second, it now supports both unbuffer(1) and stdbuf(1). The
latter uses LD_PRELOAD tricks, which doesn't play nicely with
ASAN, so it will not be used if ASAN has been requested. It's
still valuable to have support for both, as many more systems
will have stdbuf(1) from coreutils installed but not unbuffer(1)
from expect.
Signed-off-by: Karel Zak <kzak@redhat.com>
* remove obsolete stdbuf check
* check for unbuffer command in ts_run() than skip all test
Reported-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Karel Zak <kzak@redhat.com>
Unfortunately, ASAN is pretty sensitive to LD_PRELOAD, but stdbuf from
coreutils is based on LD_PRELOAD. So, I have replaced stdbuf with
unbuffer (from expect pkg).
The another problem is "${args[@]}" "$@" which does not work as expected.
Well, this patch sucks. It would be nice to have things in the way
how it has been original expected by Patrick's patch, but ...
Signed-off-by: Karel Zak <kzak@redhat.com>
In the test cases "rename::exit_codes" and "rename::exit_codes", we rely
on the flushing behaviour of stderr and stdout streams relative to each
other. Streams in glibc will not flush on newlines if stdout is pointing
to a non-TTY file descriptor, but relying on this is fragile and may
break on systems with a different behaviour like musl libc.
Fix this by introducing a new parameter "--unbuffered" to `ts_run`. If
this parameter is passed and stdbuf(1) from coreutils is available, then
it will use it to disable buffering of standard output completely. Like
this, we can selectively run tests with this if ordering of messages
from stdout and stderr is being checked.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
x
The default is SKIP missing commands on --use-system-commands, but
with --noskip-commands the test will FAIL.
Signed-off-by: Karel Zak <kzak@redhat.com>
This change allows to use commands from $PATH rather than from
$top_builddir. There two basic use cases:
* check differences between installed and git version
run.sh --use-system-command --show-diff
* check system binaries by upstream tests (for example tests from
src.rpm package)
Signed-off-by: Karel Zak <kzak@redhat.com>
The libtool based build system uses scripts rather than real binaries
in $top_builddir. It's necessary to use libtool --mode=execute to call
valgrind for the real binary (from .libs/).
Signed-off-by: Karel Zak <kzak@redhat.com>
Regarding parallel root checks ...
- fix: add a few missing "udevadm settle" where we are using LABELs or UUIDs
- introduce ts_udevadm_settle():
* Still trivial implementation. The idea is to use it in future for all
tests instead of directly calling "udevadm settle". So we could add debug
messages, wait for specific events, add code for non-udev systems or even
use "udevadm --{start,stop}-exec-queue" to be really sure what we are
doing and why using udevadm at all.
* The currently unused args may be used in future and show the code reader
already now why we are calling "udevadm settle" at all.
* So far this patch only affects swapon/, mount/, libmount/ tests, and is
only about UUIDs and LABELs, but may be continued later for "partitions",
"md devices", whatever.
* We are calling ts_udevadm_settle() right *before* we need a LABEL or
UUID, not just *after* we created one. This may be a bit better for
speed and shows the code reader which command would fail without settle.
- function ts_device_has_uuid() is unused now, we trust blkid(1). Renamed to
ts_is_uuid() in case we would need it again.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
ts_is_mounted "/dev/loop1" returned true if /dev/loop17 was
mounted. A very annoying source of sporadic failures since
many years. This issue became more visible since running the
checks in parallel, which increases the probability to get
bigger loop device numbers.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Bash 4 is now almost 10 years old and it seemed to be fine in 613a337e
to use associative arrays. Unfortunately OSX will probably never update
to 4 because of GPLv3. We don't want to lose our travis OSX build and
use plain arrays again.
BTW remove that "informative warnings" about unlocked resources. They
were only silent so far because of a bug. Any system where scsi_debug
is broken would print a lot of these warnings. This also tells us that
we could even stop calling ts_unlock() explicitly. Just exiting the
tests would be good enough.
Note that currently flock(1) is not available on our OSX build anyways.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
The only situation where we would block endless is if another parallel test
has the lock and hangs for another reason. This means that the other test
would still keep hanging even if we timeout here. The user would have to
interrupt the other test or the whole test-suite anyways.
Note that we would certainly run into any timeout when using --parallel=200,
so that all scsi tests start the same time.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
The test-suite did not survive when flock timeouts after 30s because
then ts_cleanup_on_exit() may use resources (e.g. rmmod scsi_debug)
while not having the lock.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
On debian-kfreebsd we've locked stdout which messed up our test logs. Using
/proc/*/fd/ is not portable. Even ts_init's test for "/proc/self/fd"
does not help because /proc/*/fd behaves strange here:
$ ls -l /proc/$$/fd
lr--r--r-- 1 rudi user 0 Mar 6 23:11 /proc/2194/fd -> unknown
$ file /proc/$$/fd
/proc/2194/fd: broken symbolic link to `unknown'
## wtf?
$ test -d /proc/$$/fd; echo $?
0
$ ls -l /proc/$$/fd/
ls: cannot access /proc/2194/fd/: No such file or directory
## but
$ ls -l /proc/self/fd/
total 0
cr-xr-xr-x 1 root root 0, 3 Mar 6 19:39 0
cr-xr-xr-x 1 root root 0, 4 Mar 6 19:39 1
cr-xr-xr-x 1 root root 0, 5 Mar 6 19:39 2
cr-xr-xr-x 1 root root 0, 6 Mar 6 19:39 3
This is how this patch changes the test output:
[...]
blkid: partitions probing: [06] sgi ... OK
blkid: partitions probing: [07] sun ... OK
blkid: partitions probing ... OK (all 7 sub-tests PASSED)
-ls: cannot access /proc/66215/fd/: No such file or directory
+ blkid: mbr-wholedisk ... SKIPPED (missing scsi_debug module (dry-run))
blkid: MD raid0 (whole-disks) ... SKIPPED (losetup not found)
blkid: MD raid1 (last partition) ... SKIPPED (missing in PATH: mdadm)
blkid: MD raid1 (whole-disks) ... SKIPPED (losetup not found)
@@ -343,11 +343,11 @@
dmesg: facilities ... SKIPPED (test_dmesg not found)
dmesg: indentation ... SKIPPED (test_dmesg not found)
eject: umount ... SKIPPED (eject not found)
-ls: cannot access /proc/69561/fd/: No such file or directory
-ls: cannot access /proc/69609/fd/: No such file or directory
+ fdisk: align 512/4K ... SKIPPED (missing scsi_debug module (dry-run))
+ fdisk: align 512/4K +alignment_offset ... SKIPPED (missing scsi_debug module (dry-run))
fdisk: align 512/4K +MD ... SKIPPED (missing in PATH: mdadm)
fdisk: align 512/512 ... SKIPPED (losetup not found)
[...]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Old sync(1) prints a warning which looks ugly among our
test output: "sync: ignoring all arguments"
Seen on travis, Ubuntu <= 14.04 (Trusty).
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
The patch enables flock for scsi_debug to avoid collision between
tests. The patch also adds ./run.sh --nolocks to disable this feature.
Signed-off-by: Karel Zak <kzak@redhat.com>
The command ./configure --enable-asan adds -fsanitize=address
to the compiler command line. In the regression tests leaks detection
is disabled by default. You have to use --memcheck-asan on test
command line to enable.
Signed-off-by: Karel Zak <kzak@redhat.com>
- auto cleanup on test exit
- Add smart timeout: Newer openSUSE systems on OBS failed to rmmod
almost always. udevadm settle does not seem to have any affect.
- now tests will fail if rmmod fails
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Use the shell special variable "$@" instead of the inferior $* to
execute the test command in ts_valgrind. The expansion of "$@" respects
proper word splitting and makes it possible to pass the command empty
arguments. It might also prevent surprises with quoting in corner
cases.
Tested that `make check` passes.
Valgrind run with `make check TS_OPTS='--nonroot --memcheck'` passes.
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
We don't sleep anymore since 01b38917. This does not work
on Debian 7 (wheezy)/linux-3.2. Is it the kernel's or udev's
fault?
We simmply add a better sleep again plus some todos for later
improvements.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Treat missing expected files as empty and let the test fail if
there is non-empty output.
Expected output may be missing in these cases:
1. forgot to commit the file after changing/adding a (sub)test
2. a bug in a test where we do tricks with TS_EXPECTED
3. and most notable if ts_die() is called before a subtest is
initialized, e.g. in ts_scsi_debug_init()
I always wondered why we don't treat this as FAILED. Now we do
so, ts_finalize and ts_gen_diff looks much cleaner now.
The change discovers that tests with subtest were ignoring the
"non-sub" expected files which had to be fixed. BTW we removed
any zero sized files.
Moreover now we respect diff's return value. In past all test
succeeded when diff was not able to write to diffdir, e.g. when
running tests as normal user after they run as root.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This is to force the one-line results also for non-parallel case.
We are using it for travis auto-build and on other build farms.
Moreover you can set this (and any other) option globally by env
which is the only way to pass it to make distcheck.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Like in non-parallel case we are printing only one line per
(sub)test now. The output lines must contain the full test name
to be useful.
This patch does not change anything for the non-parallel output
format except a bit code cleanup.
BTW changed blkid/low-probe test description to have shorter
lines.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
These two problems should be fixed now:
- BSD awk only accepts 1-char field seperator
- ts_has_option() did not returned "yes" if an option was given
multiple times
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
It's a pity a pity that we have to remove it. In past our test suite
could discover a kernel bug (4.4). But now they've changed optimal
iosizes on purpose.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>