[P4-dev] latest p4c and behavioral-model test failures

Antonin Bas antonin at barefootnetworks.com
Mon Dec 10 21:55:45 EST 2018

Actually it doesn't seem that the bmv2stf.py script uses the CMake result.
However, when the FindExe search fails, the method return the name of the
executable (simple_switch), which works if the executable is installed is a
system directory.
The bmv2stf.py should probably use the CMake result. Right now even though
FindExe potentially searches a lot of locations (all the way to the root),
it's not really useful since the bmv2 tests will be disabled if CMake fails
to find simple_switch. CMake looks in those locations:

On Mon, Dec 10, 2018 at 6:51 PM Nate Foster <jnfoster at cs.cornell.edu> wrote:

> The bmv2 install is located using CMake's find_package command (
> https://github.com/p4lang/p4c/blob/master/CMakeLists.txt#L142). The CMake
> search algorithm is described in detail here (
> https://cmake.org/cmake/help/latest/command/find_package.html) and can be
> debugged by invoking it as follows:
> -N
> On Mon, Dec 10, 2018 at 9:42 PM Andy Fingerhut <andy.fingerhut at gmail.com>
> wrote:
>> behavioral-model does not need to be a sibling directory to p4c in order
>> for running 'make check' in the p4c/build directory to find it, but being a
>> sibling is one of the few places that it will be found.
>> When you run a bmv2 test with 'make check', this Python code in p4c:
>> https://github.com/p4lang/p4c/blob/master/backends/bmv2/bmv2stf.py#L89-L106
>> when run from the directory '/home/jafinger/p4c/build' on my machine,
>> checks for the existence of these directories, in this order, looking for
>> the first one that exists (confirmed via adding debug print statements to
>> the Python method linked above):
>> /home/jafinger/p4c/build/behavioral-model   (does not exist on my machine)
>> /home/jafinger/p4c/behavioral-model   (does not exist on my machine)
>> /home/jafinger/behavioral-model   (exists on my machine, so it stops
>> looking)
>> I would guess it would continue looking for /home/behavioral-model and
>> perhaps also /behavioral-model if it did not find the sibling directory,
>> but I don't think it will find it in any place except those few places that
>> it looks.  A sibling directory to p4c is certainly one reasonable place to
>> install it, in order for p4c's 'make check' to find it.
>> Andy
>> On Mon, Dec 10, 2018 at 12:29 PM Nate Foster <jnfoster at cs.cornell.edu>
>> wrote:
>>> I could be wrong, but I don't believe behavioral-model needs to be a
>>> sibling directory to p4c.
>>> I'm also confused by the assertion in Hemant's original note that Travis
>>> is failing. The Travis CI links from both p4c and behavioral-model do not
>>> show any errors. What was meant by this?
>>> -N
>>> On Sun, Dec 9, 2018 at 8:26 PM <hemant at mnkcg.com> wrote:
>>>> Please see in line below.
>>>> *From:* Andy Fingerhut <andy.fingerhut at gmail.com>
>>>> *Sent:* Sunday, December 09, 2018 3:00 PM
>>>> *To:* hemant at mnkcg.com
>>>> *Cc:* p4-dev <p4-dev at lists.p4.org>
>>>> *Subject:* Re: [P4-dev] latest p4c and behavioral-model test failures
>>>> I am not sure, but I believe that when running 'make check' in
>>>> p4c/build there are scripts that look for a behavioral-model directory to
>>>> use for running simple_switch.  I have always installed p4c and
>>>> behavioral-model directories so they were 'siblings' of each other in the
>>>> directory tree, and that seems to work.  If you installed behavioral-model
>>>> on your system in a much different place, perhaps it might not be able to
>>>> find it?  I am not sure.
>>>> I cloned a private p4c in /tmp when my other p4c and behavioral-model
>>>> are in my root dir as peers.  The /tmp/p4c fails bmv2 tests.  So I moved
>>>> the private p4c to my root dir as a peer and then bmv2 tests passed.  Thus,
>>>> you are correct about p4c and behavioral-model being peer/sibling
>>>> directories.  If this fact is missing in README.md files, we should add it.
>>>> Thanks,
>>>> Hemant
>>>> _______________________________________________
>>>> P4-dev mailing list
>>>> P4-dev at lists.p4.org
>>>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20181210/8c7a1944/attachment.html>

More information about the P4-dev mailing list