Commit Graph

1422 Commits

Author SHA1 Message Date
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
Karel Zak f3c90e9172 Revert "tests: fixes fdisk/align-512-* tests"
This reverts commit 25f5c514b9.
2020-03-24 10:48:55 +01:00
Anatoly Pugachev 25f5c514b9 tests: fixes fdisk/align-512-* tests
write 'MSDOS' partition table before test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2020-03-23 17:23:01 +03:00
Anatoly Pugachev d4dc0fcf83 tests: fixes mount tests on SPARC
fdisk partition table fix for writting "msdos" label before the test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2020-03-11 17:22:21 +03:00
Anatoly Pugachev 356ed88a56 tests: fixes libmount/ on SPARC
fdisk partition table fix for writting "msdos" label before test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2020-03-11 17:22:21 +03:00
Anatoly Pugachev f97c20f4a4 tests: fixes eject/umount on SPARC
Since SPARC is using 'sun' partition table by default, make test not to
assume that disk has 'dos' partition table, so write 'dos' partition
table on disk, before proceeding any further.

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2020-03-11 17:22:21 +03:00
Karel Zak ac762ed71f sfdisk: fix previous --append patch, improve man page
- fix stupid typo (!has_container_or_unused(sf))
- use fdisk_is_partition_used() as fdisk_get_partition() returns
  nothing for unused partition
- update tests
- add more hints to the man page

Addresses: https://github.com/calamares/calamares/issues/1332
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-02 14:41:39 +01:00
Sami Kerola 3c36438f0b
fdisk: update expected test outputs with command outputs
Reference; https://github.com/karelzak/util-linux/pull/959
Addresses: 5d271cefad
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-02-20 21:19:37 +00:00
Karel Zak 3239663361 Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
  tests: Add UDF hdd image with emoji label created by mkudffs 2.2
  libblkid: Fix UTF-16 support in function blkid_encode_to_utf8()
2020-02-10 13:51:23 +01:00
Karel Zak f88034e818 tests: add sfdisk --dump test
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-10 13:20:04 +01:00
Pali Rohár ef111c0b3e tests: Add UDF hdd image with emoji label created by mkudffs 2.2
mkudffs 2.2 can create UDF filesystem which label contains Unicode code
points above U+FFFF which cannot be represented by UCS-2 encoding and
therefore UTF-16 needs to be used (via surrogate pairs). Unicode code
points above U+FFFF are encoded in UTF-8 by four bytes and some example is
emoji "😀".

This is test case to check that libblkid correctly supports UTF-16
decoding. It was created by mkudffs 2.2:

$ dd if=/dev/zero of=udf-hdd-mkudffs-2.2.img bs=1M count=10
$ mkudffs -l 😀 udf-hdd-mkudffs-2.2.img
2020-02-09 13:04:39 +01:00
Karel Zak 27903b1cc4 Revert "libblkid: improve handling of ISO files with partition tables"
This reverts commit 7ef86a0891.
2020-01-13 11:53:11 +01:00
Karel Zak cd361f901e Revert "libblkid: improve identification of ISO9660 partition"
This reverts commit fc84bc0a46.
2020-01-13 11:48:37 +01:00
Karel Zak 4ae96cf77b tests: mark mdadm tests as TS_KNOWN_FAIL
It seems recent changes in mdadm make things a little bit unstable for
some users. Let's mark the tests temporary as TS_KNOWN_FAIL until we
get more information.

Addresses: https://github.com/karelzak/util-linux/issues/906
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-07 11:41:01 +01:00
Karel Zak 63f8c66af8 Merge branch 'master' of https://github.com/dsd/util-linux
* 'master' of https://github.com/dsd/util-linux:
  libblkid: improve identification of ISO9660 partition
  isosize: move ISO size functions into a shared header
2019-12-20 12:55:49 +01:00
Karel Zak 653d1c8110 tests: (fdisk) make sure we use the same sizes for MD devices
It seems on some kernels MD can return error if the devices in RAID
have different size

 # mdadm -q --create /dev/md8 --chunk=64 --level=0 --raid-devices=2 /dev/sda1 /dev/sda2
 mdadm: RUN_ARRAY failed: Unknown error 524

 # dmesg
 ...
 [ 1485.148435] md/raid0:md8: cannot assemble multi-zone RAID0 with default_layout setting
 [ 1485.152306] md/raid0: please set raid.default_layout to 1 or 2
 [ 1485.154050] md: pers->run() failed ...
 [ 1485.154104] md: md8 stopped.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-17 18:10:31 +01:00
Karel Zak 5202d809b6 Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
  libblkid: udf: Fix reporting UDF 2.60 revision for Mac OS X disks
