Commit Graph

822 Commits

Author SHA1 Message Date
Karel Zak 1bb08cfc01 tests: update sfdisk reorder test
References: commit f05a5bb2c2
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:59:05 +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
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 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 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 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 1161323b5a tests: update swaplabel.err
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-06 11:13:15 +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
Karel Zak de9cbcdcef Merge branch 'whereis' of https://github.com/ferivoz/util-linux
* 'whereis' of https://github.com/ferivoz/util-linux:
  whereis: extend test case
  whereis: filter bin, man and src differently
  whereis: do not strip suffixes
  whereis: do not ignore trailing numbers
  whereis: add --disable-whereis to configure
  whereis: add lib32 directories
  whereis: support zst compressed man pages
  whereis: fix out of boundary read
2020-11-06 09:44:52 +01:00
Samanta Navarro 062e6a3945 whereis: extend test case
Previous commits are covered with these test cases.

Removed dependency on system layout.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
2020-11-04 11:43:09 +00:00
Samanta Navarro cb77628876 misc: fix typos [codespell]
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
2020-11-04 11:42:25 +00:00
Sami Kerola aa439c6035
ul: add basic tests
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-10-20 20:29:20 +01:00
Karel Zak 2ceccca901 tests: update sfdisk wipe tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-10-16 10:59:17 +02:00
Karel Zak 017c0308c7 tests: update atari partx tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-10-13 18:34:39 +02:00
Karel Zak 0d061b6e68 tests: update atari blkid tests
The old images of the atari label are truncated and in-table stored
sizes do not match with real images sizes -- libblkid checks it now.

I have no idea how to generate ICD format, let's ignore it in tests
for now.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-10-13 16:29:19 +02:00
Karel Zak 18b96d7102 Merge branch 'col-refactor' of https://github.com/kerolasa/util-linux
* 'col-refactor' of https://github.com/kerolasa/util-linux:
  col: replace LINE and CHAR typedefs with structs
  col: free memory before exit [LeakSanitizer]
  col: tidy up sources a little bit
  col: add defaults to switch case clauses
  col: flip all comparisions to numerical order
  col: use size_t when dealing with numbers that buffer sizes
  col: add structure to hold line variables
  col: add update_cur_line() function
  col: add handle_not_graphic() function
  col: initialize variables when they are declared
  col: move option handling to separate function
  col: move global variables to a control structure
  col: use inline function rather than function like define
  col: use typedef and enum to clarify struct
  col: remove function prototypes
  col: add more tests
2020-09-29 13:41:00 +02:00
Karel Zak c8baef03c6 tests: update script(1) return code
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-09-21 13:34:06 +02:00
Sami Kerola b97981a707
col: add more tests
With these tests coverage is about 89%.

The ts_run is added to ensure ASAN_OPTIONS and UBSAN_OPTIONS are set
correctly when the tests run.

Reference: https://github.com/karelzak/util-linux/pull/1115#issuecomment-670140224
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-09-11 20:55:01 +01:00
Karel Zak dc4816142c tests: add sfdisk test for 4fe7f9b614
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-08-10 12:00:17 +02:00
Chris Hofstaedtler dcd77a69da fdisk: fix expected test output on alpha
The last test output update inadvertedly replaced "ext2" with "MS-DOS"
in the alpha-specific data.

