Skip to contentSkip to conversation

ut overlay fails with v2018.03 and later on qemu-arm64_defconfig

U-Boot Heinrich Schuchardt 3 participants 3 messages Dec 8, 2018 – Dec 10, 2018

lore
Share & tools
lore
#0 lore raw

Hello Simon,

on qemu-arm_defconfig fails with

=> ut overlay
Running 9 overlay tests
Test: fdt_overlay_add_node_by_path test/overlay/cmd_ut_overlay.c:127, fdt_overlay_add_node_by_path(): off >= 0
Test: fdt_overlay_add_node_by_phandle test/overlay/cmd_ut_overlay.c:113, fdt_overlay_add_node_by_phandle():
off >= 0
Test: fdt_overlay_add_str_property test/overlay/cmd_ut_overlay.c:100, fdt_overlay_add_str_property(): 0 == fdt_getprop_str(fdt, "/test-node", "test-str-property-2", &val):
Expected 0, got -9
Test: fdt_overlay_add_subnode_property test/overlay/cmd_ut_overlay.c:141, fdt_overlay_add_subnode_property():
off >= 0
Test: fdt_overlay_change_int_property test/overlay/cmd_ut_overlay.c:74, fdt_overlay_change_int_property(): 0 == ut_fdt_getprop_u32(fdt, "/test-node", "test-int-property", &val):
Expected 0, got -9
Test: fdt_overlay_change_str_property test/overlay/cmd_ut_overlay.c:87, fdt_overlay_change_str_property(): 0 == fdt_getprop_str(fdt, "/test-node", "test-str-property", &val):
Expected 0, got -9
Test: fdt_overlay_local_phandle test/overlay/cmd_ut_overlay.c:158, fdt_overlay_local_phandle(): off >= 0
Test: fdt_overlay_local_phandles test/overlay/cmd_ut_overlay.c:183, fdt_overlay_local_phandles(): off >= 0
Test: fdt_overlay_stacked
test/overlay/cmd_ut_overlay.c:212, fdt_overlay_stacked(): 0 == ut_fdt_getprop_u32(fdt, "/new-local-node", "stacked-test-int-property", &val): Expected 0, got -9
Failures: 9

This is reproducable with v2018.03, v2018.05, v2018.07, v2018.09, v2018.11 and with current origin/master (358902586727 "Merge branch '2018-12-06-master-imports'").

For the elder releases I had to apply
d796735c334b "test: overlay: add missing include"

The value of off is -9 in the tests above. This is -FDT_ERR_BADMAGIC.

Adding some debug output sheds more light:

test/overlay/cmd_ut_overlay.c(290) do_ut_overlay: fdt_base_copy 000000007ef33340
test/overlay/cmd_ut_overlay.c(291) do_ut_overlay: uts->priv 000000007ef33340 Running 9 overlay tests
Test: fdt_overlay_add_node_by_path test/overlay/cmd_ut_overlay.c(127) fdt_overlay_add_node_by_path:
uts->priv 0000000000000000

This is the patch that led to problem:
e93232e15ec9 ("test: overlay: Use cmd_ut_category()")

The uts created in do_ut_overlay() is not the one used in cmd_ut_category().

The easiest fix would be using a static variable for passing the fdt.

The neatest solution would be cmd_ut_category() calling an initialization function for the category so that we can use a single instance of uts for the whole test.

As this API is your design I would prefer leaving the resolution to you.

Besides resolving the error I think we should run 'ut overlay' on Travis CI for all qemu platforms.

Best regards

Heinrich

#1 lore raw
Quoted 62 lines · Heinrich Schuchardt

Hello Simon,

on qemu-arm_defconfig fails with

=> ut overlay
Running 9 overlay tests
Test: fdt_overlay_add_node_by_path test/overlay/cmd_ut_overlay.c:127, fdt_overlay_add_node_by_path(): off >= 0
Test: fdt_overlay_add_node_by_phandle test/overlay/cmd_ut_overlay.c:113, fdt_overlay_add_node_by_phandle():
off >= 0
Test: fdt_overlay_add_str_property test/overlay/cmd_ut_overlay.c:100, fdt_overlay_add_str_property(): 0 == fdt_getprop_str(fdt, "/test-node", "test-str-property-2", &val):
Expected 0, got -9
Test: fdt_overlay_add_subnode_property test/overlay/cmd_ut_overlay.c:141, fdt_overlay_add_subnode_property():
off >= 0
Test: fdt_overlay_change_int_property test/overlay/cmd_ut_overlay.c:74, fdt_overlay_change_int_property(): 0 == ut_fdt_getprop_u32(fdt, "/test-node", "test-int-property", &val):
Expected 0, got -9
Test: fdt_overlay_change_str_property test/overlay/cmd_ut_overlay.c:87, fdt_overlay_change_str_property(): 0 == fdt_getprop_str(fdt, "/test-node", "test-str-property", &val):
Expected 0, got -9
Test: fdt_overlay_local_phandle test/overlay/cmd_ut_overlay.c:158, fdt_overlay_local_phandle(): off >= 0
Test: fdt_overlay_local_phandles test/overlay/cmd_ut_overlay.c:183, fdt_overlay_local_phandles(): off >= 0
Test: fdt_overlay_stacked
test/overlay/cmd_ut_overlay.c:212, fdt_overlay_stacked(): 0 == ut_fdt_getprop_u32(fdt, "/new-local-node", "stacked-test-int-property", &val): Expected 0, got -9
Failures: 9

