Commit Graph

1438 Commits

Author SHA1 Message Date
Vojtěch Eichler 635fd4af54 tests: use subtests 2021-09-13 10:59:59 +02:00
Vojtěch Eichler 99120a8bde tests: make use of subtests 2021-09-08 12:36:19 +02:00
Chris Hofstaedtler 597ccb7bf5 tests: Skip lsns/ioctl_ns test if unshare fails
Some parts of the Debian build infrastructure uses unshare to run the
package build, and that appears to cause a "nested" unshare in the
lsns/ioctl_ns test to fail. Unfortunately the tests then hang at this
point.

Try running unshare before the actual test, and skip the test if unshare
already fails.

[kzak@redhat.com: - add --fork to the test
                  - don't write to stdout/err]

Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-31 15:18:34 +02:00
Karel Zak e46f9fce30 tests: use sub-tests for dm-verity
* write error to the test log file rather than on stdout
* use sub-tests to get more info on output
* don't use ts_die in sub-tests to make sure we call final dmsetup remove

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-31 11:57:30 +02:00
Karel Zak 688edfc15b tests: check for dm-verity support
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-31 11:40:45 +02:00
Vojtěch Eichler 8edd055f41 tests: add tests for dm-verity support in mount 2021-08-31 11:24:59 +02:00
Karel Zak abe16d0d34 tests: make eject umount tests more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-24 10:49:32 +02:00
Karel Zak 85ae61dd6d tests: make mount/fstab-all more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-23 16:28:52 +02:00
Karel Zak 331c5e0c54 tests: make ./run.sh more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-23 15:15:38 +02:00
Karel Zak e5041e76f8 tests: add rv64 lscpu test
References: https://github.com/karelzak/util-linux/issues/1401
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-30 15:32:24 +02:00
Anatoly Pugachev 627216cf43 tests: fix fdisk/bsd on big endian systems (tested on sparc64 and ppc64)
Fixes: 5d0f0ca56
Closes #1392

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2021-07-27 19:33:03 +03:00
Karel Zak 082b79ff8e Merge branch 'rename-all' of https://github.com/utoddl/util-linux
* 'rename-all' of https://github.com/utoddl/util-linux:
  rename: size_t, mutually exclusive parameters
  rename: stop after count changes
  rename: add --all and --last parameters
2021-07-27 14:14:51 +02:00
Pali Rohár 5d0f0ca563 tests: fdisk: Update CHS values in MBR partitions
It looks like that old CHS values prior this change in test data are
incorrect. Possible explanation why CHS values are incorrect is in commit
message 9cade4fbf8 ("libfdisk: (dos) Fix determining number of heads and
sectors per track from MBR").

This change updates test data to pass test suite after applying mentioned
commit.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-16 22:26:38 +02:00
Karel Zak 5b65b68cd8 Merge branch 'fdisk-tests-more-details' of https://github.com/pali/util-linux
* 'fdisk-tests-more-details' of https://github.com/pali/util-linux:
  tests: fdisk: Layout with more details
2021-07-15 10:20:09 +02:00
Todd Lewis a2b23d3a91 rename: add --all and --last parameters
Renaming files with rename often involves multiple passes in order
to, say, replace all spaces with underscores because traditionally
rename only replaces the first occurrence of the expression. The
--all parameter makes this task simple.

With the addition of --last, rename becomes much safer to use when
replacing file extensions, whereas before it would mangle a file
which had its extension also embedded elsewhere in its name.

The implied --first, together with --all and --last, round out the
common cases for renaming files.
2021-07-15 00:15:55 -04:00
Karel Zak 50a3c3bd28 tests: update sfdisk reorder test
References: commit f05a5bb2c2
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-14 16:23:00 +02:00
Karel Zak a0b07d9f2e tests: skip if scsi_debug model file is not accessible
* do not print grep(1) info message

* use ts_skip rather than ts_die when scsi_debug is useless

Fixes: https://github.com/karelzak/util-linux/issues/1376
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-14 16:22:47 +02:00
Karel Zak 4ca2ee33b4 tests/eject: check for root perms at beginning
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-14 10:25:33 +02:00
Pali Rohár 88c197c690 tests: fdisk: Layout with more details
Use fdisk -x instead of fdisk -l for printing layout in fdisk tests. This
can help debugging why some fdisk tests fail.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-07 00:56:21 +02:00
Ross Burton dd956268ba test/eject: guard asan LD_PRELOAD with use-system-commands check
This test tries to add asan to LD_PRELOAD because the just-built eject
will call the host /bin/umount, and apparently asan doesn't like this.

However, if ldd isn't present, this fails as the path to asan is the
error message saying that ldd isn't present.

As the asan workaround is only needed when executing the binaries that
have just been built and not the system binaries, only use it if the
test is on the built binaries.

Closes #1373.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-07-01 20:46:55 +01:00
Ross Burton b1c71f19ea tests: mark ul/ul as a known failure
As with ul/basic, this test produces different output when ran under
different terminals, which isn't very useful.

Set TS_KNOWN_FAIL so that these problems don't cause the test to fail.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-06-30 11:25:11 +01:00
Ross Burton 55c58c6fd3 tests: check correct log file for errors in blkdiscard test
When checking if the discard ioctl is supported, look in stderr not stdout as
that is where the error appears.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-06-29 21:19:04 +01:00
Ross Burton 93ed220b13 tests: don't hardcode /bin/kill in the kill tests
If the 'kill' test is executed with --use-system-commands, it calls
/bin/kill to avoid the shell's own kill command being invoked.

However, this doesn't work if the kill we want to test isn't in fact in
/bin.  Instead, use $(which kill) to find a kill on the PATH and call
that directly.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-06-29 17:21:53 +01:00
Anatoly Pugachev 8c6fb9841c tests: fix lsns test on kernels without USER namespaces
Reported-by: Bruce Dubbs <bruce.dubbs@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 14:45:31 +02:00
Karel Zak 96476550db tests: update lscpu outputs 2021-05-25 13:30:28 +02:00
Karel Zak afa7e09e4b tests: update lscpu output
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-24 13:43:02 +02:00
Karel Zak c916e84380 tests: update build tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-10 12:13:09 +02:00
Karel Zak fe58418e9d tests: update libfdisk JSON outputs
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-06 17:02:40 +02:00
Karel Zak 62009e0d2f tests: update sparc lscpu tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-03 20:30:42 +02:00
Karel Zak 1c75a85101 libfdisk: use open(O_EXCL) to detect if device is used
It's seems detection by BLKRRPART is broken in recent kernels
(probably regression), and it's also overkill to force kernel re-read
all and generate all the events. It seems more elegant to use O_EXCL.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-15 15:14:52 +02:00
Karel Zak e741653d22 tests: small change to the lsns/ioctl_ns
* make description short
* chmod a+x to make script executable

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-13 10:40:00 +02:00
Masatake YAMATO d652d4c666 lsns: add columns for parent namespaces and owner namespaces
See ioctl_ns(2) about parent and owner namespaces.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-04-13 06:22:51 +09:00
Karel Zak 751eca28fc libblkid: remove workaround for FAT+MBR on whole-disk
The current libblkid ignores FAT when created on the same whole-disk
device as valid MBR. This restriction is not compatible with many
devices (like USB flash disk) created by Windows or the latest
dosfstools where the first partition is used for entire device and
where is also valid FAT. The filesystem is accessible from partition
as well as from whole-disk device.

The conclusion (between util-linux, dosfstools and udisks) is that
libblkid has to provide all details, not hide anything and the proper
policy (hide/show) has to be implemented by udisks (or so).

CC: Tomáš Bžatek <tbzatek@redhat.com>
CC: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-09 14:42:18 +02:00
Karel Zak 6b160f5acd tests: update fdisk dumps
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-08 12:46:47 +02:00
Karel Zak ba3b935259 tests: update lscpu output
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-01 12:30:25 +02:00
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 d246854aa8 tests: update build test results
Update as usually before release to see differences (on Fedora 33).

- static programs are not enabled by tools/config-gen.d/all.conf
  anymore (see 63f4e19928)
- add new uclampset
- libdl and libpython3 seems unnecessary
- fdformat disabled by default
- new hardlink uses libpcre2-posix

Signed-off-by: Karel Zak <kzak@redhat.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-17 14:58:26 +01:00
Karel Zak b09ed927d7 tests: update mountpoint return code chack
This is necessary due to e0ecd19641.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-12 11:39:23 +01:00
Karel Zak 70a7b61a84 tests: update mountpoint tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-11 10:52:11 +01:00
Karel Zak 4bf9ebca2b tests: update hardlink tests
The important is result, not summary or verbose output.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-02-17 11:50:21 +01:00
Karel Zak 15a37d00e5 tests: don't reply on scsi_debug partitions
The disk layout as created by scsi_debug depends on kernel version.
Let's make the partition sizes hardcoded in our tests than rely on
kernel.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-02-11 12:44:44 +01:00
Karel Zak c3a6350335 tests: be explicit with file permissions for cramfs
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-02-09 18:02:13 +01:00
Frantisek Sumsal 81edf9f0da ci: deal with uninstrumented binaries using instrumented libs
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.
2021-02-01 12:00:30 +01:00
Karel Zak e589e25f19 tests: skip hwclock/systohc on GH Actions
It seems the delay on GH is too large to get proper result for this
tests. We already ignore it on Travis.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 11:54:38 +01:00
Karel Zak f9d7ed5517 tests: mark ul/basic as KNOWN_FAIL
It works locally and on Travis, but fail on Github Actions.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 11:39:10 +01:00
Karel Zak 8839d98089 tests: migrate from ext3 to ext2
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 11:11:14 +01:00
Karel Zak bf7e7d5c84 tests: dump more information about CFS and block devices
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 10:30:01 +01:00
Karel Zak 734678205a tests: improve u64 use in ipcs test
UINT64_MAX is 18446744073709551615, but 2^64 is 18446744073709551616.
We also need to use kbytes in all calculation in the test than bytes
as ipcs by default do not use bytes anymore.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-19 16:25:33 +01:00