2019-12-17 12:34:18 +01:00
Karel Zak b2ef43864f tests: (chfn) force to bash
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-16 15:27:45 +01:00
Radka Skvarilova 02238bff66 tests: add new test for chfn gecos
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1743555
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-16 13:22:29 +01:00
Daniel Drake fc84bc0a46 libblkid: improve identification of ISO9660 partition
Recent changes to the iso9660 handler attempt to better handle the case
where the media has both an ordinary ISO9660 filesystem, and a partition
table with a partition entry pointing at the ISO9660 filesystem.

Rather than assuming the presence of a partition table means that there
is an ISO9660 partition, check that such a partition exists before
deciding upon which device the metadata should be presented. One real
world example of this is the grub-mkrescue image format; add a unit test
to cover that.

Secondly, even if we find an appropriate entry in the partition table,
verify that we actually have a device that corresponds to the partition
where we would then proceed to expose this metadata. In the case of a
CD/DVD (i.e. /dev/sr0) we would not normally expect to see devices
corresponding to the partitions, in that case the ISO metadata should be
presented on the whole disk (/dev/sr0).

Fixes: 7ef86a0891 ("libblkid: improve handling of ISO files with partition tables")
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1783066
Signed-off-by: Daniel Drake <drake@endlessm.com>
2019-12-16 14:29:24 +08:00
Pali Rohár 92fc937ba4 libblkid: udf: Fix reporting UDF 2.60 revision for Mac OS X disks
Apple's newfs_udf, when creating UDF 2.60 disks, sets value 2.50 into
both Minimum UDF Read Revision and Minimum UDF Write Revision fields in
LVIDIU. And sets 2.60 value into UDF revision field in LVD descriptor.

So to correctly parse and set blkid ID_FS_VERSION field, use maximum value
from Minimum UDF Read Revision in LVIDIU, Minimum UDF Write Revision in
LVDIU and UDF revision in LVD descriptor.

This commit also adds a testing UDF 2.60 disk image with 4K sectors created
by Apple's newfs_udf to verify that ID_FS_VERSION is set correctly to 2.60.
2019-12-15 12:55:41 +01:00
Karel Zak 4af92de983 build-sys: remove duplicate includes
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-10 13:50:18 +01:00
Karel Zak 21c97651f4 tests: mark scriptlive as KNOWN_FAILED
Not sure why, but on travis-ci the shell output is little bit
different, probably depends on shell version, etc.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-26 09:56:24 +01:00
Karel Zak 52722cda11 tests: another prompt fix
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-25 14:09:38 +01:00
Karel Zak a06b278bd3 tests: remove option --posix
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-25 10:45:38 +01:00
Karel Zak 53ea212dca tests: make scriptlive output more portable
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-22 14:21:20 +01:00
Karel Zak 45b819c124 tests: upadet scriptlive output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-22 14:04:11 +01:00
Karel Zak 85ecd3719b tests: add script and scriptlive replay
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-22 13:48:54 +01:00
Karel Zak b4402de7a0 tests: commit add missing file
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-05 15:42:19 +01:00
Karel Zak be906b20f2 tests: add mount --all tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-05 15:14:17 +01:00
Anatoly Pugachev a43665128c tests: fixes blkid/md-raidX-whole on Sparc
Since SPARC is using 'sun' partition table by default, make test not to
assume that disk has 'dos' partition table, so write 'dos' partition
table on disk, before proceeding any further.

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2019-10-23 11:26:19 +03:00
Karel Zak 93c2723772 tests: (lsblk) gather also udev attributes for new dumps
References: 7408a5d9c2
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-15 13:29:13 +02:00
Karel Zak a72a19865d tests: add missing 'ts_check_prog xz'
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-10 09:07:10 +02:00
Karel Zak 4abb659c18 tests: remove device name from blkdiscard output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 16:57:24 +02:00
Karel Zak b1154c4ece script: fix signalfd use
It's necessary to create signal-fd before fork() to get SIGCHLD,
because child could be faster than our code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 16:51:34 +02:00
Karel Zak 125314c04a script: add debug messages around waitpid()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 15:07:49 +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 060c4cee0f build-sys: cleanup prefixed used for tests
It's ugly to use the same TS_ prefix in tests as well as in
build-system (e.g. make check), because then some env. variable can be
interpreted by our regression tests. For example TS_PARALLEL=.

It's seems better to use TS_ exclusively for tests and TESTS_ for
build-system.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 12:31:28 +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
Karel Zak ac543a15b6 travis: don't call tests in parallel for root
Let's make it more readable in logs for root user.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 09:55:27 +02:00
Karel Zak ec10634e7e script: use lib/pty-session
This patch consolidate pseudo-terminal stuff in util-linux. From now
there is only one implementation used in su(1) --pty, scriptlive(1)
and script(1).

The new stuff is based on the original script(1) -- it means poll()
and signalfd() based.

