All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] test/py: hush_if_test: Add tests to cover octal/hex values
@ 2020-01-06  9:18 Michal Simek
  2020-01-16  7:17 ` Michal Simek
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2020-01-06  9:18 UTC (permalink / raw)
  To: u-boot

Extend test suite to cover also automatic octal/hex converstions which
haven't been implemented in past.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---

Changes in v2:
- Based on discussion with Simon add TODO

Depends on https://lists.denx.de/pipermail/u-boot/2019-September/383309.html

There are of course other tests which we can run but not sure if make sense
to have there all combinations. The most interesting are mixed tests which
are failing before patch above is applied.
Definitely please let me know if you want to add any other test.

---
 test/py/tests/test_hush_if_test.py | 31 ++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/test/py/tests/test_hush_if_test.py b/test/py/tests/test_hush_if_test.py
index bba8d41d9648..d117921a6ac7 100644
--- a/test/py/tests/test_hush_if_test.py
+++ b/test/py/tests/test_hush_if_test.py
@@ -7,6 +7,10 @@ import os
 import os.path
 import pytest
 
+# TODO: These tests should be converted to a C test.
+# For more information please take a look at the thread
+# https://lists.denx.de/pipermail/u-boot/2019-October/388732.html
+
 pytestmark = pytest.mark.buildconfigspec('hush_parser')
 
 # The list of "if test" conditions to test.
@@ -52,6 +56,33 @@ subtests = (
     ('test 123 -ge 123', True),
     ('test 123 -ge 456', False),
 
+    # Octal tests
+
+    ('test 010 -eq 010', True),
+    ('test 010 -eq 011', False),
+
+    ('test 010 -ne 011', True),
+    ('test 010 -ne 010', False),
+
+    # Hexadecimal tests
+
+    ('test 0x2000000 -gt 0x2000001', False),
+    ('test 0x2000000 -gt 0x2000000', False),
+    ('test 0x2000000 -gt 0x1ffffff', True),
+
+    # Mixed tests
+
+    ('test 010 -eq 10', False),
+    ('test 010 -ne 10', True),
+    ('test 0xa -eq 10', True),
+    ('test 0xa -eq 012', True),
+
+    ('test 2000000 -gt 0x1ffffff', False),
+    ('test 0x2000000 -gt 1ffffff', True),
+    ('test 0x2000000 -lt 1ffffff', False),
+    ('test 0x2000000 -eq 2000000', False),
+    ('test 0x2000000 -ne 2000000', True),
+
     ('test -z ""', True),
     ('test -z "aaa"', False),
 
-- 
2.24.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH v2] test/py: hush_if_test: Add tests to cover octal/hex values
  2020-01-06  9:18 [PATCH v2] test/py: hush_if_test: Add tests to cover octal/hex values Michal Simek
@ 2020-01-16  7:17 ` Michal Simek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2020-01-16  7:17 UTC (permalink / raw)
  To: u-boot

po 6. 1. 2020 v 10:18 odesílatel Michal Simek <michal.simek@xilinx.com> napsal:
>
> Extend test suite to cover also automatic octal/hex converstions which
> haven't been implemented in past.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Acked-by: Stephen Warren <swarren@nvidia.com>
> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> ---
>
> Changes in v2:
> - Based on discussion with Simon add TODO
>
> Depends on https://lists.denx.de/pipermail/u-boot/2019-September/383309.html
>
> There are of course other tests which we can run but not sure if make sense
> to have there all combinations. The most interesting are mixed tests which
> are failing before patch above is applied.
> Definitely please let me know if you want to add any other test.
>
> ---
>  test/py/tests/test_hush_if_test.py | 31 ++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
>
> diff --git a/test/py/tests/test_hush_if_test.py b/test/py/tests/test_hush_if_test.py
> index bba8d41d9648..d117921a6ac7 100644
> --- a/test/py/tests/test_hush_if_test.py
> +++ b/test/py/tests/test_hush_if_test.py
> @@ -7,6 +7,10 @@ import os
>  import os.path
>  import pytest
>
> +# TODO: These tests should be converted to a C test.
> +# For more information please take a look at the thread
> +# https://lists.denx.de/pipermail/u-boot/2019-October/388732.html
> +
>  pytestmark = pytest.mark.buildconfigspec('hush_parser')
>
>  # The list of "if test" conditions to test.
> @@ -52,6 +56,33 @@ subtests = (
>      ('test 123 -ge 123', True),
>      ('test 123 -ge 456', False),
>
> +    # Octal tests
> +
> +    ('test 010 -eq 010', True),
> +    ('test 010 -eq 011', False),
> +
> +    ('test 010 -ne 011', True),
> +    ('test 010 -ne 010', False),
> +
> +    # Hexadecimal tests
> +
> +    ('test 0x2000000 -gt 0x2000001', False),
> +    ('test 0x2000000 -gt 0x2000000', False),
> +    ('test 0x2000000 -gt 0x1ffffff', True),
> +
> +    # Mixed tests
> +
> +    ('test 010 -eq 10', False),
> +    ('test 010 -ne 10', True),
> +    ('test 0xa -eq 10', True),
> +    ('test 0xa -eq 012', True),
> +
> +    ('test 2000000 -gt 0x1ffffff', False),
> +    ('test 0x2000000 -gt 1ffffff', True),
> +    ('test 0x2000000 -lt 1ffffff', False),
> +    ('test 0x2000000 -eq 2000000', False),
> +    ('test 0x2000000 -ne 2000000', True),
> +
>      ('test -z ""', True),
>      ('test -z "aaa"', False),
>
> --
> 2.24.0
>

Applied.
M

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-16  7:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06  9:18 [PATCH v2] test/py: hush_if_test: Add tests to cover octal/hex values Michal Simek
2020-01-16  7:17 ` Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.