Commit Graph

1422 Commits

Author SHA1 Message Date
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
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
Karel Zak a992cc0d98 tests: set shmmni to 32k
Linux kernel since 6730e6580177d13f4612767873cb5a533ad63c61 checks for
limits and kernel ipc/utils.h defines

 #define IPCMNI_SHIFT         15
 #define IPCMNI               (1 << IPCMNI_SHIFT)

it means 32768 (aka shortint max). Let's use it in our tests too to
avoid "Invalid argument" when write to /proc/sys/kernel/shmmni.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-18 13:22:26 +01:00
Karel Zak 1161323b5a tests: update swaplabel.err
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-06 11:13:15 +01:00
Anatoly Pugachev 67c9744c10 tests: add checksum for cramfs/mkfs for LE:16384 (ia64)
Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2020-12-19 21:36:00 +03: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
Karel Zak 61c49a6ed5 tests: update blkid output for iso/udf
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-12-14 13:42:01 +01:00
Karel Zak 150394604d blkid: encode all udf and iso IDs in udev output
We encode to "safe" strings almost all variables for 'blkid -o udev'
and we need it also for SYSTEM_ID, PUBLISHER_ID, APPLICATION_ID,
BOOT_SYSTEM_ID and recently added VOLUME_SET_ID and DATA_PREPARER_ID.

This change makes blkid from util-linux more compatible with built-in
udevd blkid.

Addresses: https://github.com/karelzak/util-linux/pull/1215 (commit 5cbffdb74f)
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-12-10 12:10:06 +01:00
Pali Rohár eb6a4cc2e1 libblkid: iso9660: add new test images
Image iso-different-iso-joliet-label contains different identifiers in ISO
and Joliet locations. Identifiers are prefixed with "ISO" or "Joliet"
string to verify that UNICODE Joliet has preference over ASCII ISO.

Image iso-unicode-long-label contains very long identifiers in ISO location
which do not fit into the Joliet location. In ISO location is UNICODE
character 'ï' replaced by '_' and unrepresentable spaces also by '_'.
This test verifies that libblkid can use first half of identifiers from
Joliet (which contains UNICODE) and second half from ISO which is just
uppercase and only small subset of ASCII. This image was generated by Nero
Linux software and basically this truncate and '_' replacement is done by
default for any long or UNICODE label.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2020-12-10 02:38:06 +01:00
Karel Zak 5bc0378bfa tests: (blkid) add erofs image
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-12-08 10:52:20 +01:00
Pali Rohár b6168ae9cf libblkid: udf: update test output for APPLICATION_ID and PUBLISHER_ID
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2020-12-05 21:10:23 +01:00
Sami Kerola 14a36f96ee
col: make input to tolerate invalid wide characters
The getwchar(3) will choke and exit if invalid character is encountered.
This change will make col(1) to print broken multibyte characters as
\x{hex} string.

Reported-by: Vitaly Lipatov <lav@etersoft.ru>
Addresses: https://github.com/karelzak/util-linux/issues/1198
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-12-02 22:12:32 +00:00
Karel Zak abd7815501 tests: (blkid) add support for multisession images
This commit adds support for multisession filesystem images to
standard low-probe blkid tests. The expected image name is

 <name>-multi-<offset>[-<offset> ...][-<something>].img

For example:
  iso-multi-0-174-348-genisoimage.img.xz

triggers three sub-tests:
  : iso-multi-genisoimage-0     ... OK
  : iso-multi-genisoimage-174   ... OK
  : iso-multi-genisoimage-348   ... OK

Addresses: https://github.com/karelzak/util-linux/issues/1161
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-30 10:33:20 +01:00
Karel Zak 3e35c90170 lscpu: update tests
* cpu MHz is per-CPU value and not printed in summary anymore
* topology is reordered
* number of NUMA nodes is moved to NUMA section
* parsable output uses cache ID from kernel if avalable

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-13 09:19:02 +01:00
Karel Zak ff3c6fd66f tests: update JSON outputs
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-12 11:40:22 +01:00
Karel Zak ab5d18e973 tests: (ul) remove another 'dim' input
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-10 13:36:32 +01:00
Karel Zak e34abedb6e tests: remove ul(1) 'dim' input
It's not supported by all terminals.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-09 16:41:46 +01:00
Sami Kerola bd66eb2e43 tests: move misc/ul to ul/ directory
Reference: https://github.com/karelzak/util-linux/pull/1165#issuecomment-715173662
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-11-09 16:31:59 +01:00