Displaying 8 results from an estimated 8 matches for "_cleanup_hook".
2018 Sep 13
1
Re: [PATCH v2 nbdkit 4/5] tests: Use a generic cleanup mechanism instead of explicit trap.
...bguestfs/2018-September/msg00069.html
> ---
I'm glad the idea worked!
> +# cleanup_fn f [args]
> +#
> +# A generic trap handling function. This runs the function f + args
Not just functions, but any command name...
> +# when the script exits for any reason.
> +declare -a _cleanup_hook
> +cleanup_fn ()
> +{
> + _cleanup_hook[${#_cleanup_hook[@]}]="$@"
> +}
> +++ b/tests/test-zero.sh
> @@ -31,6 +31,7 @@
> # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> # SUCH DAMAGE.
>
> +source ./functions.sh
> set -x...
2020 May 22
0
[PATCH nbdkit 3/4] tests/functions.sh.in: Rename variables $status and $i when running cleanups.
...ith
the same name.
---
tests/functions.sh.in | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/functions.sh.in b/tests/functions.sh.in
index e2ef9701..b5c7d88b 100644
--- a/tests/functions.sh.in
+++ b/tests/functions.sh.in
@@ -43,17 +43,17 @@ cleanup_fn ()
_run_cleanup_hooks ()
{
- local status=$? i
+ local _status=$? _i
set +e
trap '' INT QUIT TERM EXIT ERR
- echo $0: run cleanup hooks: exit code $status
+ echo $0: run cleanup hooks: exit code $_status
- for (( i = 0; i < ${#_cleanup_hook[@]}; ++i )); do
- ${_cleanup_ho...
2020 May 22
6
[PATCH nbdkit 0/4] Add fuamode=pass and fuamode=discard
Two hopefully useful additions to the fua filter. The second one is
kind of like cache=unsafe in qemu, in that it exchanges correctness
for speed. Useful for data which is easily recreated in the event of
a crash or for people who like living on the edge and have good
backups.
Rich.
2018 Sep 13
0
[PATCH v2 nbdkit 4/5] tests: Use a generic cleanup mechanism instead of explicit trap.
...functions.sh.in
+++ b/tests/functions.sh.in
@@ -32,6 +32,31 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
+# cleanup_fn f [args]
+#
+# A generic trap handling function. This runs the function f + args
+# when the script exits for any reason.
+declare -a _cleanup_hook
+cleanup_fn ()
+{
+ _cleanup_hook[${#_cleanup_hook[@]}]="$@"
+}
+
+_run_cleanup_hooks ()
+{
+ status=$?
+ set +e
+ trap '' INT QUIT TERM EXIT ERR
+ echo $0: run cleanup hooks: exit code $status
+
+ for (( i = 0; i < ${#_cleanup_hook[@]}; ++i )); do
+ ${...
2020 Feb 27
3
[PATCH nbdkit] server: When using --run, wait for captive nbdkit to exit.
I'd like to propose we backport this to 1.18 and some earlier stable
branches too.
Rich.
2020 Aug 02
2
[nbdkit] Failure in test-retry-size.sh
...ome up with at least a plausible explanation for this
first.
Rich.
+ fail=0
+ requires qemu-io --version
+ requires dd iflag=count_bytes
+ files='retry-size-open-count retry-size-fail'
+ rm -f retry-size-open-count retry-size-fail
+ cleanup_fn rm -f retry-size-open-count retry-size-fail
+ _cleanup_hook[${#_cleanup_hook[@]}]='rm -f retry-size-open-count retry-size-fail'
+ touch retry-size-open-count
+ start_t=0
+ st=0
+ nbdkit -v -U - sh - --filter=retry retry-delay=1 --run 'qemu-io -f raw -r $nbd \
-c "r 0 512" -c "r 512 512"'
/builddir/build/BUILD/nbdkit-1...
2020 Aug 03
0
Re: [nbdkit] Failure in test-retry-size.sh
...gt; first.
>
> Rich.
>
> + fail=0
> + requires qemu-io --version
> + requires dd iflag=count_bytes
> + files='retry-size-open-count retry-size-fail'
> + rm -f retry-size-open-count retry-size-fail
> + cleanup_fn rm -f retry-size-open-count retry-size-fail
> + _cleanup_hook[${#_cleanup_hook[@]}]='rm -f retry-size-open-count retry-size-fail'
> + touch retry-size-open-count
> + start_t=0
> + st=0
> + nbdkit -v -U - sh - --filter=retry retry-delay=1 --run 'qemu-io -f raw -r $nbd \
> -c "r 0 512" -c "r 512 512"'
>...
2018 Sep 13
8
[PATCH v2 nbdkit 0/5] tests: Move common functions into tests/functions.sh
v1 was here:
https://www.redhat.com/archives/libguestfs/2018-September/msg00057.html
v2:
- Fix tab vs spaces in configure.ac.
- To generate list of plugins, use printf instead of xargs.
- Use 'source ./functions.sh' instead of 'source functions'.
- functions.sh: Consistent quoting in foreach_plugin function.
- functions.sh: Change the contract of start_nbdkit so it