From: Simon Goldschmidt Date: Mon, 10 Dec 2018 22:02:13 +0100 Subject: [U-Boot] [BUG] ut overlay fails with v2018.03 and later on qemu-arm64_defconfig In-Reply-To: <20181210204303.GA8702@bill-the-cat> References: <09c4d009-e4ae-9ab2-4ee8-d58fa0f6814a@gmx.de> <20181210204303.GA8702@bill-the-cat> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Am 10.12.2018 um 21:43 schrieb Tom Rini: > On Sat, Dec 08, 2018 at 09:35:06AM +0100, Heinrich Schuchardt wrote: >> 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. > > 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