Note that script(1) code does not provide fallback for systems/libc
where is no openpty().

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Elliott Mitchell 2bb3aa36b2 cleanup: Remove some spurious spaces
Sorry detail-oriented people tend to wipe these out if they notice them.
Add in automated tools and lots of excess end-of-line spaces get wiped
out.

Addresses: https://github.com/karelzak/util-linux/pull/849
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-01 13:01:43 +02:00
Karel Zak 52a1f767c0 Merge branch 'master' of https://github.com/dsd/util-linux
* 'master' of https://github.com/dsd/util-linux:
  libblkid: improve handling of ISO files with partition tables
2019-09-30 11:15:57 +02:00
Daniel Drake 7ef86a0891 libblkid: improve handling of ISO files with partition tables
The ISO format specifically leaves the first 32kb blank so that it
can be used for other purposes, such as adding a partition table.
This is commonly used (e.g. by Endless and Fedora installation media) to
have partition 0 starting at sector 0 as a mountable iso9660 filesystem,
followed by more partitions (e.g. an EFI system partition).
Such layouts can be easily created by tools such as xorriso.

When plugging in a USB disk flashed with this type of ISO, blkid presents
a somewhat confusing view of the block devices. Taking the example of
a 'sda' disk with two partitions:
 1. The "iso partition"
 2. An unformatted partition

In such a setup, before the changes here, blkid will currently report the
ISO metadata attributes ID_FS_PUBLISHER_ID, ID_FS_UUID, ID_FS_LABEL, and
ID_FS_TYPE=iso9660 on both sda *and* sda1.

Since sda2 is unformatted, it won't have any ID_FS_ attributes of it's
own. And due to the following standard udev rule:

  # for partitions import parent information
  ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"

sda2 will actually import all of the ID_FS_ stuff from the parent device
sda.

The result at this point is that three udev devices all have the same
ID_FS_ attribute values, leading to strange results such as three
devices all racing to own the link in /dev/disk/by-uuid, so you can't
reliably do a mount-by-UUID.

Clean up this situation by detecting such partitioned ISO disks
in the superblock probing setup. If files of this kind are detected,
we now only expose the ISO metadata attributes on the specific partition
that points to the ISO data (and not the parent disk).

Signed-off-by: Daniel Drake <drake@endlessm.com>
2019-09-25 11:41:30 +08: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
Radka Skvarilova 2062164894 tests: lscpu s390 nested virtualization
Signed-off-by: Radka Skvarilova <rskvaril@redhat.com>
Addresses:https://bugzilla.redhat.com/show_bug.cgi?id=1739443
2019-09-22 13:49:45 +02:00
Karel Zak d978ec31f7 Merge branch 'typos' of https://github.com/kerolasa/util-linux
* 'typos' of https://github.com/kerolasa/util-linux:
  bash-completion: update options
  misc: fix typos [codespell]
2019-09-16 12:38:43 +02:00
Karel Zak c50d77e6a3 tests: update sfdisk dumps
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-16 12:01:54 +02:00
Sami Kerola 218b1dd6f9
misc: fix typos [codespell]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-09-12 19:41:46 +01:00
Karel Zak b008e4d668 tests: (sfdisk) update move output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-09 11:27:03 +02:00
Karel Zak 492a5c70b4 Merge branch 'xfs-v5' of https://github.com/mator/util-linux
* 'xfs-v5' of https://github.com/mator/util-linux:
  tests: Add test for current version (v5) of XFS filesystem
2019-09-06 10:33:45 +02:00
Karel Zak 91099dea35 tests: update sfdisk wipe output
- stderr is used for the warning (like in fdisk)

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-05 16:46:14 +02:00
Anatoly Pugachev 037bc610e5 tests: Add test for current version (v5) of XFS filesystem
Old xfs.img cannot be used with current version (5.0) of xfsprogs, so create
a new version of xfs-v5.img.

Since I wasn't able to find logs on how was created old xfs.img, saving
create log with this commit message:

