summaryrefslogtreecommitdiff
path: root/tests/kolainst
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2021-06-21 10:12:40 -0400
committerGitHub <noreply@github.com>2021-06-21 10:12:40 -0400
commit7ff848f1019b9a497c650c24d6b14e346c9919e0 (patch)
treeea693667f072eef141d8f978728ee949b92204d1 /tests/kolainst
parenta8eee7b27f9b60f25f329d63f0aabcebfe8da7cb (diff)
parent14d6e757520c853cd14ada5a4d0a084ddf400f51 (diff)
downloadostree-7ff848f1019b9a497c650c24d6b14e346c9919e0.tar.gz
Merge pull request #2377 from smcv/libtest-core
libtest-core: Add some improvements from bubblewrap
Diffstat (limited to 'tests/kolainst')
-rw-r--r--tests/kolainst/libtest-core.sh29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/kolainst/libtest-core.sh b/tests/kolainst/libtest-core.sh
index 64b3e0a3..9632e905 100644
--- a/tests/kolainst/libtest-core.sh
+++ b/tests/kolainst/libtest-core.sh
@@ -5,7 +5,8 @@
#
# Known copies are in the following repos:
#
-# - https://github.com/projectatomic/rpm-ostree
+# - https://github.com/containers/bubblewrap
+# - https://github.com/coreos/rpm-ostree
#
# Copyright (C) 2017 Colin Walters <walters@verbum.org>
#
@@ -83,6 +84,18 @@ _fatal_print_file() {
fatal "$@"
}
+_fatal_print_files() {
+ file1="$1"
+ shift
+ file2="$1"
+ shift
+ ls -al "$file1" >&2
+ sed -e 's/^/# /' < "$file1" >&2
+ ls -al "$file2" >&2
+ sed -e 's/^/# /' < "$file2" >&2
+ fatal "$@"
+}
+
assert_not_has_file () {
if test -f "$1"; then
_fatal_print_file "$1" "File '$1' exists"
@@ -156,8 +169,22 @@ assert_file_empty() {
fi
}
+assert_files_equal() {
+ if ! cmp "$1" "$2"; then
+ _fatal_print_files "$1" "$2" "File '$1' and '$2' is not equal"
+ fi
+}
+
# Use to skip all of these tests
skip() {
echo "1..0 # SKIP" "$@"
exit 0
}
+
+report_err () {
+ local exit_status="$?"
+ { { local BASH_XTRACEFD=3; } 2> /dev/null
+ echo "Unexpected nonzero exit status $exit_status while running: $BASH_COMMAND" >&2
+ } 3> /dev/null
+}
+trap report_err ERR