summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2015-11-20 18:43:53 +0100
committerPavel Raiskup <praiskup@redhat.com>2015-11-20 18:43:53 +0100
commit8c80431e9c9425b3edd7517e9c0dd814599b7104 (patch)
tree008ea00e183ffaec30deaa23275cd748d20c22d3
parent995a49aae00e7adda6bb1e44d45aac9840ec5dab (diff)
downloaddtf-8c80431e9c9425b3edd7517e9c0dd814599b7104.zip
dtf-8c80431e9c9425b3edd7517e9c0dd814599b7104.tar.gz
dtf-8c80431e9c9425b3edd7517e9c0dd814599b7104.tar.xz
dtf-gen: don't take $outputdir as test candidate
* bin/dtf-gen: Ensure that $outputdir is absolute path. * share/dtf/lib/default (__dtf_is_testdir): Readlink -f for both outputdir and test case candidate directory. This is OK because we don't have to make 'dtf-gen' script terribly portable.
-rwxr-xr-xbin/dtf-gen5
-rw-r--r--share/dtf/lib/default7
2 files changed, 11 insertions, 1 deletions
diff --git a/bin/dtf-gen b/bin/dtf-gen
index 89c9ee0..e49ccc1 100755
--- a/bin/dtf-gen
+++ b/bin/dtf-gen
@@ -114,6 +114,11 @@ then
test -n "$2" && opt_distro="$2"
fi
+case $outputdir in
+ /*) : ;;
+ *) die "not absolute \$outputdir=$outputdir" ;;
+esac
+
test -d "$outputdir" && {
chmod u+w "$outputdir" -R
/bin/rm -rf "$outputdir"
diff --git a/share/dtf/lib/default b/share/dtf/lib/default
index 24a9c0c..9981b09 100644
--- a/share/dtf/lib/default
+++ b/share/dtf/lib/default
@@ -11,12 +11,17 @@
__dtf_is_testdir ()
{
test -d "$1" || return 1
+
case "$1" in
DTF_OUTPUT|DTF_RESULT|library)
return 1
;;
esac
- :
+
+ _d_sub_path=`readlink -f "$1"`
+ _d_out_path=`readlink -f "$outputdir"`
+
+ test "$_d_sub_path" != "$_d_out_path"
}