unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 2c21d45a6b26a2c86fa142c338313d983c615c4f 2380 bytes (raw)
name: tests/guix-index.sh 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
# GNU Guix --- Functional package management for GNU
# Copyright © 2013, 2014, 2015, 2019, 2020, 2023 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
# GNU Guix is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Guix is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

#
# Test the 'guix index' command-line utility.
#

set -x

tmpdir="guix-index-$$"
trap 'rm -rf "$tmpdir"' EXIT

guix index --version

# Basic application to install and lookup through the index subcommand
APPLICATION=guile-bootstrap

# The subcommand exposes two indexation methods so far:
# - manifests: fast and less exhaustive
# - store: slow, exhaustive

# In the following tests, we will store in 2 different dbs for both indexation
# methods
tmpdb_manifests="$tmpdir/manifests/db.sqlite"
tmpdb_store="$tmpdir/store/db.sqlite"

echo "### Preparing db locations for both indexation methods"
mkdir -p `dirname $tmpdb_manifests` `dirname $tmpdb_store`

cmd_manifests="guix index --db-path=$tmpdb_manifests --method=manifests"
cmd_store="guix index --db-path=$tmpdb_store --method=store"

echo "### Lookup without any db should fail"
! $cmd_manifests search "$APPLICATION"
! $cmd_store search "$APPLICATION"

echo "### Initializing db with bare guix store should work"
$cmd_manifests
# ! $cmd_store

echo "### lookup without anything in db should yield no result"
! test `$cmd_manifests search "$APPLICATION"`
# ! test `$cmd_store search "$APPLICATION"`

echo "### Add some package to the temporary store"
guix package --bootstrap \
     --install $APPLICATION \
     --profile=$tmpdir/profile

echo "### Both both indexation call should work"
# Testing indexation should work for both method
test `$cmd_manifests`
# test `$cmd_store`

echo "### lookup indexed '$APPLICATION' should yield result"

test `$cmd_manifests search "$APPLICATION"`
# test `$cmd_store search "$APPLICATION"`

debug log:

solving 2c21d45a6b ...
found 2c21d45a6b in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).