diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2015-11-18 07:28:47 +0100 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2015-11-18 07:28:47 +0100 |
commit | 9221927b70dd32e46d4c3bf6f8c3d34ffea3bb51 (patch) | |
tree | f606f9272b6b52c0c84d7593882a5bfdb5c8d2c5 | |
parent | cad633356d397b5fe14976d5ad0ae2cf23a72547 (diff) | |
download | dtf-9221927b70dd32e46d4c3bf6f8c3d34ffea3bb51.tar.gz dtf-9221927b70dd32e46d4c3bf6f8c3d34ffea3bb51.tar.xz dtf-9221927b70dd32e46d4c3bf6f8c3d34ffea3bb51.zip |
dtf-gen: use 'exit' more consistently
* bin/dtf-gen (die): New wrapper.
(generate_wrapper): Use die instead of exit.
(dg_call): Die if $DG fails.
-rwxr-xr-x | bin/dtf-gen | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/bin/dtf-gen b/bin/dtf-gen index 474dec7..84f7312 100755 --- a/bin/dtf-gen +++ b/bin/dtf-gen @@ -30,9 +30,17 @@ info () } +die () +{ + echo >&2 "FATAL: $*" + exit 1 +} + + dg_call () { - "$DG" --distro="$opt_distro".yaml "$@" + "$DG" --distro="$opt_distro".yaml "$@" \ + || die "dg failure" } @@ -62,7 +70,7 @@ export top_srcdir=\$srcdir/$(printf %q "$2") export testname=$(printf %q "$fix_testname") EOF - dg_call --template "$dtftpldir/run.tpl" >> "$_run_cmd" || exit 1 + dg_call --template "$dtftpldir/run.tpl" >> "$_run_cmd" chmod +x "$_run_cmd" } @@ -82,18 +90,17 @@ count_recursive_walk () if test -f testcase; then dg_call --template testcase --output "$outputdir/$2/testcase" - test $? -eq 0 || exit 1 fi test -f library && dg_call --template library >> "$outputdir/library" - test $? -eq 0 || exit 1 for _rw_i in * do __dtf_is_testdir "$_rw_i" || continue _rw_fulldir="$2/$_rw_i" - mkdir -p "$outputdir/$_rw_fulldir" || exit 1 + mkdir -p "$outputdir/$_rw_fulldir" \ + || die "can't create $outputdir/$_rw_fulldir" count_recursive_walk "$_rw_i" "$2/$_rw_i" "$3/.." done |