[PATCH v2 02/44] test: Rename test_get_state() to ut_get_state()

Simon Glass sjg at chromium.org
Mon Jan 20 22:25:24 CET 2025


Rename this function and test_set_state() so use the same ut_ prefix as
other functions in ut.h

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 include/test/ut.h     |  8 ++++----
 test/dm/test-driver.c | 10 +++++-----
 test/dm/test-uclass.c |  8 ++++----
 test/test-main.c      |  8 ++++----
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/test/ut.h b/include/test/ut.h
index c8838dad096..2e4d8edf826 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -466,18 +466,18 @@ void ut_unsilence_console(struct unit_test_state *uts);
 void ut_set_skip_delays(struct unit_test_state *uts, bool skip_delays);
 
 /**
- * test_get_state() - Get the active test state
+ * ut_state_get() - Get the active test state
  *
  * Return: the currently active test state, or NULL if none
  */
-struct unit_test_state *test_get_state(void);
+struct unit_test_state *ut_get_state(void);
 
 /**
- * test_set_state() - Set the active test state
+ * ut_set_state() - Set the active test state
  *
  * @uts: Test state to use as currently active test state, or NULL if none
  */
-void test_set_state(struct unit_test_state *uts);
+void ut_set_state(struct unit_test_state *uts);
 
 /**
  * ut_run_tests() - Run a set of tests
diff --git a/test/dm/test-driver.c b/test/dm/test-driver.c
index 851177c3018..759de3a5f77 100644
--- a/test/dm/test-driver.c
+++ b/test/dm/test-driver.c
@@ -35,7 +35,7 @@ static const struct test_ops test_ops = {
 
 static int test_bind(struct udevice *dev)
 {
-	struct unit_test_state *uts = test_get_state();
+	struct unit_test_state *uts = ut_get_state();
 
 	/* Private data should not be allocated */
 	ut_assert(!dev_get_priv(dev));
@@ -46,7 +46,7 @@ static int test_bind(struct udevice *dev)
 
 static int test_probe(struct udevice *dev)
 {
-	struct unit_test_state *uts = test_get_state();
+	struct unit_test_state *uts = ut_get_state();
 	struct dm_test_priv *priv = dev_get_priv(dev);
 
 	/* Private data should be allocated */
@@ -59,7 +59,7 @@ static int test_probe(struct udevice *dev)
 
 static int test_remove(struct udevice *dev)
 {
-	struct unit_test_state *uts = test_get_state();
+	struct unit_test_state *uts = ut_get_state();
 
 	/* Private data should still be allocated */
 	ut_assert(dev_get_priv(dev));
@@ -70,7 +70,7 @@ static int test_remove(struct udevice *dev)
 
 static int test_unbind(struct udevice *dev)
 {
-	struct unit_test_state *uts = test_get_state();
+	struct unit_test_state *uts = ut_get_state();
 
 	/* Private data should not be allocated */
 	ut_assert(!dev_get_priv(dev));
@@ -121,7 +121,7 @@ static int test_manual_bind(struct udevice *dev)
 
 static int test_manual_probe(struct udevice *dev)
 {
-	struct unit_test_state *uts = test_get_state();
+	struct unit_test_state *uts = ut_get_state();
 
 	dm_testdrv_op_count[DM_TEST_OP_PROBE]++;
 	if (!uts->force_fail_alloc)
diff --git a/test/dm/test-uclass.c b/test/dm/test-uclass.c
index 9a80cc63667..be4108bbecb 100644
--- a/test/dm/test-uclass.c
+++ b/test/dm/test-uclass.c
@@ -28,7 +28,7 @@ int test_ping(struct udevice *dev, int pingval, int *pingret)
 
 static int test_post_bind(struct udevice *dev)
 {
-	struct unit_test_state *uts = test_get_state();
+	struct unit_test_state *uts = ut_get_state();
 	struct dm_test_perdev_uc_pdata *uc_pdata;
 
 	dm_testdrv_op_count[DM_TEST_OP_POST_BIND]++;
@@ -54,7 +54,7 @@ static int test_pre_unbind(struct udevice *dev)
 static int test_pre_probe(struct udevice *dev)
 {
 	struct dm_test_uclass_perdev_priv *priv = dev_get_uclass_priv(dev);
-	struct unit_test_state *uts = test_get_state();
+	struct unit_test_state *uts = ut_get_state();
 
 	dm_testdrv_op_count[DM_TEST_OP_PRE_PROBE]++;
 	ut_assert(priv);
@@ -65,7 +65,7 @@ static int test_pre_probe(struct udevice *dev)
 
 static int test_post_probe(struct udevice *dev)
 {
-	struct unit_test_state *uts = test_get_state();
+	struct unit_test_state *uts = ut_get_state();
 	struct udevice *prev = list_entry(dev->uclass_node.prev,
 					    struct udevice, uclass_node);
 
@@ -100,7 +100,7 @@ static int test_pre_remove(struct udevice *dev)
 
 static int test_init(struct uclass *uc)
 {
-	struct unit_test_state *uts = test_get_state();
+	struct unit_test_state *uts = ut_get_state();
 
 	dm_testdrv_op_count[DM_TEST_OP_INIT]++;
 	ut_assert(uclass_get_priv(uc));
diff --git a/test/test-main.c b/test/test-main.c
index 8d764892fa6..cfb3504941d 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -63,12 +63,12 @@ static enum fdtchk_t fdt_action(void)
 /* This is valid when a test is running, NULL otherwise */
 static struct unit_test_state *cur_test_state;
 
-struct unit_test_state *test_get_state(void)
+struct unit_test_state *ut_get_state(void)
 {
 	return cur_test_state;
 }
 
-void test_set_state(struct unit_test_state *uts)
+void ut_set_state(struct unit_test_state *uts)
 {
 	cur_test_state = uts;
 }
@@ -466,7 +466,7 @@ static int ut_run_test(struct unit_test_state *uts, struct unit_test *test,
 	printf("Test: %s: %s%s\n", test_name, fname, note);
 
 	/* Allow access to test state from drivers */
-	test_set_state(uts);
+	ut_set_state(uts);
 
 	ret = test_pre_run(uts, test);
 	if (ret == -EAGAIN)
@@ -482,7 +482,7 @@ static int ut_run_test(struct unit_test_state *uts, struct unit_test *test,
 	if (ret)
 		return ret;
 
-	test_set_state( NULL);
+	ut_set_state(NULL);
 
 	return 0;
 }
-- 
2.43.0



More information about the U-Boot mailing list