dm: test: Add tests for device's uclass platform data

This test introduces new test structure type:dm_test_perdev_uc_pdata.
The structure consists of three int values only. For the test purposes,
three pattern values are defined by enum, starting with TEST_UC_PDATA_INTVAL1.

This commit adds two test cases for uclass platform data:
- Test: dm_test_autobind_uclass_pdata_alloc - this tests if:
  * uclass driver sets: .per_device_platdata_auto_alloc_size field
  * the devices's: dev->uclass_platdata is non-NULL

- Test: dm_test_autobind_uclass_pdata_valid - this tests:
  * if the devices's: dev->uclass_platdata is non-NULL
  * the structure of type 'dm_test_perdev_uc_pdata' allocated at address
    pointed by dev->uclass_platdata. Each structure field, should be equal
    to proper pattern data, starting from .intval1 == TEST_UC_PDATA_INTVAL1.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Przemyslaw Marczak
2015-04-15 13:07:19 +02:00
committed by Simon Glass
parent 5eaed88028
commit 754e71e850
3 changed files with 86 additions and 0 deletions

View File

@@ -98,6 +98,26 @@ struct dm_test_parent_data {
int flag;
};
/* Test values for test device's uclass platform data */
enum {
TEST_UC_PDATA_INTVAL1 = 2,
TEST_UC_PDATA_INTVAL2 = 334,
TEST_UC_PDATA_INTVAL3 = 789452,
};
/**
* struct dm_test_uclass_platda - uclass's information on each device
*
* @intval1: set to TEST_UC_PDATA_INTVAL1 in .post_bind method of test uclass
* @intval2: set to TEST_UC_PDATA_INTVAL2 in .post_bind method of test uclass
* @intval3: set to TEST_UC_PDATA_INTVAL3 in .post_bind method of test uclass
*/
struct dm_test_perdev_uc_pdata {
int intval1;
int intval2;
int intval3;
};
/*
* Operation counts for the test driver, used to check that each method is
* called correctly