Commit Graph

55 Commits

Author SHA1 Message Date
Karel Zak d928b9afe2 tests: make it compatible with meson
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-22 15:15:52 +01:00
Zbigniew Jędrzejewski-Szmek d4c880d5a4 meson: add second build system
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?
2021-03-17 15:07:27 +01:00
Zbigniew Jędrzejewski-Szmek 9fb5486c27 tests/run: create failure directory
The test would occasionally fail with
tests/run.sh: line 241: /home/fedora/util-linux/build/tests/failures: No such file or directory

I don't quite understand why the file does not get created... The outupt directory
missing seems the most likely explanation.
2021-03-17 15:07:27 +01:00
Karel Zak 60bad224a8 tests: suggest "make check-programs"
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-12-17 10:57:33 +01:00
Evgeny Vereshchagin e6a4d8cc06 build-sys: add --enable-ubsan to make it possible to build util-linux with UBSan
mostly to prepare for https://github.com/karelzak/util-linux/pull/1068
but it's useful even without fuzzing.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-03 11:17:53 +02:00
Karel Zak 406fb25387 tests: add --parsable, remove TS_OPT_parsable
* don't enable parsable for non-parallel executions in travis
* add --parsable to run.sh
* use --parsable rather than TS_OPT_ in travis

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 13:04:34 +02:00
Karel Zak 571f5f5ba1 build-sys: support 'none' for parallel tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 12:01:57 +02:00
Anatoly Pugachev 616f57d949 Don't use `nproc --all` for getting cpu number. For example below,
sparc64 is reporting 128 as a total, but only 32 is online. So use only
online cpus for tests parallel runs.

$ nproc
32

$ nproc --all
128

$ lscpu
Architecture:        sparc64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Big Endian
CPU(s):              32
On-line CPU(s) list: 0-31
Thread(s) per core:  8
Core(s) per socket:  4
Socket(s):           1
Model name:          UltraSparc T5 (Niagara5)
Flags:               sun4v

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2019-09-24 18:15:33 +03:00
Karel Zak 0b17c997c0 tests: auto-enable ASAN option if necessary
Let's detect ASAN LDFLAGS in top level Makefile to make sure we call
tests with --memcheck-asan if build-system has been configured with
--enable-asan.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-24 12:24:15 +02:00
Karel Zak 7c90efa384 tests: add --noskip-commands
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>
2019-03-05 11:06:41 +01:00
Karel Zak 43b4a4d3c7 tests: add --use-system-commands
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>
2019-03-04 17:14:12 +01:00
Sami Kerola 4520caa11e tests: move stderr redirection out from test expression
Fix shellcheck error.

if ! [ "$paraller_jobs" -ge 0 2>/dev/null ]; then
^-- SC1009: The mentioned parser error was in this if expression.
     ^-- SC1073: Couldn't parse this test expression.
                              ^-- SC1072: Expected test to end here (don't
                                  wrap commands in []/[[]]). Fix any
                                  mentioned problems and try again.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-05-28 13:36:38 +02:00
Ruediger Meier 07b1ea7c44 tests: handle xargs errors and invalid args
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-19 11:46:11 +01:00
Ruediger Meier 5917d17f0d travis: use parallel root checks
Also improve CPU count detection for tests.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-07 20:49:25 +01:00
Karel Zak 9deb8c7dfd tests: add lock on shared resources (e.g. scsi_debug)
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>
2017-12-06 14:21:38 +01:00
Karel Zak b97cc9a829 build-sys: add --enable-asan and --memcheck-asan for tests
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>
2017-11-23 14:59:05 +01:00
Karel Zak d3f58f8aee tests: rename --memcheck to --memcheck-valgrind
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-23 14:03:23 +01:00
Karel Zak 74fe554a41 tests: add --show-diff
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-16 14:14:54 +01:00
Filipe Brandenburger 7cd6d50aa9 tests: Allow running a single test case from tests/run.sh
Tested by running `tests/run.sh libmount/optstr` successfully.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2016-08-10 13:59:31 -07:00
Karel Zak b267ec301b tests: make chrt test more debug-able
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-07-11 11:54:31 +02:00
Ruediger Meier 855f7f0650 tests: add option --parsable
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>
2016-03-05 22:19:24 +01:00
Ruediger Meier 51658498c4 build-sys: portable usage of find command
- use dot instead of skipping search-path
 - avoid -perm /a+x
 - avoid -path

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 12:53:47 +01:00
Ruediger Meier 81b3d7eda5 tests: fix run.sh --parallel=1
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-01-05 12:21:56 +01:00
Karel Zak c8aa62a8dc tests: add --exclude=<list> for run.sh
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-03-25 19:32:22 +01:00
Karel Zak d995c2f082 tests: add --skip-loopdevs
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-03-17 11:34:22 +01:00
Ville Skyttä 9779f59831 docs: Spelling fixes
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-18 13:59:19 +01:00
Ruediger Meier 667e473524 tests: run tests in deterministic order
Not really needed but it makes debugging of existing build logs
much more easier.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-27 00:09:49 +02:00
Ondrej Oprala 10a628c8b3 lib/tt.c: Goodbye!
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-04-03 12:29:19 +02:00
Ruediger Meier 6163259cbd tests: getting paraller_jobs more robust
This patch fixes several issues:
 1. lscpu may not exist on all systems.
 2. Option -b is not always available but we can skip it because it's
    the documented default for -p.
 3. Some old lscpu versions print --help output to stdout in case of
    error. So in case 2. it would count all the help lines as CPUs,
    which could be really bad on slow single core machines.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-03-29 01:13:13 +01:00
