signetlabdei / lorawan

An ns-3 module for simulation of LoRaWAN networks
GNU General Public License v2.0
189 stars 131 forks source link

Fix errors in the CI pipeline introduced by ns-3.41 #158

Closed non-det-alle closed 6 months ago

non-det-alle commented 6 months ago

The upgrade to ns-3.41 caused the CI pipeline to start failing. In particular, the PhyConnectivityTest case was not passing anymore when the module was compiled with g++ in default mode (strangely enough the same test was passing when ccache was not used, or with ccache but compiling in optimized mode).

The failing assertion was tracked down to be on the function HaveSamePacketContents, which compared the serialized contents of two Packet objects byte by byte. I suppose that the error is caused by some internal optimization done by ns-3, because the two packets have the same unique identifier. The unique identifier seems to be the correct way to check whether two Packet objects are the same, so the function was changed accordingly and the test started working correctly again.

This PR also includes the second enhancement to the build and test task that I was not able to implement in the past. Up to now, tests were skipped if ccache resulted in 0 cache misses after the build phase. This meant that the CI pipeline could fail once due to the tests failing, but it could be rerun just after, reuse the cache, skip the tests and give a false positive on the same code.

As done in the GitLab CI pipeline of ns-3, we now use a cached empty file to track successful tests. This placeholder file is created when compilation happens with >0 cache misses, it is always downloaded before tests and only deleted if the tests are successful. Thus, now tests are only skipped if they have been already executed successfully on a codebase state fully present in the cache.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 76.23%. Comparing base (69cb2e3) to head (15c4c4e).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #158 +/- ## =========================================== - Coverage 76.27% 76.23% -0.05% =========================================== Files 69 69 Lines 5451 5441 -10 =========================================== - Hits 4158 4148 -10 Misses 1293 1293 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.