tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Add unit tests with top-level Makefile.

Open robertsoule-barefoot opened this issue 8 years ago • 3 comments

robertsoule-barefoot avatar Nov 14 '17 15:11 robertsoule-barefoot

@robertsoule-barefoot ,can you please provide the description regarding the issue

Madhav-2808 avatar Jan 17 '25 10:01 Madhav-2808

It has been a few years since Robert was actively contributing to this repository.

From the title, I think the basic idea is to have some kind of automated unit tests that some subset of the code in this repository can be verified that they pass, or fail if the test finds a bug, that can be run by just running one or two commands from a shell, e.g. cd <some-directory>; make check or something like that.

jafingerhut avatar Jan 17 '25 16:01 jafingerhut

Note that right now I do not recall there being any such tests in this repository, so there are no existing examples in this repository to work from.

There are automated tests such as PTF tests that exist in other p4lang repositories that might be helpful as ideas to start from, e.g.:

  • https://github.com/jafingerhut/p4-guide/blob/master/demo1/README-ptf.md
  • https://github.com/jafingerhut/p4-guide/tree/master/ptf-tests

Note that those PTF tests use different Python APIs than the tutorials repository does for adding/modifying/deleting table entries, which can be confusing when you first encounter such differences.

jafingerhut avatar Jan 17 '25 16:01 jafingerhut