$ fallocate -l 16M xfs-v5.img
$ mkfs.xfs -L test-xfs-v5 xfs-v5.img
$ ./blkid -p -o udev xfs-v5.img | sort -V > tests/expected/blkid/low-probe-xfs-v5
$ xz -c xfs-v5.img > tests/ts/blkid/images-fs/xfs-v5.img.xz

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2019-09-03 19:08:22 +03:00
Karel Zak e7d318a9dd tests: (blkid) update regression tests (due to BLOCK_SIZE)
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-02 12:57:11 +02:00
Karel Zak 50c77b6afe tests: (colcrt) use env to set locale
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-30 20:46:58 +02:00
Karel Zak e3803ff869 tests: (getopt) remove unwanted paths from error output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-30 20:46:44 +02:00
Karel Zak eb61e95f1c tests: remove unbuffered ts_run feature
It's unnecessary as stdout and stderr are split in the tests.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-30 16:30:35 +02:00
Karel Zak 18c1f9e643 tests: add remaining stderr outputs
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-30 16:10:01 +02:00
Karel Zak cbf858aa08 tests: split stdout and stderr
* 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>
2019-08-30 15:50:07 +02:00
Patrick Steinhardt 59a46f36b6 tests: use env and support both unbuffer/stdbuf
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>
2019-08-28 08:56:24 +02:00
Karel Zak 71210f5bab tests: don't show diff for TS_KNOWN_FAIL
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-27 14:38:21 +02:00
Karel Zak 751fae0d96 tests: improve unbuffer check
* 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>
2019-08-27 14:28:11 +02:00
Patrick Steinhardt 2ede7ec214 tests: (fdisk) avoid hardcoding of errno string
The test fdisk/oddinput hardcodes strings returned by strerror(3P) for
both the errors ENOENT and ENOTTY. As these strings are unportable,
convert the tests to use the test_strerror helper instead to convert
them with sed(1).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2019-08-27 14:25:32 +02:00
Karel Zak f612c4c674 tests: fix --unbuffered mode with ASAN
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>
2019-08-27 13:02:38 +02:00
Patrick Steinhardt eebc9e4dc2 tests: (col) avoid hardcoding of errno string
The col/multibyte test has a hardcoded error string as part of its
expected output that is returned by glibc's strerror(3P) function. Even
though many of these strings are the same across libc implementations,
they are not standardiced and some are certainly different. One example
is the string for EILSEQ on musl libc.

To fix this, we introduce a new test helper "test_strerror". The helper
can be invoked with an error code like "EILSEQ", which will cause it to
print out the the respective error message for that code. Note that
"test_strerror" cannot act on the error's value (e.g. 84 for EILSEQ), as
these aren't standardized either. Instead, we thus need to have an array
of the error's string representation ("EILSEQ") to its respective error
code (the define EILSEQ). The array can trivially be extended as
required, thus it is only sparsely populated with EILSEQ right now.

To fix the col/multibyte test, we introduce a call to sed(1) to replace
the strerror(3P) message from EILSEQ with "EILSEQ". Furthermore, as
we're running tests with the POSIX locale by default which treats all
bytes as valid multibyte sequences, we have to change to the C.UTF-8
locale instead to actually get an error.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2019-08-27 09:37:01 +02:00
Patrick Steinhardt 6ef9a9e184 tests: (column) use actually invalid multibytes to test encoding
If reading an invalid multibyte sequence, column(1) will encode the byte
as "\x<hex>" instead. The tests try to verify that by piping "£" into
column(1). As the tests run with LC_ALL=POSIX by default, though, libc
implementations strictly adhering to the POSIX standard will treat all
characters as valid multibyte characters. As a consequence, no EILSEQ is
raised by mbtowc(3P) and the character is not encoded as hex, breaking
the test.

Fix this by setting LC_ALL=C.UTF-8. As "£" is a valid UTF-8 character,
we also change the test to use a proper illegal multibyte sequence.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2019-08-27 09:36:50 +02:00
Patrick Steinhardt 5718f8d96b tests: (colcrt) fix reliance on EILSEQ in POSIX locale
The input file "crash1" in the colcrt/regressions test contains the
illegal byte sequence "\x94\x7e". While "\x7e" is '~', "\x94" is not a
valid character. Thus, the test assumes that getwc(3P) will return
`WEOF` and set `errno=EILSEQ`, causing colcrt(1) to abort reading the
stream and thus not print the trailing '~'.

This assumption holds just fine for glibc as it will dutifully report
EILSEQ, but musl libc will happily read the complete stream without
complaining about the illegal character. But in fact, as tests run with
LC_ALL=POSIX by default, glibc's behaviour is wrong while musl is right.
Quoting mbrtowc(3P) from POSIX.1-2017:

    [EILSEQ] An invalid character sequence is detected. In the POSIX locale an
             [EILSEQ] error cannot occur since all byte values are valid
             characters.

Fix the issue by running the colcrt tests with C.UTF8 locale.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2019-08-27 09:36:38 +02:00
Patrick Steinhardt 8892f94c57 tests: (libfdisk) remove reliance on buffer behaviour of standard streams
The tests in libfdisk/mkpart-full all rely on the buffering behaviour of
standard output and standard error streams, most importantly that stderr
is non-buffering and stdout is buffering. This doesn't hold on all libc
implementations when redirecting to a file, breaking the test suite on
such platforms.

