-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unit tests for macros.h #26968
Add unit tests for macros.h #26968
Conversation
Wait, you are saying these functions are critical and should not have any regressions, but the tests are autogenerated and nobody should thoroughly check whether they test for the right thing? That sounds ... dangerous. ALso, the unclear copyright situation of CoPilot generated code seems to be a risk for Marlin to adopt something that's been mostly autogenerated where the PR author suggests not reviewing the changes. I am not implying this is an xz-utils situation, but this seems to be ill-thought out. |
@oliof sounds like you are volunteering to go line by line and check all this out. Thanks! |
Tests should be reviewed by people who intimately understand the Macros. I am not that person. Yet I can express my concern about the PR submitters idea of adding critical code without thorough review. I should not suffer passive aggressiveness from anyone for that.
That said, I did read the code and it _looks_ reasonable, but that's exactly what CoPilot does: It creates things that _look_ reasonable. It should be reviewed by a subject matter expert.
Gesendet von Proton Mail für Android
…-------- Ursprüngliche Nachricht --------
Am 14.04.24 14:53 um Taylor Talkington schrieb :
***@***.***(https://github.com/oliof) sounds like you are volunteering to go line by line and check all this out. Thanks!
—
Reply to this email directly, [view it on GitHub](#26968 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAJMOI5PDG2LEXXFMRJS5CLY5J33PAVCNFSM6AAAAABGF3TTPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJUGA2DONZYG4).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@oliof And I believe no one here should suffer accusations of malintent, whether thinly veiled as questionable ignorance or not. The reality is that if this waited for the type of review you speak of it'd never be completed. Is it a perfect situation? No, but it is progress and I trust sjasonsmith to have made a decision to have an overall positive impact on this project. |
I absolutely agree that this PR was made with the best interests of the project in mind.
Gesendet von Proton Mail für Android
…-------- Ursprüngliche Nachricht --------
Am 14.04.24 15:09 um Taylor Talkington schrieb :
***@***.***(https://github.com/oliof) And I believe no one here should suffer accusations of malintent, whether thinly veiled as questionable ignorance or not. The reality is that if this waited for the type of review you speak of it'd never be completed.
Is it a perfect situation? No, but it is progress and I trust sjasonsmith to have made a decision to have an overall positive impact on this project.
—
Reply to this email directly, [view it on GitHub](#26968 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAJMOIZDNBBBLNA4ZP5ACDDY5J5W3AVCNFSM6AAAAABGF3TTPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJUGA2TMOBYGU).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@oliof they were created with Github Copilot, but that is far from being auto-generated. They were still created one block of tests at a time and reviewed by myself. Copilot was instructed to adjust them where I saw flaws or lack of coverage, and I hand-edited a few where the macros are just too confusing for Copilot to work with.
The tests are not themselves critical code, they test critical code. Do they test everything? Nope, but neither do carefully crafted human tests, and these provide more value than the zero tests that were there previously. You can think of adding unit tests into Marlin as an experiment at this stage...but we have to get tests in place for that experiment to continue. We will never get any meaningful test coverage if every new test spends months under review. Ideally for new work tests would be added along with the new code, but as of yet we have no guidelines for that within Marlin.
When adding unit tests to existing code, the goal is less about testing proper behavior, and more about locking down existing behavior. These tests serve as a barometer for accidental behavior alteration, even if the new behavior is improvement. In that case, the decision can be made whether the new code has a bug, or the existing tests should be altered. |
Thanks for the detailed reply Jason, this approach makes complete sense to me.
…-------- Ursprüngliche Nachricht --------
Am 14.04.24 18:44 um Jason Smith schrieb :
> Wait, you are saying these functions are critical and should not have any regressions, but the tests are autogenerated and nobody should thoroughly check whether they test for the right thing?
***@***.***(https://github.com/oliof) they were created with Github Copilot, but that is far from being auto-generated. They were still created one block of tests at a time and reviewed by myself. Copilot was instructed to adjust them where I saw flaws or lack of coverage, and I hand-edited a few where the macros are just too confusing for Copilot to work with.
> I can express my concern about the PR submitters idea of adding critical code without thorough review.
The tests are not themselves critical code, they test critical code. Do they test everything? Nope, but neither do carefully crafted human tests, and these provide more value than the zero tests that were there previously.
You can think of adding unit tests into Marlin as an experiment at this stage...but we have to get tests in place for that experiment to continue. We will never get any meaningful test coverage if every new test spends months under review.
Ideally for new work tests would be added along with the new code, but as of yet we have no guidelines for that within Marlin.
> without thorough review
When adding unit tests to existing code, the goal is less about testing proper behavior, and more about locking down existing behavior. These tests serve as a barometer for accidental behavior alteration, even if the new behavior is improvement. In that case, the decision can be made whether the new code has a bug, or the existing tests should be altered.
—
Reply to this email directly, [view it on GitHub](#26968 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAJMOIYAWUTUNYI724QJD3TY5KW7VAVCNFSM6AAAAABGF3TTPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJUGEYTOOJQGQ).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
commit 02ba6f9 Author: thinkyhead <[email protected]> Date: Fri Apr 19 00:21:25 2024 +0000 [cron] Bump distribution date (2024-04-19) commit dba0010 Author: Andrew <[email protected]> Date: Thu Apr 18 19:04:03 2024 -0400 🎨 Rename some G-code files (MarlinFirmware#26981) commit 90667f6 Author: I3DBeeTech <[email protected]> Date: Fri Apr 19 02:24:17 2024 +0530 🐛 Fix BLACKBEEZMINI fan, info (MarlinFirmware#26983) commit d6961b2 Author: thinkyhead <[email protected]> Date: Wed Apr 17 06:06:51 2024 +0000 [cron] Bump distribution date (2024-04-17) commit 07ebb81 Author: Javlon Sodikov <[email protected]> Date: Wed Apr 17 10:25:22 2024 +0500 🩹Fix ProUI error when !CASELIGHT_USES_BRIGHTNESS (MarlinFirmware#26976) * Fix the compile error with the case light menu Fix the compile error with the case light menu * Add failing test --------- Co-authored-by: Jason Smith <[email protected]> commit 245db73 Author: thinkyhead <[email protected]> Date: Tue Apr 16 18:06:16 2024 +0000 [cron] Bump distribution date (2024-04-16) commit 9342dae Author: Scott Lahteine <[email protected]> Date: Tue Apr 16 12:17:47 2024 -0500 📝 Remove dead PDF links commit 1f84f50 Author: thinkyhead <[email protected]> Date: Mon Apr 15 02:38:10 2024 +0000 [cron] Bump distribution date (2024-04-15) commit 3326c74 Author: Scott Lahteine <[email protected]> Date: Sun Apr 14 16:26:16 2024 -0500 📝 Minor README changes commit 0269106 Author: Scott Lahteine <[email protected]> Date: Sun Apr 14 16:24:14 2024 -0500 🎨 Dagoma D6 followup commit 95d38a8 Author: Sophist <[email protected]> Date: Sun Apr 14 21:04:52 2024 +0100 ✨ Add Dagoma D6 as found in DiscoUltimate v2 TMC (MarlinFirmware#26874) * Add Dagoma D6 board as used in their DiscoUltimate v2 TMC. Taken from the Dagoma fork of Marlin DU_MC branch where it is called FYSETC_DAGOMA_F5 and explicitly confirmed by Dagoma as being the D6: "the BOARD_FYSETC_DAGOMA_F5 is effectively the definition for the D6" --------- Co-authored-by: thisiskeithb <[email protected]> Co-authored-by: Orel <[email protected]> commit dca6afc Author: Chris <[email protected]> Date: Sun Apr 14 20:42:57 2024 +0200 ✨🐛 HC32 - Add SERIAL_DMA, fix SDIO and MEATPACK (MarlinFirmware#26845) * fix meatpack on hc32 * add support for SERIAL_DMA on HC32 * add additional checks in HC32 HAL * migrate HC32 HAL to use app_config.h * fix memory leak in HC32 sdio HAL MarlinFirmware#26845 (comment) * hc32: fail if both EMERGENCY_PARSER and SERIAL_DMA are enabled commit 19684f2 Author: Jason Smith <[email protected]> Date: Sat Apr 13 17:49:08 2024 -0700 ✅ Add unit tests for macros.h (MarlinFirmware#26968) commit 52a5613 Author: Keith Bennett <[email protected]> Date: Sat Apr 13 17:47:16 2024 -0700 ⏪️ Revert unintended README changes (MarlinFirmware#26967) * Revert all the changes that went in with the unit test framework This restored broken links and other changes. Restoring to the prior revision seems the most appropriate action until the intentions of those file changes are known. --------- Co-authored-by: Jason Smith <[email protected]> commit 0683e8a Author: thinkyhead <[email protected]> Date: Sun Apr 14 00:24:15 2024 +0000 [cron] Bump distribution date (2024-04-14) commit 1bb4a04 Author: Jason Smith <[email protected]> Date: Sat Apr 13 14:11:51 2024 -0700 ✅Unit test improvements (MarlinFirmware#26965) * Do not warn about display in unit tests * Treat warnings as errors in unit tests * Report actual filenames with unit tests commit d10861e Author: Jason Smith <[email protected]> Date: Sat Apr 13 12:06:08 2024 -0700 ✅ Add unit testing framework (MarlinFirmware#26948) - Add a framework to build and execute unit tests for Marlin. - Enable unit test execution as part of PR checks. --------- Co-authored-by: Costas Basdekis <[email protected]> Co-authored-by: Scott Lahteine <[email protected]> commit cf7c86d Author: Andrew <[email protected]> Date: Sat Apr 13 14:59:59 2024 -0400 🔧Fix M936 in features.ini (MarlinFirmware#26957) commit d99e150 Author: David Buezas <[email protected]> Date: Sat Apr 13 18:54:25 2024 +0200 ⚡️Reduce DISPLAY_SLEEP_MINUTES overhead (MarlinFirmware#26964)
Description
Marlin macros are at the core of almost all functionality. It is imperative that they work as intended, and be protected against accidental regressions.
This is a large amount of test code which was about 90% written by Github Copilot. There may be inconsistencies in style, but due to the large amount to create it wasn't practical to hand-curate every line.
I do not think it is worthwhile for anybody to review every single line of this. It should suffice to recognize that it passes all PR checks and can begin checking for altered behavior on future submissions.
Requirements
N/A
Benefits
Protect against regressions in macros.h.
Configurations
N/A
Related Issues
N/A