summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <gamblin2@llnl.gov>2021-02-18 00:33:08 -0800
committerGitHub <noreply@github.com>2021-02-18 08:33:08 +0000
commit7d586234ee6cdfcade11678d98129d8dfcb84c80 (patch)
tree5fbc0d8fa04aaacb5fe200bdd35a872879eaedcf /lib
parent8aaf31b1661f78e77a8e788f761fa88655e23c14 (diff)
downloadspack-7d586234ee6cdfcade11678d98129d8dfcb84c80.tar.gz
spack-7d586234ee6cdfcade11678d98129d8dfcb84c80.tar.bz2
spack-7d586234ee6cdfcade11678d98129d8dfcb84c80.tar.xz
spack-7d586234ee6cdfcade11678d98129d8dfcb84c80.zip
bugfix: relax racy test in fg/bg output (#21755)
Since signals are fundamentally racy, We can't bound the amount of time that the `test_foreground_background_output` test will take to get to 'on', we can only observe that it transitions to 'on'. So instead of using an arbitrary limit, just adjust the test to allow either 'on' or 'off' followed by 'on'. This should eliminate the spurious errors we see in CI.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/llnl/util/tty/log.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/spack/spack/test/llnl/util/tty/log.py b/lib/spack/spack/test/llnl/util/tty/log.py
index d29223676c..080a6e1339 100644
--- a/lib/spack/spack/test/llnl/util/tty/log.py
+++ b/lib/spack/spack/test/llnl/util/tty/log.py
@@ -437,20 +437,14 @@ def test_foreground_background_output(
with open(log_path) as log:
log = log.read().strip().split("\n")
- # Controller and minion process coordinate with locks such that the minion
- # writes "off" when echo is off, and "on" when echo is on. The
- # output should contain mostly "on" lines, but may contain an "off"
- # or two. This is because the controller toggles echo by sending "v" on
- # stdin to the minion, but this is not synchronized with our locks.
- # It's good enough for a test, though. We allow at most 4 "off"'s in
- # the output to account for the race.
- #
- # Originally we only allowed 2, but GitHub's macOS runners seem to be
- # very slow, and frequently we get 3 "off"'s. Increased limit to 4 to
- # account for this. Real errors should still be caught with this limit.
+ # Controller and minion process coordinate with locks such that the
+ # minion writes "off" when echo is off, and "on" when echo is on. The
+ # output should contain mostly "on" lines, but may contain "off"
+ # lines if the controller is slow. The important thing to observe
+ # here is that we started seeing 'on' in the end.
assert (
['forced output', 'on'] == uniq(output) or
- output.count("off") <= 4 # if controller_fd is a bit slow
+ ['forced output', 'off', 'on'] == uniq(output)
)
# log should be off for a while, then on, then off