This is reproducable with v2018.03, v2018.05, v2018.07, v2018.09, v2018.11 and with current origin/master (358902586727 "Merge branch '2018-12-06-master-imports'").

For the elder releases I had to apply
d796735c334b "test: overlay: add missing include"

The value of off is -9 in the tests above. This is -FDT_ERR_BADMAGIC.

Adding some debug output sheds more light:

test/overlay/cmd_ut_overlay.c(290) do_ut_overlay: fdt_base_copy 000000007ef33340
test/overlay/cmd_ut_overlay.c(291) do_ut_overlay: uts->priv 000000007ef33340 Running 9 overlay tests
Test: fdt_overlay_add_node_by_path test/overlay/cmd_ut_overlay.c(127) fdt_overlay_add_node_by_path:
uts->priv 0000000000000000

This is the patch that led to problem:
e93232e15ec9 ("test: overlay: Use cmd_ut_category()")

The uts created in do_ut_overlay() is not the one used in cmd_ut_category().

The easiest fix would be using a static variable for passing the fdt.

Quoted 8 lines

The neatest solution would be cmd_ut_category() calling an initialization function for the category so that we can use a single instance of uts for the whole test.

As this API is your design I would prefer leaving the resolution to you.

Besides resolving the error I think we should run 'ut overlay' on Travis CI for all qemu platforms.

I agree we should enable UT_OVERLAY as widely as possible in our automated testing platforms, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181210/78422f56/attachment.sig>
#2 lore raw

Am 10.12.2018 um 21:43 schrieb Tom Rini:

Quoted 67 lines · Heinrich Schuchardt
Quoted 66 lines

Hello Simon,

on qemu-arm_defconfig fails with

=> ut overlay
Running 9 overlay tests
Test: fdt_overlay_add_node_by_path test/overlay/cmd_ut_overlay.c:127, fdt_overlay_add_node_by_path(): off >= 0
Test: fdt_overlay_add_node_by_phandle test/overlay/cmd_ut_overlay.c:113, fdt_overlay_add_node_by_phandle():
off >= 0
Test: fdt_overlay_add_str_property test/overlay/cmd_ut_overlay.c:100, fdt_overlay_add_str_property(): 0 == fdt_getprop_str(fdt, "/test-node", "test-str-property-2", &val):
Expected 0, got -9
Test: fdt_overlay_add_subnode_property test/overlay/cmd_ut_overlay.c:141, fdt_overlay_add_subnode_property():
off >= 0
Test: fdt_overlay_change_int_property test/overlay/cmd_ut_overlay.c:74, fdt_overlay_change_int_property(): 0 == ut_fdt_getprop_u32(fdt, "/test-node", "test-int-property", &val):
Expected 0, got -9
Test: fdt_overlay_change_str_property test/overlay/cmd_ut_overlay.c:87, fdt_overlay_change_str_property(): 0 == fdt_getprop_str(fdt, "/test-node", "test-str-property", &val):
Expected 0, got -9
Test: fdt_overlay_local_phandle test/overlay/cmd_ut_overlay.c:158, fdt_overlay_local_phandle(): off >= 0
Test: fdt_overlay_local_phandles test/overlay/cmd_ut_overlay.c:183, fdt_overlay_local_phandles(): off >= 0
Test: fdt_overlay_stacked
test/overlay/cmd_ut_overlay.c:212, fdt_overlay_stacked(): 0 == ut_fdt_getprop_u32(fdt, "/new-local-node", "stacked-test-int-property", &val): Expected 0, got -9
Failures: 9

This is reproducable with v2018.03, v2018.05, v2018.07, v2018.09, v2018.11 and with current origin/master (358902586727 "Merge branch '2018-12-06-master-imports'").

For the elder releases I had to apply
d796735c334b "test: overlay: add missing include"

The value of off is -9 in the tests above. This is -FDT_ERR_BADMAGIC.

Adding some debug output sheds more light:

test/overlay/cmd_ut_overlay.c(290) do_ut_overlay: fdt_base_copy 000000007ef33340
test/overlay/cmd_ut_overlay.c(291) do_ut_overlay: uts->priv 000000007ef33340 Running 9 overlay tests
Test: fdt_overlay_add_node_by_path test/overlay/cmd_ut_overlay.c(127) fdt_overlay_add_node_by_path:
uts->priv 0000000000000000

This is the patch that led to problem:
e93232e15ec9 ("test: overlay: Use cmd_ut_category()")

The uts created in do_ut_overlay() is not the one used in cmd_ut_category().

The easiest fix would be using a static variable for passing the fdt.

The neatest solution would be cmd_ut_category() calling an initialization function for the category so that we can use a single instance of uts for the whole test.

Quoted 7 lines
Quoted 4 lines

As this API is your design I would prefer leaving the resolution to you.

Besides resolving the error I think we should run 'ut overlay' on Travis CI for all qemu platforms.

I agree we should enable UT_OVERLAY as widely as possible in our automated testing platforms, thanks!

+1 on that!

Until creating my first unit test for this CVE series last week, I was under the impression that all the unit tests under 'test/' were run automatically...

My experience says that a unit test that is not run automatically is not worth much (as we see here).

Regards,
Simon