From bcf9975fa19050e07d6724992a75ebde4b0156c5 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Fri, 8 Oct 2021 20:58:22 +0100 Subject: tests: Fix up use of absolute paths for false/true/echo etc. Signed-off-by: Daniel Silverstone --- tests/python/daemon.md | 18 +++++++++--------- tests/python/runcmd.md | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 21 deletions(-) (limited to 'tests') diff --git a/tests/python/daemon.md b/tests/python/daemon.md index 285f9f8..6d9b8f4 100644 --- a/tests/python/daemon.md +++ b/tests/python/daemon.md @@ -17,11 +17,11 @@ This scenario starts a background process, verifies it's started, and verifies it's terminated after the scenario ends. ~~~scenario -given there is no "/bin/sleep 12765" process -when I start "/bin/sleep 12765" as a background process as sleepyhead -then a process "/bin/sleep 12765" is running +given there is no "sleep 12765" process +when I start "sleep 12765" as a background process as sleepyhead +then a process "sleep 12765" is running when I stop background process sleepyhead -then there is no "/bin/sleep 12765" process +then there is no "sleep 12765" process ~~~ @@ -68,12 +68,12 @@ This scenario verifies that if the background process never starts listening on its port, the daemon library handles that correctly. ~~~scenario -given there is no "/bin/sleep 12765" process -when I try to start "/bin/sleep 12765" as sleepyhead, on port 8888 +given there is no "sleep 12765" process +when I try to start "sleep 12765" as sleepyhead, on port 8888 then starting daemon fails with "ConnectionRefusedError" -then a process "/bin/sleep 12765" is running +then a process "sleep 12765" is running when I stop background process sleepyhead -then there is no "/bin/sleep 12765" process +then there is no "sleep 12765" process ~~~ @@ -101,7 +101,7 @@ have had time to produce it yet. ~~~{#chatty-daemon.sh .file .sh .numberLines} -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/tests/python/runcmd.md b/tests/python/runcmd.md index 68465a8..7b88dd3 100644 --- a/tests/python/runcmd.md +++ b/tests/python/runcmd.md @@ -14,8 +14,8 @@ they're verified. It uses the steps and functions from the command, then examine the exit code, standard output (stdout for short), or standard error output (stderr) of the command. -The scenarios use the Unix commands `/bin/true` and `/bin/false` to -generate exit codes, and `/bin/echo` to produce stdout. To generate +The scenarios use the Unix commands `true` and `false` to +generate exit codes, and `echo` to produce stdout. To generate stderr, they use the little helper script below. ~~~{#err.sh .file .sh .numberLines} @@ -32,7 +32,7 @@ variations. ## Successful execution ~~~scenario -when I run /bin/true +when I run true then exit code is 0 and command is successful ~~~ @@ -41,7 +41,7 @@ and command is successful ~~~scenario given a directory xyzzy -when I run, in xyzzy, /bin/pwd +when I run, in xyzzy, pwd then exit code is 0 then command is successful then stdout contains "/xyzzy" @@ -50,7 +50,7 @@ then stdout contains "/xyzzy" ## Failed execution ~~~scenario -when I try to run /bin/false +when I try to run false then exit code is not 0 and command fails ~~~ @@ -59,7 +59,7 @@ and command fails ~~~scenario given a directory xyzzy -when I try to run, in xyzzy, /bin/false +when I try to run, in xyzzy, false then exit code is not 0 and command fails ~~~ @@ -97,7 +97,7 @@ to the reader what's inside. Also, C-style string escapes are understood. ~~~scenario -when I run /bin/echo hello, world +when I run echo hello, world then stdout is exactly "hello, world\n" ~~~ @@ -115,7 +115,7 @@ Exact string comparisons are not always enough, so we can verify a sub-string is in output. ~~~scenario -when I run /bin/echo hello, world +when I run echo hello, world then stdout contains "world\n" and exit code is 0 ~~~ @@ -135,7 +135,7 @@ regular expression. Note that the regular expression is not delimited and does not get any C-style string escaped decoded. ~~~scenario -when I run /bin/echo hello, world +when I run echo hello, world then stdout matches regex world$ ~~~ @@ -155,7 +155,7 @@ have something we want to avoid. ## Check stdout is not exactly something ~~~scenario -when I run /bin/echo hi +when I run echo hi then stdout isn't exactly "hello, world\n" ~~~ @@ -170,7 +170,7 @@ then stderr isn't exactly "hello, world\n" ## Check stdout doesn't contain sub-string ~~~scenario -when I run /bin/echo hi +when I run echo hi then stdout doesn't contain "world" ~~~ @@ -185,7 +185,7 @@ then stderr doesn't contain "world" ## Check stdout doesn't match regular expression ~~~scenario -when I run /bin/echo hi +when I run echo hi then stdout doesn't match regex world$ ~~~ -- cgit v1.2.1