search for: _run_cleanup_hooks

Displaying 13 results from an estimated 13 matches for "_run_cleanup_hooks".

2020 May 22
0
[PATCH nbdkit 3/4] tests/functions.sh.in: Rename variables $status and $i when running cleanups.
...le with 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_hoo...
2019 Jan 23
0
[PATCH nbdkit] tests: Add generic ‘requires’ function to testing test prerequisites.
...s/functions.sh.in @@ -1,7 +1,7 @@ # nbdkit # Common functions used by the tests. # @configure_input@ -# Copyright (C) 2017-2018 Red Hat Inc. +# Copyright (C) 2017-2019 Red Hat Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -57,6 +57,21 @@ _run_cleanup_hooks () } trap _run_cleanup_hooks INT QUIT TERM EXIT ERR +# requires program [args] +# +# Check that ‘program [args]’ works. If not, skip the test. +# For example to check that qemu-img is available, do: +# +# requires qemu-img --help +requires () +{ + "$@" || { + echo "$0:...
2019 Jan 23
2
[PATCH nbdkit] tests: Add generic requires function.
I only did a handful of the tests to demonstrate the point. If the patch approach is accepted then I'll do the remainder of the tests in v2. Rich.
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.
2019 Jan 23
2
Re: [PATCH v2 nbdkit] tests: Add generic ‘requires’ function for test prerequisites.
...kit > # Common functions used by the tests. > # @configure_input@ > -# Copyright (C) 2017-2018 Red Hat Inc. > +# Copyright (C) 2017-2019 Red Hat Inc. > # All rights reserved. > # > # Redistribution and use in source and binary forms, with or without > @@ -57,6 +57,21 @@ _run_cleanup_hooks () > } > trap _run_cleanup_hooks INT QUIT TERM EXIT ERR > > +# requires program [args] > +# > +# Check that ‘program [args]’ works. If not, skip the test. > +# For example to check that qemu-img is available, do: > +# > +# requires qemu-img --version > +requires (...
2019 Jan 23
2
[PATCH v2 nbdkit] tests: Add generic requires.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-January/thread.html#00198 For v2 I changed most existing prerequisite tests to use the new mechanism. I only changed simple tests. There are a few more complex tests that don't fit the “requires model” and those are not changed. I normalized qemu-io/qemu-img testing to always use the --version flag, where previously we used a mix
2018 Sep 13
0
[PATCH v2 nbdkit 4/5] tests: Use a generic cleanup mechanism instead of explicit trap.
...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 + ${_cleanup_hook[i]} + done + + exit $status +} +trap _run_cleanup_hooks INT QUIT TERM EXIT ERR...
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.
2019 Jan 23
0
[PATCH v2 nbdkit] tests: Add generic ‘requires’ function for test prerequisites.
...s/functions.sh.in @@ -1,7 +1,7 @@ # nbdkit # Common functions used by the tests. # @configure_input@ -# Copyright (C) 2017-2018 Red Hat Inc. +# Copyright (C) 2017-2019 Red Hat Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -57,6 +57,21 @@ _run_cleanup_hooks () } trap _run_cleanup_hooks INT QUIT TERM EXIT ERR +# requires program [args] +# +# Check that ‘program [args]’ works. If not, skip the test. +# For example to check that qemu-img is available, do: +# +# requires qemu-img --version +requires () +{ + ( "$@" ) </dev/null >/de...
2020 Aug 02
2
[nbdkit] Failure in test-retry-size.sh
...nbdkit: debug: retry: unload filter + end_t=1 + '[' 1 -lt 2 ']' + echo './test-retry-size.sh: test ran too quickly' ./test-retry-size.sh: test ran too quickly + fail=1 + read open_count + '[' 3 -ne 3 ']' + '[' -e retry-size-fail ']' + exit 1 + _run_cleanup_hooks + local _status=1 _i + set +e + trap '' INT QUIT TERM EXIT ERR + echo ./test-retry-size.sh: run cleanup hooks: exit code 1 ./test-retry-size.sh: run cleanup hooks: exit code 1 + (( _i = 0 )) + (( _i < 1 )) + rm -f retry-size-open-count retry-size-fail + (( ++_i )) + (( _i < 1 )) + ex...
2020 Aug 03
0
Re: [nbdkit] Failure in test-retry-size.sh
...> + '[' 1 -lt 2 ']' > + echo './test-retry-size.sh: test ran too quickly' > ./test-retry-size.sh: test ran too quickly > + fail=1 > + read open_count > + '[' 3 -ne 3 ']' > + '[' -e retry-size-fail ']' > + exit 1 > + _run_cleanup_hooks > + local _status=1 _i > + set +e > + trap '' INT QUIT TERM EXIT ERR > + echo ./test-retry-size.sh: run cleanup hooks: exit code 1 > ./test-retry-size.sh: run cleanup hooks: exit code 1 > + (( _i = 0 )) > + (( _i < 1 )) > + rm -f retry-size-open-count retry-size-f...
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
2018 Sep 13
0
[PATCH v2 nbdkit 5/5] tests: Add a helper function which waits for nbdkit to start up.
...| 27 +------------ tests/test-zero.sh | 3 -- 24 files changed, 104 insertions(+), 553 deletions(-) diff --git a/tests/functions.sh.in b/tests/functions.sh.in index 42e3925..5c1f34c 100644 --- a/tests/functions.sh.in +++ b/tests/functions.sh.in @@ -57,6 +57,39 @@ _run_cleanup_hooks () } trap _run_cleanup_hooks INT QUIT TERM EXIT ERR +# start_nbdkit -P pidfile args... +# +# Run nbdkit with args and wait for it to start up. If it fails to +# start up, exit with an error message. Also a cleanup handler is +# installed automatically which kills nbdkit on exit. +start_nbdkit...