<div dir="ltr"><div>Hi, all</div><div><br></div><div>Sorry again for the missing status reports. Since it's a bit late, I would </div><div>like not to bother sending two emails (#0 adn #1) and just summarize what I </div><div>did and what I'm going to do next in this email.</div><div><br></div><div>Work outline:</div><div><br></div><div>1. It took me quite a while to understand how the entire test suite works on </div><div>comparing and measuring coverage. Since coverage is one of the important </div><div>point of the project, now I want to share what I've learned at first.</div><div>Strace's coverage report is based on gcov and made graphical and visible</div><div>by lcov.</div><div><br></div><div>$ ./configure --enable-code-coverage && make check-code-coverage</div><div><br></div><div>And one thing that I didn't know before is that how gcov measures "branch".</div><div>According to the theory about branch testing, "branches" come from decision </div><div>points, that is, literally true or false. For example, an </div><div>"if (condition) { ... }" has two branches because the "if" is a decision </div><div>point and "switch ... case ..." is similar.</div><div>So when I saw the code below:</div><div><br></div><div>if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)</div><div>        return 0;</div><div><br></div><div>I simply thougt there were just two branches which need to be covered. But </div><div>the lcov web page shows there are 6 branches and it seemes like something </div><div>related to condition coverage, at least not theoretical branch coverage. </div><div>And I'm curious about how these "branches" are mearsured because they are </div><div>more like "conditions" instead of "branches". Besides, from branch 0 to 5,</div><div>which condition should I refer to? I did some research on it and found a </div><div>testing method called MC/DC (Modified condition/decision coverage), which </div><div>is a combination of condition and decision in a way. For making better </div><div>coverage, this makes sense.</div><div>Take the simpler code below as example:</div><div><br></div><div>if (i == 1 || j != 0 || k == 2)</div><div>        return 0;</div><div><br></div><div>When seeing from the gcov's side, the code looks like this:</div><div><br></div><div>if (i != 1) {<span style="white-space:pre">                   </span>//branch 0</div><div>        if (j == 0) {   <span style="white-space:pre">      </span>//branch 2</div><div>                if (k != 2) {   //branch 4</div><div>                        //next statement</div><div>                } else {        //branch 5</div><div>                        return 0;</div><div>                }</div><div>        } else {        <span style="white-space:pre">     </span>//branch 3</div><div>                return 0;</div><div>        }</div><div>} else {        <span style="white-space:pre">            </span>//branch1</div><div>        return 0;</div><div>}</div><div><br></div><div>I'm not so sure whether I'm understanding this right. Any comments and </div><div>suggestions are welcome :).</div><div><br></div><div>2. About how to run the test suite. Actually it's easy to run the tests</div><div>manually by executing:</div><div><br></div><div>$ make check</div><div><br></div><div>Basically it runs tests in tests/, tests-m32/, tests-mx32/ directories. But</div><div>I've been using fedora, which is a Red Hat based distribution and found that</div><div>tests in tests-mx32 never run. According to strace's man page, mx32-mpers is </div><div>"non-native 32-on-64-bit binaries", x32 ABI, in other words. I found this </div><div>website[0] but it's a little bit out-of-date. With Dmitry and eSyr's help I </div><div>noticed that's because fedora doesn't provide x32 ABI support officially so </div><div>I installed an ubuntu on my laptop and it turned out Debian based distros </div><div>have x32 ABI support enabled by default. Other websites I found are [1] and</div><div>[2].</div><div><br></div><div>3. I write part of test [3] for fcntl syscall to make its coverage reach 100% </div><div>based on what I've learned about coverage so I know which part of tests are </div><div>missing. But it's more like a draft because it's not concise at all. I'd </div><div>appreciate any reviewing and comments on the code. I'm now taking membarrier </div><div>test and [4] as reference according to eSyr's suggestion.</div><div><br></div><div>TODO:</div><div>I've skimed through the man page of fcntl, bpf and have an overview now so </div><div>the next step is to send patches or make the code I've already wrriten </div><div>qualified to be merged.</div><div>Of course there still a lot of syscall and their options/flags I don't know</div><div>well enough. I'm planning to investigate syscalls related to socket and </div><div>quota and improve the test coverage for them.</div><div>I don't know much about glibc and when it comes to portability and </div><div>compatibility (e.g. #ifdef something ... #include <something.h> ... #endif), </div><div>I got stuck so I have to learn it by referring more examples. If anyone knows a </div><div>better way to learn it, please tell me. Thanks!</div><div><br></div><div>[0]<a href="https://sites.google.com/site/x32abi/">https://sites.google.com/site/x32abi/</a></div><div>[1]<a href="https://wiki.debian.org/X32Port">https://wiki.debian.org/X32Port</a></div><div>[2]<a href="https://sourceware.org/glibc/wiki/x32">https://sourceware.org/glibc/wiki/x32</a></div><div>[3]<a href="https://github.com/haoyouab/strace/commits/master">https://github.com/haoyouab/strace/commits/master</a></div><div>[4]<a href="https://github.com/esyr-rh/strace/commit/23450af02dbdb9477ffedf44ff026ed59d2d2c73">https://github.com/esyr-rh/strace/commit/23450af02dbdb9477ffedf44ff026ed59d2d2c73</a></div><div><br></div><div><br></div><div>Zhibin Li</div></div>