summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2015-11-18 07:17:56 +0100
committerPavel Raiskup <praiskup@redhat.com>2015-11-18 07:17:56 +0100
commitcad633356d397b5fe14976d5ad0ae2cf23a72547 (patch)
treea290e03adfd3395fbf1aa51a8cc450a214891d1e
parent3fb6314f7841250ae291606467d759943b484e70 (diff)
downloaddtf-cad633356d397b5fe14976d5ad0ae2cf23a72547.tar.gz
dtf-cad633356d397b5fe14976d5ad0ae2cf23a72547.tar.xz
dtf-cad633356d397b5fe14976d5ad0ae2cf23a72547.zip
dtf-gen: use distgen for generating from templates
* bin/dtf-gen: Accept '--distro' option. ($DG): New constant. (dg_call): New wrapper for dg. (generate_wrapper): Use 'dg_call' instead of cp & cat. * dtf-gen: Pass all options down to bin/dtf-gen.
-rwxr-xr-xbin/dtf-gen27
-rwxr-xr-xdtf-gen2
2 files changed, 24 insertions, 5 deletions
diff --git a/bin/dtf-gen b/bin/dtf-gen
index 67247a2..474dec7 100755
--- a/bin/dtf-gen
+++ b/bin/dtf-gen
@@ -7,7 +7,9 @@
## - each test might have several tags -- future dependencies
DTF_OUTPUT=DTF_OUTPUT
+DG=dg
+export opt_distro=fedora-rawhide-x86_64
# config
: ${outputdir=$PWD/$DTF_OUTPUT}
@@ -28,6 +30,12 @@ info ()
}
+dg_call ()
+{
+ "$DG" --distro="$opt_distro".yaml "$@"
+}
+
+
generate_wrapper ()
{
_run_cmd=$outputdir/$1/run
@@ -54,7 +62,7 @@ export top_srcdir=\$srcdir/$(printf %q "$2")
export testname=$(printf %q "$fix_testname")
EOF
- cat "$dtftpldir/run.tpl" >> "$_run_cmd"
+ dg_call --template "$dtftpldir/run.tpl" >> "$_run_cmd" || exit 1
chmod +x "$_run_cmd"
}
@@ -71,9 +79,14 @@ count_recursive_walk ()
mkdir -p "$outputdir/$2"
generate_wrapper "$2" "$3"
- test -f testcase \
- && cp testcase "$outputdir/$2"
- test -f library && cat library >> "$outputdir/library"
+
+ 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
@@ -88,6 +101,12 @@ count_recursive_walk ()
}
+# TODO: option parsing
+if test x"$1" == x--distro
+then
+ test -n "$2" && opt_distro="$2"
+fi
+
test -d "$outputdir" && {
chmod u+w "$outputdir" -R
/bin/rm -rf "$outputdir"
diff --git a/dtf-gen b/dtf-gen
index 0a5b1f2..a4609f4 100755
--- a/dtf-gen
+++ b/dtf-gen
@@ -3,4 +3,4 @@
srcdir=`dirname "$0"`
export bindir=$srcdir/bin
export datadir=$srcdir/share
-$bindir/dtf-gen
+"$bindir"/dtf-gen "$@"