diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-02 22:20:39 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-02 22:33:04 -0400 |
commit | c9c5a69cc2098e999ddb76d8fd282a3fb6334cb1 (patch) | |
tree | 63c70b7a4a58c9547eab265f5ea2cc58ea4136ef /test | |
parent | a6ef2ffed4af47ff360bf0fc508aa24e83418f97 (diff) |
bugfix [1/2]: libredbdiff: Add a test for handling multiple provides.
Also make the minimal changes to the program to make this testing possible.
Diffstat (limited to 'test')
-rw-r--r-- | test/libredbdiff-test.sh | 29 | ||||
-rw-r--r-- | test/libredbdiff.d/expected.txt | 1 | ||||
-rw-r--r-- | test/libredbdiff.d/statedir/pacman.archlinux/local/ALPM_DB_VERSION | 1 | ||||
-rw-r--r-- | test/libredbdiff.d/statedir/pacman.archlinux/sync/core.db | bin | 0 -> 1017 bytes | |||
-rw-r--r-- | test/libredbdiff.d/statedir/pacman.conf.archlinux | 6 | ||||
-rw-r--r-- | test/libredbdiff.d/statedir/pacman.conf.parabola | 6 | ||||
-rw-r--r-- | test/libredbdiff.d/statedir/pacman.parabola/local/ALPM_DB_VERSION | 1 | ||||
-rw-r--r-- | test/libredbdiff.d/statedir/pacman.parabola/sync/libre.db | bin | 0 -> 1062 bytes |
8 files changed, 44 insertions, 0 deletions
diff --git a/test/libredbdiff-test.sh b/test/libredbdiff-test.sh new file mode 100644 index 0000000..1b267e3 --- /dev/null +++ b/test/libredbdiff-test.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env roundup + +describe libredbdiff +. ./test-common.sh + +common_before() { + mkdir -p "$XDG_CONFIG_HOME/libretools" + printf '%s\n' \ + 'statedir="$PWD"' \ + "mirror='http://repo.parabola.nu/\$repo/os/\$arch'" \ + "mirrorarch='http://mirrors.kernel.org/archlinux/\$repo/os/\$arch'" \ + > $XDG_CONFIG_HOME/libretools/libredbdiff.conf +} + +it_displays_help() { + LC_ALL=C libredbdiff -h >$tmpdir/stdout 2>$tmpdir/stderr + + [[ "$(sed 1q $tmpdir/stdout)" =~ Usage:.* ]] + empty $tmpdir/stderr +} + +it_handles_packages_with_multiple_provides() { + cd libredbdiff.d/statedir + + libredbdiff -n libre >$tmpdir/stdout 2>$tmpdir/stderr + + empty $tmpdir/stderr + diff -w ../expected.txt $tmpdir/stdout +} diff --git a/test/libredbdiff.d/expected.txt b/test/libredbdiff.d/expected.txt new file mode 100644 index 0000000..8fb89bf --- /dev/null +++ b/test/libredbdiff.d/expected.txt @@ -0,0 +1 @@ +p linux-libre linux 4.10.12_gnu-2 | 4.10.13-1 diff --git a/test/libredbdiff.d/statedir/pacman.archlinux/local/ALPM_DB_VERSION b/test/libredbdiff.d/statedir/pacman.archlinux/local/ALPM_DB_VERSION new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/test/libredbdiff.d/statedir/pacman.archlinux/local/ALPM_DB_VERSION @@ -0,0 +1 @@ +9 diff --git a/test/libredbdiff.d/statedir/pacman.archlinux/sync/core.db b/test/libredbdiff.d/statedir/pacman.archlinux/sync/core.db Binary files differnew file mode 100644 index 0000000..b0f737b --- /dev/null +++ b/test/libredbdiff.d/statedir/pacman.archlinux/sync/core.db diff --git a/test/libredbdiff.d/statedir/pacman.conf.archlinux b/test/libredbdiff.d/statedir/pacman.conf.archlinux new file mode 100644 index 0000000..d4a9c8d --- /dev/null +++ b/test/libredbdiff.d/statedir/pacman.conf.archlinux @@ -0,0 +1,6 @@ +[options] +DBPath = ./pacman.archlinux +Architecture = x86_64 + +[core] +Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch diff --git a/test/libredbdiff.d/statedir/pacman.conf.parabola b/test/libredbdiff.d/statedir/pacman.conf.parabola new file mode 100644 index 0000000..7b553dd --- /dev/null +++ b/test/libredbdiff.d/statedir/pacman.conf.parabola @@ -0,0 +1,6 @@ +[options] +DBPath = ./pacman.parabola +Architecture = x86_64 + +[libre] +Server = https://repomirror.parabola.nu/$repo/os/$arch diff --git a/test/libredbdiff.d/statedir/pacman.parabola/local/ALPM_DB_VERSION b/test/libredbdiff.d/statedir/pacman.parabola/local/ALPM_DB_VERSION new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/test/libredbdiff.d/statedir/pacman.parabola/local/ALPM_DB_VERSION @@ -0,0 +1 @@ +9 diff --git a/test/libredbdiff.d/statedir/pacman.parabola/sync/libre.db b/test/libredbdiff.d/statedir/pacman.parabola/sync/libre.db Binary files differnew file mode 100644 index 0000000..1bd5065 --- /dev/null +++ b/test/libredbdiff.d/statedir/pacman.parabola/sync/libre.db |