guix-commits
[Top][All Lists]
Advanced

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

07/07: tests: Fix race condition in profile locking test.


From: guix-commits
Subject: 07/07: tests: Fix race condition in profile locking test.
Date: Fri, 29 Nov 2019 09:54:29 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit dac7928d502d9ba4fc6a9621e5b2b15019d92d5b
Author: Ludovic Courtès <address@hidden>
Date:   Fri Nov 29 15:31:04 2019 +0100

    tests: Fix race condition in profile locking test.
    
    Previously, there was a possibility that "guix install emacs" would grab
    the lock before "guix package -m $module_dir/manifest.scm".  When that
    happened, the test would start building Emacs and all its dependencies,
    which could take a while and some disk space.
    
    This is a followup to b1fb663404894268b5ee92c040f12c52c0bee425.
    
    * tests/guix-package.sh: In profile locking test, emit
    "$module_dir/ready" from the manifest and wait for it to exist before
    running "guix install emacs".
---
 tests/guix-package.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 6d081d5..f9fb310 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -468,8 +468,10 @@ guix package --list-profiles | grep '\.guix-profile'
 
 # Make sure we can properly lock a profile.
 mkdir "$module_dir"
-echo '(sleep 60)' > "$module_dir/manifest.scm"
+echo "(open-output-file \"$module_dir/ready\") (sleep 60)" \
+     > "$module_dir/manifest.scm"
 guix package -m "$module_dir/manifest.scm" -p "$module_dir/profile" &
 pid=$!
+while [ ! -f "$module_dir/ready" ] ; do sleep 0.5 ; done
 if guix install emacs -p "$module_dir/profile"; then kill $pid; false; else 
true; fi
 kill $pid



reply via email to

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