summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-15 17:25:21 +1300
committerSimon Glass <sjg@chromium.org>2021-03-26 17:03:08 +1300
commite8c023c3f95622dace696be2f671a5eb01572c07 (patch)
tree9477dbc7368af48ef7b6d251b9d7dd3ef1c99b90 /test
parent910de1092f6e2febf5b9066f7ce437dc2303c1e0 (diff)
downloadu-boot-e8c023c3f95622dace696be2f671a5eb01572c07.tar.gz
u-boot-e8c023c3f95622dace696be2f671a5eb01572c07.tar.xz
u-boot-e8c023c3f95622dace696be2f671a5eb01572c07.zip
dm: test: Avoid destroying uclasses with of-platdata-inst
It is not possible to destroy the uclasses when they are created at build time. Skip this step so that SPL test can complete successfully. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/test-main.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/test/test-main.c b/test/test-main.c
index e1b49e091a..46a0c2ee2f 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -62,17 +62,25 @@ static int dm_test_post_run(struct unit_test_state *uts)
{
int id;
- for (id = 0; id < UCLASS_COUNT; id++) {
- struct uclass *uc;
-
- /*
- * If the uclass doesn't exist we don't want to create it. So
- * check that here before we call uclass_find_device().
- */
- uc = uclass_find(id);
- if (!uc)
- continue;
- ut_assertok(uclass_destroy(uc));
+ /*
+ * With of-platdata-inst the uclasses are created at build time. If we
+ * destroy them we cannot get them back since uclass_add() is not
+ * supported. So skip this.
+ */
+ if (!CONFIG_IS_ENABLED(OF_PLATDATA_INST)) {
+ for (id = 0; id < UCLASS_COUNT; id++) {
+ struct uclass *uc;
+
+ /*
+ * If the uclass doesn't exist we don't want to create
+ * it. So check that here before we call
+ * uclass_find_device().
+ */
+ uc = uclass_find(id);
+ if (!uc)
+ continue;
+ ut_assertok(uclass_destroy(uc));
+ }
}
return 0;