Wait! I've overlooked the Wireshark documentation of all things. I will
check there.
https://www.wireshark.org/docs/wsdg_html_chunked/ChapterTests.html

and a couple other places might have clues
https://github.com/wireshark/happy-shark
https://tewarid.github.io/2018/02/27/regression-test-a-wireshark-dissector-using-tshark.html


On Tue, Apr 20, 2021 at 2:47 PM Vincent Randal <vtran...@gmail.com> wrote:

> Hello,
>
> Anders, thank you. I think I've finally got the separate "generate" and
> "compile" steps clear now. Thank you.
>
> What I think remains is regression testing. Yes? No? For a new dissector
> should there be entry in some file (somewhere) that tells the build tools
> what to test (if anything) regarding a new dissector in the asn1 directory?
>
> I've been digging around a bit in the source files and I have not yet made
> sense of how regression testing (or any testing) is done, or even if it
> applies to dissectors let alone a new dissector.
>
> Vincent Randal
>
> On Mon, Apr 19, 2021 at 12:52 AM Anders Broman via Wireshark-dev <
> wireshark-dev@wireshark.org> wrote:
>
>> Hi,
>>
>> Perhaps a misconception here, the generated files are part of the source
>> tree currently so when you change any of the files in the
>>
>> ../asn1/foo directory you need to run make foo and check in the generated
>> .c and optionally .h file.
>>
>>
>>
>> So on the very first round add the directory and files in the /foo
>> directory DO NOT change cmake for the generated files yet
>>
>> Run cmake to have the cmake files generated needed to generate asn1
>> dissectors.
>>
>> Run make foo
>>
>> You should now have generated .c and possibly .h files in your src dir
>>
>> Check them in and update the cmake files to include the f´generated .c .h
>> files
>>
>> Run make to have them built
>>
>>
>>
>> Best regards
>>
>> Anders
>>
>>
>>
>> *From:* Wireshark-dev <wireshark-dev-boun...@wireshark.org> *On Behalf
>> Of *Vincent Randal
>> *Sent:* den 19 april 2021 05:06
>> *To:* Developer support list for Wireshark <wireshark-dev@wireshark.org>
>> *Subject:* Re: [Wireshark-dev] still unclear how to build a new
>> ASN.1-based dissector
>>
>>
>>
>> CORRECTION:  I omitted the troublesome steps (underlined) when describing
>> the problem:
>>
>> git clone https://<wireshark repo> wireshark
>>
>> cd wireshark
>>
>> git checkout wireshark-3.4.4
>>
>> cd wireshark/epan/dissectors
>>
>> *cp ~/myfoo.tgz . #copy dissector code into wireshark clone*
>>
>> *tar xvf myfoo.tgz #extract the dissector code (details in previous
>> email)*
>>
>> cd ../../..
>>
>> mkdir build
>>
>> cd build
>>
>> cmake ../wireshark #this step worked previously but not on a fresh
>> wireshark clone now
>>
>> make asn1 #with relevant entries in two CMakeListsCustom files
>>
>> make
>>
>>
>>
>> On Sun, Apr 18, 2021 at 8:15 PM Vincent Randal <vtran...@gmail.com>
>> wrote:
>>
>> Hello Wireshark-dev community,
>>
>>
>>
>> Apparently, I still don't have the correct sequence of steps necessary
>> for first time generation of "packet-myfoo.c" and "packet-myfoo.h" for a
>> new ASN.1-based dissector called myfoo. Details follow.
>>
>>
>>
>> I would like to understand (much better than I do) how to add an
>> ASN.1-based dissector to epan/dissectors/asn1 in a fresh clone of
>> wireshark. I got a lot of help from a lot of people last week (for which I
>> am grateful) but I must still be missing a step here:
>>
>> git clone https://<wireshark repo> wireshark
>>
>> cd wireshark
>>
>> git checkout wireshark-3.4.4
>>
>> cd ..
>>
>> mkdir build
>>
>> cd build
>>
>> cmake ../wireshark #this step worked previously but not on a fresh
>> wireshark clone now
>>
>> make asn1 #with relevant entries in two CMakeListsCustom files
>>
>> make
>>
>>
>>
>> When I add my dissector folder "myfoo" to epan/dissectors/asn1 here's the
>> relevant error messages from cmake (with some highlighting by me):
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *-- Configuring doneCMake Error at epan/dissectors/CMakeLists.txt:2004
>> (add_library):  Cannot find source file:
>> /home/vtrandal/ws1/wireshark/epan/dissectors/packet-myfoo.c  Tried
>> extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm  .hpp
>> .hxx .in .txxCMake Error at epan/dissectors/CMakeLists.txt:2004
>> (add_library):  No SOURCES given to target: dissectors*
>>
>> [end of cmake error messages]
>>
>>
>>
>> The point of the above cmake error messages is that the "packet-myfoo.c"
>> and "packet-myfoo.h" files have not yet been generated (and I don't know
>> how to generate them). I do not know how I got past the cmake step before,
>> but I was lucky (and unlucky now). The ASN.1-based dissector code is in the
>> attached .tgz file which I extract in epan/dissectors as follows:
>>
>> tar xvf myfoo.tgz
>>
>> ./CMakeListsCustom.txt <== contains entry for myfoo
>> ./asn1/CMakeListsCustom.txt <== contains entry for myfoo
>> ./asn1/myfoo/
>> ./asn1/myfoo/myfoo.asn
>> ./asn1/myfoo/myfoo.cnf
>> ./asn1/myfoo/CMakeLists.txt
>> ./asn1/myfoo/packet-myfoo-template.h
>> ./asn1/myfoo/packet-myfoo-template.c
>>
>>
>>
>> I apologize in advance for being thick-headed about the process of adding
>> a new ASN.1-based dissector to epan/dissectors/asn1 in Wireshark. With help
>> from a lot of people I got it to compile previously (again for which I am
>> grateful). But I cannot repeat that success starting with a fresh clone of
>> wireshark regardless of the branch. Somehow I still don't have the correct
>> sequence of steps necessary to generate "packet-myfoo.c" and
>> "packet-myfoo.h" the first time. With my dissector code in epan/dissectors
>> the cmake step fails and I cannot make  anything.
>>
>>
>>
>> Vincent
>>
>>
>>
>> NOTE: The attached dissector code is based on the simple ASN.1-based
>> dissector example online.
>> https://www.wireshark.org/docs/wsdg_html_chunked/SimpleASN1BasedDissector.html
>>
>>
>>
>>
>> ___________________________________________________________________________
>> Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
>> Archives:    https://www.wireshark.org/lists/wireshark-dev
>> Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
>>              mailto:wireshark-dev-requ...@wireshark.org
>> ?subject=unsubscribe
>
>
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to