Re: [PATCH 2/6] tests: Fix running schematests directly from topdir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/08/2016 09:04 PM, Laine Stump wrote:
> On 01/08/2016 07:13 PM, Cole Robinson wrote:
>> Previously it failed like:
>>
>> $ ./tests/domainschematest
>> ./tests/domainschematest: line 4: ./test-lib.sh: No such file or directory
>> ---
>>   tests/capabilityschematest     | 2 +-
>>   tests/domaincapsschematest     | 2 +-
>>   tests/domainschematest         | 2 +-
>>   tests/domainsnapshotschematest | 2 +-
>>   tests/interfaceschematest      | 2 +-
>>   tests/networkschematest        | 2 +-
>>   tests/nodedevschematest        | 2 +-
>>   tests/nwfilterschematest       | 2 +-
>>   tests/secretschematest         | 2 +-
>>   tests/storagepoolschematest    | 2 +-
>>   tests/storagevolschematest     | 2 +-
>>   tests/test-lib.sh              | 9 +++++----
>>   12 files changed, 16 insertions(+), 15 deletions(-)
>>
>> diff --git a/tests/capabilityschematest b/tests/capabilityschematest
>> index 4439842..78fbc8e 100755
>> --- a/tests/capabilityschematest
>> +++ b/tests/capabilityschematest
>> @@ -1,6 +1,6 @@
>>   #!/bin/sh
>>   -: ${srcdir=.}
>> +: ${srcdir=$(dirname $0)}
>>   . $srcdir/test-lib.sh
>>   . $abs_srcdir/schematestutils.sh
>>   diff --git a/tests/domaincapsschematest b/tests/domaincapsschematest
>> index 9baf44a..2c19ac4 100755
>> --- a/tests/domaincapsschematest
>> +++ b/tests/domaincapsschematest
>> @@ -1,6 +1,6 @@
>>   #!/bin/sh
>>   -: ${srcdir=.}
>> +: ${srcdir=$(dirname $0)}
>>   . $srcdir/test-lib.sh
>>   . $abs_srcdir/schematestutils.sh
>>   diff --git a/tests/domainschematest b/tests/domainschematest
>> index ba90180..31ee536 100755
>> --- a/tests/domainschematest
>> +++ b/tests/domainschematest
>> @@ -1,6 +1,6 @@
>>   #!/bin/sh
>>   -: ${srcdir=.}
>> +: ${srcdir=$(dirname $0)}
>>   . $srcdir/test-lib.sh
>>   . $abs_srcdir/schematestutils.sh
>>   diff --git a/tests/domainsnapshotschematest b/tests/domainsnapshotschematest
>> index 1bdc539..ba28e05 100755
>> --- a/tests/domainsnapshotschematest
>> +++ b/tests/domainsnapshotschematest
>> @@ -1,6 +1,6 @@
>>   #!/bin/sh
>>   -: ${srcdir=.}
>> +: ${srcdir=$(dirname $0)}
>>   . $srcdir/test-lib.sh
>>   . $abs_srcdir/schematestutils.sh
>>   diff --git a/tests/interfaceschematest b/tests/interfaceschematest
>> index 1ddbc53..47745ea 100755
>> --- a/tests/interfaceschematest
>> +++ b/tests/interfaceschematest
>> @@ -1,6 +1,6 @@
>>   #!/bin/sh
>>   -: ${srcdir=.}
>> +: ${srcdir=$(dirname $0)}
>>   . $srcdir/test-lib.sh
>>   . $abs_srcdir/schematestutils.sh
>>   diff --git a/tests/networkschematest b/tests/networkschematest
>> index 46f3fc5..fe46893 100755
>> --- a/tests/networkschematest
>> +++ b/tests/networkschematest
>> @@ -1,6 +1,6 @@
>>   #!/bin/sh
>>   -: ${srcdir=.}
>> +: ${srcdir=$(dirname $0)}
>>   . $srcdir/test-lib.sh
>>   . $abs_srcdir/schematestutils.sh
>>   diff --git a/tests/nodedevschematest b/tests/nodedevschematest
>> index 03a1577..07b1f7b 100755
>> --- a/tests/nodedevschematest
>> +++ b/tests/nodedevschematest
>> @@ -1,6 +1,6 @@
>>   #!/bin/sh
>>   -: ${srcdir=.}
>> +: ${srcdir=$(dirname $0)}
>>   . $srcdir/test-lib.sh
>>   . $abs_srcdir/schematestutils.sh
>>   diff --git a/tests/nwfilterschematest b/tests/nwfilterschematest
>> index 2c50c03..8703e21 100755
>> --- a/tests/nwfilterschematest
>> +++ b/tests/nwfilterschematest
>> @@ -1,6 +1,6 @@
>>   #!/bin/sh
>>   -: ${srcdir=.}
>> +: ${srcdir=$(dirname $0)}
>>   . $srcdir/test-lib.sh
>>   . $abs_srcdir/schematestutils.sh
>>   diff --git a/tests/secretschematest b/tests/secretschematest
>> index f64d1a3..23b0e2f 100755
>> --- a/tests/secretschematest
>> +++ b/tests/secretschematest
>> @@ -1,6 +1,6 @@
>>   #!/bin/sh
>>   -: ${srcdir=.}
>> +: ${srcdir=$(dirname $0)}
>>   . $srcdir/test-lib.sh
>>   . $abs_srcdir/schematestutils.sh
>>   diff --git a/tests/storagepoolschematest b/tests/storagepoolschematest
>> index d54b827..ebea711 100755
>> --- a/tests/storagepoolschematest
>> +++ b/tests/storagepoolschematest
>> @@ -1,6 +1,6 @@
>>   #!/bin/sh
>>   -: ${srcdir=.}
>> +: ${srcdir=$(dirname $0)}
>>   . $srcdir/test-lib.sh
>>   . $abs_srcdir/schematestutils.sh
>>   diff --git a/tests/storagevolschematest b/tests/storagevolschematest
>> index 9045e6b..395df57 100755
>> --- a/tests/storagevolschematest
>> +++ b/tests/storagevolschematest
>> @@ -1,6 +1,6 @@
>>   #!/bin/sh
>>   -: ${srcdir=.}
>> +: ${srcdir=$(dirname $0)}
>>   . $srcdir/test-lib.sh
>>   . $abs_srcdir/schematestutils.sh
>>   diff --git a/tests/test-lib.sh b/tests/test-lib.sh
>> index aff179c..920b01e 100644
>> --- a/tests/test-lib.sh
>> +++ b/tests/test-lib.sh
>> @@ -18,10 +18,11 @@
>>   #
>>   # Based on an idea from GNU coreutils
>>   -test -z "$abs_srcdir" && abs_srcdir=$(pwd)
>> -test -z "$abs_builddir" && abs_builddir=$(pwd)
>> -test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
>> -test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
>> +_scriptdir="$(realpath $(dirname $0))"
> 
> Is there a reason you are doing $(realpath $(dirname $0)) here, but just
> $(dirname $0) in the individual scripts? If there's a reasonable answer to
> that, then ACK.
> 

Yes, because we need the absolute path here for these abs_* variables. The
individual scripts just need the relative path from dirname

Thanks,
Cole

>> +test -z "$abs_srcdir" && abs_srcdir=$_scriptdir
>> +test -z "$abs_builddir" && abs_builddir=$_scriptdir
>> +test -z "$abs_top_srcdir" && abs_top_srcdir=$_scriptdir/..
>> +test -z "$abs_top_builddir" && abs_top_builddir=$_scriptdir/..
>>   test -z "$LC_ALL" && LC_ALL=C
>>     # Skip this test if the shell lacks support for functions.
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]