[ovs-dev] [PATCH ovn] configure: Save OVSDIR as an absolute path.

Dumitru Ceara dceara at redhat.com
Fri Apr 2 09:44:57 UTC 2021


On 3/22/21 7:08 PM, Mark Michelson wrote:
> On 3/22/21 2:02 PM, Mark Michelson wrote:
>> Lately, `make check` runs have been failing. When "--with-ovs-source"
>> is not specified at configure time, the configure script automatically
>> sets the location to "$srcdir/ovs". This location is passed along the
>> chain and eventually added to AUTOTEST_PATH when running the tests.
>>
>> $srcdir is a relative path name, which is fine when building the code.
>> This falls apart, though, when tests are run. Tests are not run from
>> the build directory, but instead from the tests/ directory. Therefore,
>> the relative path to ovs/ is different. This causes most tests to fail
>> since files are not in the expected location.
>>
>> The fix is to set OVSDIR to an absolute path instead. Autoconf documents
>> an $abs_srcdir variable, but this is not set until after configure
>> checks are run. It is meant to be used by Makefiles. Therefore, we use
>> the trick of cd-ing to the directory and calling pwd to expand it to the
>> absolute path.
>>
>> Signed-off-by: Mark Michelson <mmichels at redhat.com>
> 
> I didn't mention this above, but there is also an $ac_abs_confdir
> variable that expands to the absolute path of the configure script. I
> tested and this works as well, but general advice online is not to use
> this. It's a variable internal to autoconf, it's not documented, and it
> has the potential to be removed without notice in some future autoconf
> version.
> 
>> ---
>>   acinclude.m4 | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/acinclude.m4 b/acinclude.m4
>> index 3f8db03cf..2c607ea8e 100644
>> --- a/acinclude.m4
>> +++ b/acinclude.m4
>> @@ -381,7 +381,7 @@ AC_DEFUN([OVN_CHECK_OVS], [
>>         AC_ERROR([$OVSDIR is not an OVS source directory])
>>       fi
>>     else
>> -    OVSDIR=$srcdir/ovs
>> +    OVSDIR=$(cd $srcdir/ovs; pwd)
>>     fi
>>       AC_MSG_RESULT([$OVSDIR])
>>

Hi Mark,

This works fine and also fixes running system tests when using the OVS
submodule.

However, maybe it makes sense set $with_ovs_source to `pwd`/ovs if
$with_ovs_source is empty.  Afterwards, unconditionally, set OVSDIR,
turn it into an absolute path and check that it's actually an OVS source
directory.

What do you think?

Thanks,
Dumitru



More information about the dev mailing list