guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/13: squash! Update test.


From: guix-commits
Subject: 03/13: squash! Update test.
Date: Sun, 21 May 2023 17:40:23 -0400 (EDT)

civodul pushed a commit to branch wip-guix-index
in repository guix.

commit 5f2d3881540d35a487b4ecd5932687cd13221f37
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Apr 2 18:02:24 2023 +0200

    squash! Update test.
    
    Test now runs fine.
---
 tests/guix-index.sh | 70 ++++++++++++++++++++++++++---------------------------
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/tests/guix-index.sh b/tests/guix-index.sh
index 2c21d45a6b..8e77e53371 100755
--- a/tests/guix-index.sh
+++ b/tests/guix-index.sh
@@ -1,5 +1,6 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2013, 2014, 2015, 2019, 2020, 2023 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2023 Antoine R. Dumont <antoine.romain.dumont@gmail.com>
+# Copyright © 2023 Ludovic Courtès <ludo@gnu.org>
 #
 # This file is part of GNU Guix.
 #
@@ -22,52 +23,51 @@
 
 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
+RUN_EXPENSIVE_TESTS="${RUN_EXPENSIVE_TESTS:-false}"
 
-# In the following tests, we will store in 2 different dbs for both indexation
-# methods
+tmpdir="guix-index-$$"
+# In the following tests, we use two different databases, one for each
+# indexation method.
 tmpdb_manifests="$tmpdir/manifests/db.sqlite"
 tmpdb_store="$tmpdir/store/db.sqlite"
+trap 'rm -rf "$tmpdir" "$tmpdb_store" "$tmpdb_manifests"' EXIT
+
+guix index --version
 
-echo "### Preparing db locations for both indexation methods"
-mkdir -p `dirname $tmpdb_manifests` `dirname $tmpdb_store`
+# 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"
+# Lookup without any db should fail.
+! guix index --db-path="$tmpdb_manifests" search guile
+! guix index --db-path="$tmpdb_store" search guile
 
-echo "### Initializing db with bare guix store should work"
+# Initializing db with bare 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"`
+# Lookup without anything in db should yield no results because the indexer
+# didn't stumble upon any profile.
+test -z "$(guix index --db-path="$tmpdb_manifests" search guile)"
 
-echo "### Add some package to the temporary store"
-guix package --bootstrap \
-     --install $APPLICATION \
-     --profile=$tmpdir/profile
+# Install a package.
+guix package --bootstrap --install guile-bootstrap \
+     --profile="$tmpdir/profile"
 
-echo "### Both both indexation call should work"
+# 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"
+$cmd_manifests
 
-test `$cmd_manifests search "$APPLICATION"`
-# test `$cmd_store search "$APPLICATION"`
+# Look for 'guile'.
+$cmd_manifests search guile
+$cmd_manifests search guile | grep $(guix build guile-bootstrap)/bin/guile
+$cmd_manifests search boot-9.scm | grep ^guile-bootstrap
+
+if $RUN_EXPENSIVE_TESTS
+then
+    $cmd_store
+    $cmd_store search guile
+    $cmd_store search guile | grep $(guix build guile-bootstrap)/bin/guile
+    $cmd_store search boot-9.scm | grep ^guile-bootstrap
+fi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]