[riot-notifications] [RIOT-OS/RIOT] makefiles/utils: add util to compare to software versions (#15458)

Alexandre Abadie notifications at github.com
Sat Nov 21 16:28:55 CET 2020


@aabadie commented on this pull request.



> +test-version_is_greater:
+	$(Q)bash -c 'test 1 = "$(call version_is_greater,$(TEST_VERSION_1),$(TEST_VERSION_2))" || { echo ERROR: "$(TEST_VERSION_2)" \< "$(TEST_VERSION_1)"; exit 1; }'
+	$(Q)bash -c 'test 1 = "$(call version_is_greater,$(TEST_VERSION_3),$(TEST_VERSION_1))" || { echo ERROR: "$(TEST_VERSION_1)" \< "$(TEST_VERSION_3)"; exit 1; }'
+	$(Q)bash -c 'test 1 = "$(call version_is_greater,$(TEST_VERSION_4),$(TEST_VERSION_3))" || { echo ERROR: "$(TEST_VERSION_3)" \< "$(TEST_VERSION_4)"; exit 1; }'

Here I would also add tests that are expected to fail. Here is an example:

```diff
diff --git a/makefiles/utils/test-strings.mk b/makefiles/utils/test-strings.mk
index 34ab77f1d3..fa80cde7d7 100644
--- a/makefiles/utils/test-strings.mk
+++ b/makefiles/utils/test-strings.mk
@@ -23,3 +23,4 @@ test-version_is_greater:
        $(Q)bash -c 'test 1 = "$(call version_is_greater,$(TEST_VERSION_1),$(TEST_VERSION_2))" || { echo ERROR: "$(TEST_VERSION_2)" \< "$(TEST_VERSION_1)"; exit 1; }'
        $(Q)bash -c 'test 1 = "$(call version_is_greater,$(TEST_VERSION_3),$(TEST_VERSION_1))" || { echo ERROR: "$(TEST_VERSION_1)" \< "$(TEST_VERSION_3)"; exit 1; }'
        $(Q)bash -c 'test 1 = "$(call version_is_greater,$(TEST_VERSION_4),$(TEST_VERSION_3))" || { echo ERROR: "$(TEST_VERSION_3)" \< "$(TEST_VERSION_4)"; exit 1; }'
+       $(Q)bash -c 'test "" = "$(call version_is_greater,$(TEST_VERSION_3),$(TEST_VERSION_4))" || { echo ERROR: Test should fail, "$(TEST_VERSION_4)" is not \< "$(TEST_VERSION_3)"; exit 1; }'
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15458#pullrequestreview-535973722
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201121/de05ca38/attachment.htm>


More information about the notifications mailing list