Use `ts_run --unbuffered` to stop buffering of the standard output
stream to fix this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2019-08-27 09:36:26 +02:00
Patrick Steinhardt 801d689e47 tests: remove reliance on buffer behaviour of stderr/stdout streams
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
2019-08-27 09:36:05 +02:00
Karel Zak 5200aa99d2 partx: document -d vs. --nr and fix test
The commit ab025087f9 has disabled error
message, but unfortunately it keeps wrong return code. This has been fixed
by commit 53ae7d60cf.

This commit add hit about it to docs and fix regression test too.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-21 13:42:22 +02:00
Karel Zak 424b66c514 tests: Skip fdisk/mbr-nondos-mode on Sparc as unsupported
The test has been originally designed as usable on sparc, but now we
use it for many features which are MBR specific.

Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Co-Author: Anatoly Pugachev <matorola@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-19 14:30:35 +02:00
Karel Zak c60231a744 tests: update fdisk output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-08 14:20:05 +02:00
Karel Zak 11aaedf574 tests: use subtests for mountpoint(1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-07 11:45:57 +02:00
Sami Kerola 6d56251220
mountpoint: add --nofollow option
The no follow option will allow user to distinct mount points from symbolic
links pointing to them.  Arguably this is pretty pedantic option, mounting a
device or bind mount to a directory via symlink does not have or cause any
issues.

Addresses: https://github.com/karelzak/util-linux/issues/832
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-08-02 19:39:05 +01:00
Yousong Zhou 325bfd53e8 column: fix outputing empty column at the end of line
The following commands manifests the problem.  In old versions before
commit 4762ae9d60 ("column: use libsmartcols for --table"), both of them
should output with 2 "|"

	echo '||'  | column -o '|' -s '|' -t
	echo '|| ' | column -o '|' -s '|' -t

Fixes: 4762ae9d60 ("column: use libsmartcols for --table")
Signed-off-by: Yousong Zhou <zhouyousong@yunionyun.com>
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
2019-07-29 10:33:58 +02:00
Karel Zak 7ea0907364 tests: (fdisk) update padding in output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-07-23 16:35:20 +02:00
Karel Zak fc970a0947 tests: (libsmartcols) add padding tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-07-23 16:26:48 +02:00
Karel Zak 94dbb32273 libsmartcols: cleanup and extend padding functionality
LIBSMARTCOLS_DEBUG_PADDING=on in the next examples forces libsmartcols
print '.' as a padding char. See line "ffff" in the exmaples.

* default output is to fill all except last cell

	$ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10  --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null
	NAME.. ......NUM STRINGS STRINGS
	aaaa.. ........0 aaaa... aaaa
	bbb... ......100 bbb.... bbb
	ccccc. .......21 ccccc.. ccccc
	dddddd ........3 dddddd. dddddd
	ee.... ......411 ee..... ee
	ffff.. .....5111 .......
	gggggg 678993321 gggggg. gggggg
	hhh... ..7666666 hhh.... hhh

* scols_table_enable_minout() minimizes output for tailing empty cells, example:

	$ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --minout  --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null
	NAME.. ......NUM STRINGS STRINGS
	aaaa.. ........0 aaaa... aaaa
	bbb... ......100 bbb.... bbb
	ccccc. .......21 ccccc.. ccccc
	dddddd ........3 dddddd. dddddd
	ee.... ......411 ee..... ee
	ffff.. .....5111
	gggggg 678993321 gggggg. gggggg
	hhh... ..7666666 hhh.... hhh

* cleanup up scols_table_enable_maxout() use, example:

	$ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --maxout  --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null
	NAME.............. ..................NUM STRINGS............ STRINGS............
	aaaa.............. ....................0 aaaa............... aaaa...............
	bbb............... ..................100 bbb................ bbb................
	ccccc............. ...................21 ccccc.............. ccccc..............
	dddddd............ ....................3 dddddd............. dddddd.............
	ee................ ..................411 ee................. ee.................
	ffff.............. .................5111 ................... ...................
	gggggg............ ............678993321 gggggg............. gggggg.............
	hhh............... ..............7666666 hhh................ hhh................

Note that we cannot make scols_table_enable_minout() default because
for example "column --table" is pretty commonly used with non-blank
columns separator and in this case all cells has to be filled.

	$ echo -e "aa,b,ccc\na,,\naaa,bbb,ccc" |  column --table --separator ',' --output-separator '|'
	aa |b  |ccc
	a  |   |
	aaa|bbb|ccc

Addresses: https://github.com/karelzak/util-linux/issues/826
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-07-23 16:24:42 +02:00
Karel Zak 8ebecc18e8 tests: (libmount) make X-* and x-* more robust
Addresses: https://github.com/karelzak/util-linux/issues/818
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-07-15 12:46:11 +02:00
Karel Zak d06ffd28d4 tests: update build-sys output
It seems, no more libgcc_s...

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-06-14 12:06:58 +02:00
Karel Zak bb272bb85e tests: add asan build-sys test
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-29 13:22:01 +02:00
Sami Kerola 23df051030
lscpu: fix floating point exception
As the title tells this change indeed fixes floating point exception, but
post processing as value overwrite feels a wrong.  Possibly something in
input is making cpu set count to go wrong, but I could not get my head
around what could it be.  Anyway avoiding division by zero seems better than
crashing so lets do this atleast for now.

Caused-by: e5f721132e
Addresses: https://github.com/karelzak/util-linux/issues/788
Reported-by: Lars Wendler <polynomial-c@gentoo.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-05-18 18:43:08 +01:00
Sami Kerola 30d5ceeda8
lscpu: remove extra space from field key name
The extra space was more obvious in json output.  But as the expected test
output displays also the standard output can be effected by this change.

    $ lscpu --json | jq '.lscpu | .[].field' | grep ': '
    "L1d cache: "
    "L1i cache: "
    "L2 cache: "
    "L3 cache: "
    "Vulnerability L1tf: "
    "Vulnerability Mds: "
    "Vulnerability Meltdown: "
    "Vulnerability Spec store bypass: "
    "Vulnerability Spectre v1: "
    "Vulnerability Spectre v2: "

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-05-16 22:04:03 +01:00
Sami Kerola b94acada9e
lscpu: move trailing null after removing characters from a string
From the test input string ':' characters are removed:

    cat x86_64-epyc_7451/sys/devices/system/cpu/vulnerabilities/spectre_v2
    Mitigation: Full AMD retpoline, IBPB: conditional, STIBP: disabled, RSB filling

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-05-16 11:45:47 +01:00
Karel Zak df8434230b tests: build-sys update
* libblkid does not depend on libuuid anymore
* libncurses depends on libdl due to

  $ ncursesw6-config --libs
  -lncursesw -ltinfo -ldl

* new command hardlink (with dependence on libpcre2-8
* hwclock needs librt

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-29 14:47:19 +02: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 19bc8ef897 tests: fix TS_ENABLE_ASAN usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-17 10:38:50 +02:00
Karel Zak 2da48ba3cc tests: use TS_ENABLE_ASAN in tests to detect ASAN
It seems better to not use any random ASAN variable.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-17 10:10:46 +02:00
Karel Zak 1271e63c49 tests: ignore errors with enabled ASAN in python bindings
temporary solution... as it ends with
	undefined symbol: __asan_option_detect_stack_use_after_return

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-15 12:58:48 +02:00
Karel Zak 8b2464ae2a tests: update lscpu due to 'Vulnerability' fields
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-11 13:55:51 +02:00
Karel Zak 5b13d6a1c9 tests: add /mnt/test/foo^Mbar to mountinfo tests
Addresses: https://github.com/karelzak/util-linux/issues/780
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-08 15:22:27 +02:00
Karel Zak 0e86bc8406 lscpu: add --caches
$ lscpu -C
NAME ONE-SIZE ALL-SIZE WAYS TYPE        LEVEL
L3         8M       8M   16 Unified         3
L2       256K       1M    8 Unified         2
L1i       32K     128K    8 Instruction     1
L1d       32K     128K    8 Data            1

The patch also updates extra caches (s390) output in lsblk summary to
be compatible with output about normal caches.

Addresses: https://github.com/karelzak/util-linux/issues/663
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-19 14:11:20 +01:00
Karel Zak 1b4b184cc8 tests: update lscpu output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-19 13:56:26 +01:00
Karel Zak 16ca05511b lscpu: add 'Frequency boost'
Show turbo boost status on platforms where is available a file
/sys/devices/system/cpu/cpufreq/boost.

Addresses: https://github.com/karelzak/util-linux/issues/755
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-15 13:37:51 +01:00
Karel Zak 2648be66d2 tests: add missing ts_check_test_command call
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-05 13:56:33 +01: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 bb872a239c tests: add missing TS_CMD_UMOUNT check
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-04 17:32:03 +01:00
Karel Zak 2fadcded53 tests: (kill) do not use shell build-in
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-04 17:28:15 +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
Karel Zak 19e00ec9e9 tests: add missing ts_check_test_command calls
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-04 16:42:30 +01:00
Karel Zak 3cd5e33b5c Merge branch 'evelu-epyc' of https://github.com/ErwanAliasr1/util-linux
* 'evelu-epyc' of https://github.com/ErwanAliasr1/util-linux:
  test: Adding AMD EPYC 7451 24-Core Processor
2019-03-04 11:46:16 +01:00
Karel Zak 09fc947089 tests: make sure TS_HELPER_MBSENCODE compiled
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-01 15:04:54 +01:00
Karel Zak 777c159353 tests: use subtests in fdisk/mbr-nondos-mode
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-27 12:22:33 +01:00
Karel Zak ca614ef8c7 tests: add fdisk (dos) first sector dialog test
The test verifies that the "First sector" dialog offers relevant range
in the begin of the device if the end of the device is already used.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-27 12:03:28 +01:00
Erwan Velu b24c7d585d test: Adding AMD EPYC 7451 24-Core Processor
This cpu is massively numa and have interesting cache organization.
This will be useful to test & implement issue #663

Signed-off-by: Erwan Velu <e.velu@criteo.com>
2019-02-27 10:16:27 +01:00
Karel Zak 911e694528 libmount: add mnt_table_{find,insert,move}_fs()
Add functions to insert FS into table to specified position and to
move FS between two tables.

Co-Author: Tim Hildering <hilderingt@posteo.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-21 13:49:39 +01:00
Karel Zak f920f73d83 tests: update fdisk outputs
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-12 14:22:49 +01:00
Karel Zak 3b9dc305ee tests: (hardlink) update noregex
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 14:53:51 +01:00
Karel Zak 5c8f6fce22 tests: (hardlink) update summary output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 10:37:42 +01:00
Karel Zak 117f4d8bf4 Merge branch 'hardlink' of https://github.com/rudimeier/util-linux into hardlink
* 'hardlink' of https://github.com/rudimeier/util-linux: (25 commits)
  hardlink: add first simple tests
  hardlink: util-linux usage
  hardlink: fix compiler warnings
  hardlink: style indentations and license header
  hardlink: enable build with and without pcre2
  fixes for the fixes
  temporal fix before re-patch (updates from Fedora repo)
  Update hardlink.1
  Fixed version number, added changelog about Todd Lewis' patch
  exclude files via pcre
  Fixed 32 bit build with gcc7 (RH Bugzilla ID 1422989)
  spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); update FSF address at .c source file
  Revert "spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file"
  spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file
  Mention -f option in the man page
  do not allow to hardlink files across filesystems by default (#786719) (use -f option to override)
  fix possible buffer overflows, integer overflows, update man page
  fix URL and remove mmap() (#676962, #672917)
  - update docs to describe highest verbosity -vv option (#210816) - use dist Resolves: 210816
  mostly spec cleanup
  ...
2019-02-06 13:55:20 +01:00
Karel Zak cc06250f11 col: improve error message, update regression test
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-05 18:07:26 +01:00
Kenneth Van Alstyne 36b0530e12 Removed BlueStore VERSION information as it is gibberish 2018-12-17 20:21:32 -06:00
Kenneth Van Alstyne c011711ad6 Updated BlueStore expected result 2018-12-17 12:07:14 -06:00
Kenneth Van Alstyne 6032c9f1f8 Added BlueStore test image 2018-12-17 11:05:24 -06:00
Karel Zak 9e07672bb9 tests: check for tar and {b,g}zip
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-12-11 11:44:48 +01:00
Karel Zak 0d79f5805f tests: make lsns-netnsid portable
It seems ip(8) link-show command does not provide link-netnsid in all
cases (versions ?). Let's try to use "ip netns list-id" as fallback.

This commit also add possibility to debug the script by $LOG variable.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-30 12:24:15 +01:00
Karel Zak 7174b93dfd tests: enlarge backing file for fstab-btrfs
It seems the new limit for Btrfs is 47MiB.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-30 12:22:48 +01:00
Roland Kammerer 627a0efa75 tests: add test images for drbd v08/v09
This adds DRBD meta data images for DRBD versions 8 and 9, as well as
the according expected output.

Signed-off-by: Roland Kammerer <roland.kammerer@linbit.com>
2018-11-29 10:35:25 +01:00
Ruediger Meier bd0be5e02a hardlink: add first simple tests
The test still fails without pcre2 and may also make problems on
exotic file systems.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-11-15 21:26:14 +01:00
Thomas Deutschmann 8f93c8c71d
tests: run oids test only when uuidgen tool was built
oids test did not check if uuidgen was available.

oids test was also calling uuidgen from PATH which could result
in wrong results if uuidgen from a previous util-linux installation
was used.

With this commit we will check if uuidgen was built and make sure
that we only call the uuidgen binary we just built. If uuidgen is
not available we will skip this test.
2018-11-11 02:18:25 +01:00
Karel Zak 99c92a4820 tests: add choom to build-sys test
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-24 11:37:13 +02:00
Karel Zak a1b463d94a tests: update sfdisk resize
due to 2f35c1ead6

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-17 16:22:14 +02:00
Karel Zak 7edaf221d6 test: update UUID v5 tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-08-31 12:48:46 +02:00
Karel Zak 1e3bc261d0 tests: update fdisk output
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-08-30 15:24:41 +02:00
Karel Zak 11159cca21 tests: add column --table-empty-lines test
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-08-23 13:41:05 +02:00
Karel Zak f2538b6a86 tests: add cal --span tests
Addresses: https://github.com/karelzak/util-linux/issues/677
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-08-07 11:06:13 +02:00
Karel Zak 549281cb87 tests: check for test_cal
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-08-07 10:59:06 +02:00
Karel Zak c6789d37ea tests: update lscpu tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-08-01 12:09:09 +02:00
Karel Zak d68588b0c6 tests: update fdisk dialogs
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-07-31 15:20:55 +02:00
Karel Zak 690fa00b6c tests: add mountinfo with empty source
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-07-10 14:04:09 +02:00
Karel Zak 91d28f5986 tests: add simple LVM lsblk dump
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-06-21 13:19:28 +02:00
Karel Zak d6d24dda29 tests: add simple ATA and NVME lsblk dump
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-06-21 13:19:28 +02:00
Karel Zak 314adce668 tests: add lsblk test script
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-06-21 13:19:28 +02:00
Karel Zak 8ab664a77e tests: add simple & stupid script to generate lsblk /sys and /proc dump
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-06-21 13:19:28 +02:00
Karel Zak 641af90dce tests: add empty column test
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-06-04 15:27:54 +02: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
Pali Rohár 4c837d4ffe libblkid: udf: Fix reporting UDF 2.60 revision
According to the UDF 2.60 specification, the Minimum UDF Read Revision
value shall be at most #0250 for all media with a UDF 2.60 file system.

So in this case use Minimum UDF Write Revision as ID_FS_VERSION to
distinguish between UDF 2.50 and UDF 2.60 discs.

This commit also adds a testing Blu-Ray Recordable image with UDF revision
2.60 created by Nero which really sets Minimum UDF Read Revision to 2.50.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2018-05-25 17:52:31 +02:00
Karel Zak aa4e132f57 tests: update script done messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-14 13:54:41 +02:00
Karel Zak 400c1c574b tests: update script headers
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-14 12:57:39 +02:00
Karel Zak 4dfdb1b143 tests: remove debug stuff from ts/script/options
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-14 11:56:46 +02:00
Fred Mora aefe989338 script: add the -o/--output-limit option. Fix race test.
When script is used on a host with a relatively small free disk space, it
is sometimes desirable to limit the size of the captured output. This
can now be enforced with the --output-limit option.

The --output-limit option lets the user specify a maximum size. The program
uses the size parsing from strutils and thus supports the usual
multiplicative suffixes (kiB, KB, MiB, MB, etc.). After the specified
number of bytes have been written to the output file, the script program
will terminate the child process.

Due to buffering, the size of the output file might exceed the specified
limit. This limit also does not include the start and done messages.

The race test was throwing an error dur to a variable being "" in some cases.
Quoting the variable in the equal test took care of that test.

[kzak@redhat.com: - use done() to stop script
                  - count also timing file
                  - remove unnamed member initialization in ctl struct
                  - add to bash-completion]

Signed-off-by: Fred Mora <fmora@datto.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-14 11:32:23 +02:00
Karel Zak 6156e12972 tests: update sfdisk JSON output
References: d881b77331
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-04-06 13:39:35 +02:00
Karel Zak 704f9ba6e6 lsmem: improve JSON output
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-04-05 12:14:46 +02:00
Karel Zak a40c12837f tests: update JSON outputs
It does not contains extra space after ":" separator anymore.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-04-04 14:22:04 +02:00
Karel Zak 5c25aca67a tests: remove namei(1) failed lstat test
The strerror() output is is nothing stable and may be different on
another systems. It would be possible to use sed(1) to unify the
output, but it seems overkill in this case.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-27 14:21:46 +02:00
Karel Zak 04060bc3f1 Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
  tests: Add tests for FAT32 labels
  blkid: Encode any field which starts with LABEL in same way as LABEL field
  libblkid: vfat: Change parsing label in special cases
2018-03-27 12:54:53 +02:00
Karel Zak dfffcf0cd3 tests: update column(1) space-separator test
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-27 11:52:54 +02:00
Karel Zak 651c5d428c column: fix leading space characters bug
The bug has been introduced during column(1) rewrite. The function
read_input() need to skip leading space only temporary to detect empty
lines, but the rest of the code has to use the original buffer (line).
I've tried to fix one of the symptoms by 5c7b67fbbf
(alter), but this solution is unnecessary and too complex.

Changes:

* don't ignore leading space
* remove unnecessary stuff introduced by 5c7b67fbbf
* fix regression test with incorrect separator

Addresses: https://github.com/karelzak/util-linux/issues/575
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1560283
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-27 10:55:27 +02:00
Karel Zak 51684b312e tests: use libtool to execute with valgrind
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>
2018-03-21 12:23:22 +01:00
Karel Zak 5a2b7739b0 tests: update lsmem
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 19:06:22 +01:00