Upcoming enhancements to `run-unit-test-docker`

Patrick Williams patrick at stwcx.xyz
Sat Feb 13 05:21:35 AEDT 2021


On Fri, Feb 12, 2021 at 08:22:02AM -0800, Johnathan Mantey wrote:
> On 2/11/21 4:28 PM, Patrick Williams wrote:
> I tried using this script a day or two ago. I needed to fix some unit 
> tests for a commit I pushed earlier this month. I had used the script in 
> the past and couldn't remember how to use it.
> 
> A year ago I had to fix some unit tests, and I had to get Docker, and 
> this test script configured. I have long since forgotten how I got the 
> system setup, so I went back to try and run the unit tests I had fully 
> configured and running from a year ago. In spite of having a fully 
> configured environment I could not figure out how to run the tests any 
> longer.
> 
> I decided to find the run-unit-test-docker.sh contents on the github 
> repos, to see if I could read prepared content for how to configure, and 
> run the unit test script. The readme.md is one line. The comments in the 
> shell script assume you know what each settable parameter does, and how 
> it is to be assigned.

Andrew Jeffery pointed out this document last night:
    https://github.com/openbmc/docs/blob/master/testing/local-ci-build.md

I have all of my repositories cloned into a single subdirectory, which
makes using this script much easier than if they were spread out.
You'll see the doc above references as `/path/to/ci_test_area` and doing
additional clones / git-worktrees, but if you just keep everything
cloned in one sub-directory that *is* the ci_test_area / WORKSPACE.

I typically run this little helper script from a repo I want to test:

$ which lf-ut
lf-ut () {
	REPO="$(git rev-parse --show-toplevel)"
	UT_PATH="$(wd path obmcsrc)/openbmc-build-scripts"
	UNIT_TEST_PKG="$(basename $REPO)" WORKSPACE="$(dirname $REPO)" "$UT_PATH/run-unit-test-docker.sh"
}
$ EXTRA_UNIT_TEST_ARGS="--noformat" lf-ut

I use zsh, so ... Anyhow, `wd path obmcsrc` is the path to my workspace
where all the code is extracted.

> I'm pretty sure I had 1:1 assistance from someone familiar with the test 
> configuration to get this to work. The effort involved is more than "get 
> docker, run script".
> 
> I request that someone familiar with the configuration and operation of 
> this script please provide information about how to get the environment 
> configured, and some example use cases for running the system. One place 
> in particular that I found difficult/impossible was to run a test on 
> code that required changes in other repositories. For example, if 
> phosphor-network needed changes that are provided by 
> phosphor-dbus-interfaces how would you configure the test run to be 
> successful?

Right now there isn't a way to test two repositories together.  This is
an aspect I mentioned of wanting to improve (at least for Gerrit).  Your
only option right now is:

   1. Push your phosphor-dbus-interfaces change to Gerrit.
   2. Edit `scripts/build-unit-test-docker` and insert a "rev" keyword
      under "phosphor-dbus-interfaces" with your git commit hash from
      step 1 (this should hopefully be obvious when you look at the
      script).
   3. Run something like `lf-ut` above from inside phosphor-network.

** Step #2 assumes you're running my new versions of the script **

Hope this helps!

-- 
Patrick Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20210212/d68be05b/attachment-0001.sig>


More information about the openbmc mailing list