Fixes: 3c36438f0
Broken build log: https://buildd.debian.org/status/fetch.php?pkg=util-linux&arch=alpha&ver=2.36-1&stamp=1595550493&raw=0
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
2020-07-24 09:09:43 +02:00
Mauricio Faria de Oliveira ff84ba8b03 rename: tests: add more symlink checks
Add a few checks to the symlink test, including for the fix
in commit 477239ce0d ("rename: fix regression for symlink
with non-existing target").

Tested with './tests/run.sh rename/symlink' before/after that
commit with FAILED/OK results (and '--show-diff') as expected:

After:
       rename: symlink check                  ... OK

Before:
       rename: symlink check                  ... FAILED (rename/symlink)

With --show-diff:

    diff-{{{
    --- /home/mfo/git/util-linux/tests/expected/rename/symlink	2020-07-14 15:21:06.412792160 -0300
    +++ /home/mfo/git/util-linux/tests/output/rename/symlink	2020-07-14 15:45:10.980927233 -0300
    @@ -3,5 +3,3 @@
     rename_slink.3: `old' -> `new'
     `rename_slink.1' -> `rename_symlink.1'
     target
    -`rename_slink.2' -> `rename_symlink.2'
    -target
    }}}-diff

    diff-{{{
    --- /home/mfo/git/util-linux/tests/expected/rename/symlink.err	2020-07-14 15:37:42.466207786 -0300
    +++ /home/mfo/git/util-linux/tests/output/rename/symlink.err	2020-07-14 15:45:10.984927251 -0300
    @@ -1 +1,2 @@
    +rename: rename_slink.2: not accessible: No such file or directory
     rename: rename_slink.3: No such file or directory
    }}}-diff

Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
2020-07-14 15:51:47 -03:00
Mark Hindley 3e93958117 tests: Fix mountpoint test failure in build chroots.
The test assumed that / was a mountpoint. This is not always the case, for
example in pbuilder/cowbuilder chroots. So use / if findmnt verifies it is a
mountpoint, otherwise use the first mountpoint found. Skip the test if no
mountpoints are found.

Signed-off-by: Mark Hindley <mark@hindley.org.uk>
2020-06-24 15:44:44 +02:00
Sami Kerola d8bfcb4cc5
col: fix output when first line does not have newline character
Commit I made while back and has been part of util-linux v2.30 to v2.35 made
col(1) not to output anything when first line did not have newline character.

    printf "gone from output" | col

This commit fixes the issue.  Admittedly the col source code is unnecessarily
hard to work with.  It could be a good idea to refactor the col(1) as low
priority task, Assuming refactoring is done the first commit to get that done
should add tests that exhaust all possible input handling including all command
line option directives.

Addresses: https://github.com/karelzak/util-linux/issues/422
Fixes: b6b5272b03
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-06-20 22:17:30 +01:00
Karel Zak 01977c3847 tests: add STATIC binaries to build-sys tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-06-09 10:55:20 +02:00
Karel Zak 1376cdeaf2 tests: update build-sys tests
- remove libasan from results
- link libcryptsetup (due to verity support in libmount)
- add lsiqr
- add irqtop

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-06-08 13:29:33 +02:00
Karel Zak fd3a8fda9a tests: sfdisk fill correctly gaps if default start requested
References: 83fdb880b9
Addresses: https://github.com/karelzak/util-linux/issues/1044
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-05-22 11:30:27 +02:00
Aurelien LAJOIE f8d76efe97 cal: Add test, all are checked against ncal
ncal -M 09 2006
    September 2006
Mo     4 11 18 25
Tu     5 12 19 26
We     6 13 20 27
Th     7 14 21 28
Fr  1  8 15 22 29
Sa  2  9 16 23 30
Su  3 10 17 24

cal -mv 09 2006
    September 2006
Mo     4 11 18 25
Tu     5 12 19 26
We     6 13 20 27
Th     7 14 21 28
Fr  1  8 15 22 29
Sa  2  9 16 23 30
Su  3 10 17 24

For example `vertical-3sjv` `ncal -wjA2 08 2006`
The differences are 3 letters days when julian calendar with cal
Trailing spaces
2020-05-11 17:41:54 +02:00
Karel Zak f12d5ad279 lib/strutils: fix uint64_t overflow
Addresses: https://github.com/karelzak/util-linux/issues/998
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-17 10:25:17 +02:00
Karel Zak 316617e848 tests: update fdisk outputs due to sizes rounding change
References: b38c20e13a
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-16 12:19:16 +02:00
Karel Zak b38c20e13a ilib/strutils: fix rounding in size_to_human_string()
Thanks to bub75 for the idea.

The patch adds SIZE_DECIMAL_2DIGITS into regression tests.

Addresses: https://github.com/karelzak/util-linux/issues/998
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-15 15:06:37 +02:00
Karel Zak ea4dcdc788 tests: add zonefs blkid test
Thanks to Damien Le Moal for the image.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-06 15:33:23 +02:00
Aurelien LAJOIE b908299188 cal: Correctly center the year
Signed-off-by: Aurelien LAJOIE <orel@melix.net>
2020-03-31 15:31:54 +02:00
Karel Zak e7db499f1c tests: cleanup fdisk based stuff
* 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>
2020-03-24 14:30:16 +01:00