Testing a Merge Request in Wireshark Repository

In my earlier post I described the setup I use for Wireshark contributions. In this post I’ll present a small memo about how to test a merge request (MR) that has been submitted in the Wireshark repository in GitLab.

Here is an example of a MR that has not yet been merged in (as of writing this):

Qt: Enabled Protocols: Let enabled and name/description be orthogonal (gitlab.com)

When browsing the MR I can see that the author (John Thacker, one of the core developers in Wireshark project) has created a branch called enabled_protocols in his fork of the Wireshark repository.

Let’s see how to test the code on my development machine. (Be sure to also check my earlier post about Wireshark development on Linux to follow the ideas here.)

My own local fork is currently up-to-date:

markku@wsdevel:~$ cd wireshark
markku@wsdevel:~/wireshark (master)$ git updatemaster
From https://gitlab.com/wireshark/wireshark
* branch master -> FETCH_HEAD
Already up to date.
markku@wsdevel:~/wireshark (master)$ git remote -v
origin git@gitlab.com:markkuleinio/wireshark.git (fetch)
origin git@gitlab.com:markkuleinio/wireshark.git (push)
upstream https://gitlab.com/wireshark/wireshark.git (fetch)
upstream https://gitlab.com/wireshark/wireshark.git (push)
markku@wsdevel:~/wireshark (master)$

I’ll now fetch the author’s branch here:

markku@wsdevel:~/wireshark (master)$ git fetch upstream merge-requests/25163/head:enabled_protocols
From https://gitlab.com/wireshark/wireshark
* [new ref] refs/merge-requests/25163/head -> enabled_protocols
markku@wsdevel:~/wireshark (master)$

The important variables in the command:

  • upstream is the remote name of the Wireshark repository in my configuration
  • 25163 is the MR number
  • enabled_protocols is the author’s branch name, as shown in the original MR

I can now switch to the branch and then make+compile the code as usual (usually I have the build window separately from the repository window but here I’ll just cd around for demonstration):

markku@wsdevel:~/wireshark (master)$ git checkout enabled_protocols
Switched to branch 'enabled_protocols'
markku@wsdevel:~/wireshark (enabled_protocols)$ ninja
ninja: error: loading 'build.ninja': No such file or directory
markku@wsdevel:~/wireshark (enabled_protocols)$ cd ../wsbuild/
markku@wsdevel:~/wsbuild$ ninja
[0/2] Re-checking globbed directories...
[1/2] Re-running CMake...
...

After successful compilation and testing (maybe also with some edits and recompiles), I can go back to the master branch and delete the author’s branch (it will most probably be merged in later anyway so no need to keep it here):

markku@wsdevel:~/wsbuild$ cd ../wireshark
markku@wsdevel:~/wireshark (enabled_protocols)$ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 3536 commits.
(use "git push" to publish your local commits)
markku@wsdevel:~/wireshark (master)$ git branch -D enabled_protocols
Deleted branch enabled_protocols (was b1d2776976).
markku@wsdevel:~/wireshark (master)$

Leave a Reply