Giter VIP home page Giter VIP logo

Comments (11)

glitchcore avatar glitchcore commented on July 28, 2024

Code to determine newly added functions in pull requests and warn or reject if unit tests not added

How it work? Tool literally check if new function (in programming language meaning) was added?

from flipperzero-firmware.

glitchcore avatar glitchcore commented on July 28, 2024

Now we have draft test, simple build special firmware, run test functions and check results:

docker-compose exec dev make -C target_lo test

I understand this is not perfect test environment and would be great to improve and automate it.

from flipperzero-firmware.

glitchcore avatar glitchcore commented on July 28, 2024

Maybe we should use any C test framework?

from flipperzero-firmware.

rusdacent avatar rusdacent commented on July 28, 2024

Maybe we should use any C test framework?

I have some experience with http://cunit.sourceforge.net/ (maybe fork of CUnit cunity - https://gitlab.com/cunity )

from flipperzero-firmware.

glitchcore avatar glitchcore commented on July 28, 2024

Can you adapt existing test to CUnit?

from flipperzero-firmware.

rusdacent avatar rusdacent commented on July 28, 2024

Can you adapt existing test to CUnit?

Yes, I can try.

from flipperzero-firmware.

mcheshkov avatar mcheshkov commented on July 28, 2024

Code to determine newly added functions in pull requests and warn or reject if unit tests not added

IMO, that approach is not good, especially rejecting. Either it will force you to make less functions, or to make simple silly tests. And, while silly tests will run function at least once, it's not enough to skip code review.

I see this specific issue as human-oriented, because "enough tests" or "good tests" should be determined by human, and thus it should not be solved by technical means. Aided by - maybe. I.e. warnings about new functions without single test should be accessible by reviewers from PR, not buried down in build logs on developer or CI machine.

from flipperzero-firmware.

glitchcore avatar glitchcore commented on July 28, 2024

IMO, that approach is not good, especially rejecting "enough tests" or "good tests" should be determined by human

Looks reasonably, determine test "quality" by human point of view is more robust.

warnings about new functions without single test should be accessible by reviewers from PR

Is there any tools that show code coverage during PR directly in GitHub interface?

from flipperzero-firmware.

mcheshkov avatar mcheshkov commented on July 28, 2024

Is there any tools that show code coverage during PR directly in GitHub interface?

I'm not really familiar with modern GitHub. There certainly is coveralls and codecov, but I have no experience with them.
codecov declare some support for C, C++ and Rust, but is free for private repos only for up to 5 users.
coveralls is free only for open source, and don't even mention Rust in docs.

lcov has genhtml, which looks good enough for me, maybe there's a simple way to publish generated HTML as a build artifact and add a link to it in PR checks or comments.
grcov also has some kind of HTML report.

We also may want to build two separate reports for each PR - one with full coverage, and one with diff between PR base and head, but I didn't found that specific case in genhtml. codecov can add nice comment to PR on each update.

from flipperzero-firmware.

rusdacent avatar rusdacent commented on July 28, 2024

Chose https://github.com/barrust/c-utils#minunit. It's fork of https://github.com/siu/minunit. Simple testing framework, contains one .h file.

from flipperzero-firmware.

glitchcore avatar glitchcore commented on July 28, 2024

close by #168

from flipperzero-firmware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.