Commit graph

12 commits

Author SHA1 Message Date
Frantisek Sumsal 41187e716d test: regenerate module dependencies after installing all modules 2021-09-19 13:46:55 +02:00
Frantisek Sumsal abfa9a0e7d test: fix error handling with set -e
Unfortunately, when checking the return/exit code using &&, ||, if,
while, etc., `set -e` is disabled for all nested functions as well,
which leads to incorrectly ignored errors, *sigh*.

Example:

```
set -eu
set -o pipefail

task() {
    echo "task init"
    echo "this should fail"
    false
    nonexistentcommand
    echo "task end (we shouldn't be here)"
}

if ! task; then
    echo >&2 "The task failed"
    exit 1
else
    echo "The task passed"
fi
```

```
$ bash test.sh
task init
this should fail
test.sh: line 10: nonexistentcommand: command not found
task end (we shouldn't be here)
The task passed
$ echo $?
0
```

But without the `if`, everything works "as expected":

```
set -eu
set -o pipefail

task() {
    echo "task init"
    echo "this should fail"
    false
    nonexistentcommand
    echo "task end (we shouldn't be here)"
}

task
```

```
$ bash test.sh
task init
this should fail
$ echo $?
1
```

Wonderful.
2021-09-19 13:46:55 +02:00
Frantisek Sumsal b1471e559e test: btrfs-related udev tests 2021-09-19 13:46:49 +02:00
Frantisek Sumsal de11005c1a test: use subshells a bit more
to tweak shell flags in specific functions without affecting the rest of
the script.
2021-09-18 20:44:34 +02:00
Frantisek Sumsal b216501a8e test: cleanup the intermediate disk images 2021-09-18 20:44:34 +02:00
Frantisek Sumsal 70ec7736f8 test: tidy up the feature handling 2021-09-18 20:44:34 +02:00
Frantisek Sumsal 776fc8c385 test: unify handling of supported "features" 2021-09-17 17:45:39 +02:00
Frantisek Sumsal 0203b2e4be test: basic LVM tests 2021-09-15 20:17:50 +02:00
Frantisek Sumsal 35497c7c33 test: coverage for #19946 2021-09-12 18:55:58 +02:00
Frantisek Sumsal d0cbad16c5 test: add a basic multipath test + failover 2021-09-12 18:38:42 +02:00
Frantisek Sumsal e205ae0d9c test: use one call to install necessary modules 2021-09-12 18:38:42 +02:00
Frantisek Sumsal f2204ac27d test: udev storage tests 2021-09-08 04:31:24 +09:00