Ruediger Meier ddd2570f60 tests: return error if failures file not usable
In past this could happen when doing make distcheck.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-03-13 17:45:01 +01:00
Ruediger Meier 51f9b431c0 tests: write tests/failures to build- instead of srcdir
All other test output goes to builddir too and moreover "make distcheck"
complains about writing to it's read-only srcdir.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-03-13 17:24:13 +01:00
Sami Kerola 40e6f7a063 tests: make tests to run parallel
Unarguably this change makes test output to be more messy, but when I
compare run time tells with clear numbers parallel is quicker.  For me
the quickness is important factor.  Running test suite always after a
change is preferrably quick, and if something is indicated to be broken
it is ok to spend time in drilling down what happen.

$ time ./tests/run.sh --parallel=5
[...]
real    1m48.037s

Same without parallelization.

$ time ./tests/run.sh
real    3m16.687s

The default is changed to be parallel, where job count is same as number
of CPUs.

[kzak@redhat.com: - propagate --parallel into function.sh
                  - don't use extra title for non-parallel execution
                  - disable by default]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 15:01:02 +01:00
Sami Kerola e130ce53ce tests: avoid executing dirname(1) command
Bash parameter expansion does the same thing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 13:55:41 +01:00
Karel Zak 35cf827870 libblkid: support LIBBLKID_DEBUG= only
... the BLKID_DEBUG= is not more supported.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-09 12:52:09 +02:00
Karel Zak 76041e708d libblkid: fix DBG()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-09 12:44:02 +02:00
Karel Zak 72c9217951 tests: unset *_DEBUG variables
Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-10 13:43:11 +01:00
Karel Zak 1b03e2cd33 tests: make compatible with autotools
The command 'make check' is called from 'make distcheck' (which is
used to generate official util-linux tarballs).

It means that tests/ stuff has to be compatible with autotools and
differentiate between source and build directories.

 * remove run-nonroot.sh (merged into run.sh
 * remove commands.sh.in
 * all tests and top level run.sh accept --builddir and --srcdir
   command line options
 * functions.sh modified to use $top_builddir/tests for output files

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-03 21:24:51 +02:00
Karel Zak b5606aada4 tests: check for 'make check'
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-30 18:00:33 +02:00
Karel Zak 21d1fa53f1 tests: tiny change in output header
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 13:14:43 +02:00
Karel Zak 0269fcbb34 tests: add --memcheck to
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-06 16:32:29 +01:00
Karel Zak 949cf64bbc tests: fix options evaluation, add support for optional tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-03 13:20:24 +01:00
Karel Zak d3b24397df remove -ng from some files
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-01 22:06:15 +01:00
Karel Zak 601d12fb10 rename util-linux-ng back to util-linux
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-30 11:41:59 +01:00
Karel Zak 396b8c0f9f tests: fix -regex in run.sh
Reported-by: Scott James Remnant <scott@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-04-29 15:51:32 +02:00
Karel Zak a02f320d4b tests: fix TS_* paths
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-11 23:30:14 +01:00
Karel Zak a1be90bba4 tests: add ./run.sh <component>
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-11 23:27:55 +01:00
Karel Zak d42bbae57d tests: add support for subdirs to basic test functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-11 23:27:55 +01:00
Karel Zak c986042898 tests: add warning "For development purpose only."
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-08-08 00:42:29 +02:00
Karel Zak 92f2c23e68 tests: add license notices, change from gplv2-only to gplv2-or-later
The previous "gplv2-only" was copy&past mistake. This re-licensing is
correct -- there is not any other contributor to this code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-23 14:31:14 +02:00
Mike Frysinger d6ca1ec176 tests: use relative paths when sourcing files
The "." command will search $PATH before $PWD if the argument
specified contains no path qualifiers which can cause problems if
you happen to have something in $PATH named the same.  The
attached patch changes all of the ".  <foo>" in the tests subdir.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2007-07-23 13:55:36 +02:00