Revision ce12e797

View differences:

core/inc/aos_test.h
150 150
#if defined(__cplusplus)
151 151
extern "C" {
152 152
#endif /* defined(__cplusplus) */
153
  void aosTestResultInit(aos_testresult_t* result);
153 154
  aos_testresult_t aosTestResultAdd(aos_testresult_t a, aos_testresult_t b);
154 155
  uint32_t aosTestResultTotal(const aos_testresult_t* result);
155 156
  float aosTestResultRatio(const aos_testresult_t* result);
core/src/aos_test.c
58 58
/******************************************************************************/
59 59

  
60 60
/**
61
 * @brief   Initialize a result object.
62
 *
63
 * @param[in] result  Pointer to the object to be nitialized.
64
 */
65
inline void aosTestResultInit(aos_testresult_t* result)
66
{
67
  result->passed = 0;
68
  result->failed = 0;
69

  
70
  return;
71
}
72

  
73
/**
61 74
 * @brief   Adds two result objects.
62 75
 *
63 76
 * @param[in] a   The first summand.
test/periphery-lld/A3906_v1/aos_test_A3906.c
215 215

  
216 216

  
217 217
  // local variables
218
  aos_testresult_t result = {0, 0};
218
  aos_testresult_t result;
219 219
  int32_t status;
220 220
  a3906_lld_power_t power_state;
221 221
  apalQEICount_t qei_count[2][2];
222 222
  uint32_t timeout_counter;
223 223
  uint32_t stable_counter;
224 224

  
225
  aosTestResultInit(&result);
226

  
225 227
  chprintf(stream, "enable power...\n");
226 228
  power_state = A3906_LLD_POWER_ON;
227 229
  status = a3906_lld_set_power(((aos_test_a3906data_t*)test->data)->driver, power_state);
test/periphery-lld/AT24C01B_v1/aos_test_AT24C01B.c
83 83
  aosDbgCheck(test->data != NULL && ((aos_test_at24c01bdata_t*)(test->data))->driver != NULL);
84 84

  
85 85
  // local variables
86
  aos_testresult_t result = {0, 0};
86
  aos_testresult_t result;
87 87
  int32_t status;
88 88
  uint8_t page_data[AT24C01B_LLD_PAGE_SIZE_BYTES];
89 89
  uint8_t original_data[AT24C01B_LLD_PAGE_SIZE_BYTES];
90 90
  uint8_t read_data[AT24C01B_LLD_PAGE_SIZE_BYTES];
91 91
  size_t errors = 0;
92

  
93
  aosTestResultInit(&result);
92 94
  for (size_t dataIdx = 0; dataIdx < AT24C01B_LLD_PAGE_SIZE_BYTES; ++dataIdx) {
93 95
    page_data[dataIdx] = dataIdx;
94 96
  }
test/periphery-lld/AT42QT1050_v1/aos_test_AT42QT1050.c
191 191
    aosDbgCheck(test->data != NULL && ((aos_test_at42qt1050data_t*)test->data)->at42qt1050d != NULL);
192 192

  
193 193
    // local variables
194
    aos_testresult_t result = {0, 0};
194
    aos_testresult_t result;
195 195
    int32_t status;
196 196
    uint8_t test_8;
197 197
    bool error;
198 198

  
199
    aosTestResultInit(&result);
200

  
199 201
    chprintf(stream, "read register...\n");
200 202
    error = false;
201 203
    status = at42qt1050_lld_read_reg(((aos_test_at42qt1050data_t*)test->data)->at42qt1050d, AT42QT1050_LLD_REG_CHIPID, &test_8, ((aos_test_at42qt1050data_t*)test->data)->timeout);
test/periphery-lld/DW1000_v1/aos_test_DW1000.c
198 198
      ((aos_test_dw1000data_t*)test->data)->driver != NULL &&
199 199
      ((aos_test_dw1000data_t*)test->data)->evtsource != NULL);
200 200

  
201
  aos_testresult_t result = {0, 0};  
201
  // local variables
202
  aos_testresult_t result;
202 203

  
204
  aosTestResultInit(&result);
203 205

  
204 206
#if (BOARD_MIC9404x_CONNECTED == true)
205 207
  // Enable 3.3V and 1.8V supply voltages for powering up the DW1000 module in AMiRo Light Ring
test/periphery-lld/HMC5883L_v1/aos_test_HMC5883L.c
58 58
  aosDbgCheck(test->data != NULL && (((aos_test_hmc5883ldata_t*)(test->data))->drdyEvtSrc != NULL));
59 59

  
60 60
  // local variables
61
  aos_testresult_t result = {0, 0};
61
  aos_testresult_t result;
62 62
  int32_t status;
63 63
  uint8_t rxbuffer[3];
64 64
  uint8_t data;
......
72 72
  aos_timestamp_t start;
73 73
  aos_timestamp_t t;
74 74

  
75
  aosTestResultInit(&result);
76

  
75 77
  chprintf(stream, "check ID...\n");
76 78
  status = hmc5883l_lld_check(((aos_test_hmc5883ldata_t*)test->data)->driver, rxbuffer, 3, ((aos_test_hmc5883ldata_t*)test->data)->timeout);
77 79
  if (status == APAL_STATUS_SUCCESS && rxbuffer[0] == HMC5883L_LLD_IDENTIFICATION_A
test/periphery-lld/INA219_v1/aos_test_INA219.c
52 52
  aosDbgCheck(test->data != NULL && ((aos_test_ina219data_t*)(test->data))->inad != NULL);
53 53

  
54 54
  // local variables
55
  aos_testresult_t result = {0, 0};
55
  aos_testresult_t result;
56 56
  int32_t status;
57 57
  uint16_t data[6];
58 58
  uint16_t write_data = 0x1011;
......
65 65
  int32_t shunt;
66 66
  uint32_t bus;
67 67

  
68
  aosTestResultInit(&result);
69

  
68 70
  chprintf(stream, "read registers...\n");
69 71
  status = ina219_lld_read_register(((aos_test_ina219data_t*)test->data)->inad, INA219_LLD_REGISTER_CONFIGURATION, data, 6, ((aos_test_ina219data_t*)test->data)->timeout);
70 72
  if (status == APAL_STATUS_SUCCESS) {
test/periphery-lld/L3G4200D_v1/aos_test_L3G4200D.c
58 58
  aosDbgCheck(test->data != NULL && ((aos_test_l3g4200ddata_t*)(test->data)) != NULL);
59 59

  
60 60
  // local variables
61
  aos_testresult_t result = {0, 0};
61
  aos_testresult_t result;
62 62
  int32_t status;
63 63
  uint8_t data = 0;
64 64
  uint8_t write_data[5];
......
70 70
  uint8_t fifo = 0x5F;
71 71
  event_listener_t el;
72 72

  
73
  aosTestResultInit(&result);
73 74
  for (uint8_t dataIdx = 0; dataIdx < 4; dataIdx++) {
74 75
    write_data[dataIdx] = (dataIdx+1)*11;
75 76
  }
test/periphery-lld/LED_v1/aos_test_LED.c
58 58
  aosDbgCheck(test->data != NULL && ((aos_test_leddata_t*)test->data)->led != NULL);
59 59

  
60 60
  // local variables
61
  aos_testresult_t result = {0, 0};
61
  aos_testresult_t result;
62 62
  int32_t status;
63 63

  
64
  aosTestResultInit(&result);
65

  
64 66
  chprintf(stream, "lighting up for two seconds...\n");
65 67
  led_lld_state_t state = LED_LLD_STATE_ON;
66 68
  status = led_lld_set(((aos_test_leddata_t*)test->data)->led, state);
test/periphery-lld/LIS331DLH_v1/aos_test_LIS331DLH.c
58 58
  aosDbgCheck(test->data != NULL && ((aos_test_lis331dlhdata_t*)(test->data)) != NULL);
59 59

  
60 60
  // local variables
61
  aos_testresult_t result = {0, 0};
61
  aos_testresult_t result;
62 62
  int32_t status;
63 63
  uint8_t data = 0;
64 64
  uint8_t write_data[5];
......
72 72
  eventmask_t event_mask;
73 73
  uint8_t success = 0;
74 74

  
75
  aosTestResultInit(&result);
75 76
  for (uint8_t dataIdx = 0; dataIdx < 4; dataIdx++) {
76 77
    write_data[dataIdx] = (dataIdx+1)*11;
77 78
  }
test/periphery-lld/LTC4412_v1/aos_test_LTC4412.c
50 50
  aosDbgCheck(test->data != NULL && ((aos_test_ltc4412data_t*)test->data)->driver != NULL);
51 51

  
52 52
  // local variables
53
  aos_testresult_t result = {0,0};
53
  aos_testresult_t result;
54 54
  int32_t status;
55 55

  
56
  aosTestResultInit(&result);
57

  
56 58
  chprintf(stream, "read ctrl pin...\n");
57 59
  ltc4412_lld_ctrl_t ctrl;
58 60
  status = ltc4412_lld_get_ctrl(((aos_test_ltc4412data_t*)test->data)->driver, &ctrl);
test/periphery-lld/MIC9404x_v1/aos_test_MIC9404x.c
60 60
  // local variables
61 61
  mic9404x_lld_state_t state_orig;
62 62
  mic9404x_lld_state_t state;
63
  aos_testresult_t result = {0, 0};
63
  aos_testresult_t result;
64 64
  int32_t status;
65 65

  
66
  aosTestResultInit(&result);
67

  
66 68
  chprintf(stream, "reading current status...\n");
67 69
  status = mic9404x_lld_get(((aos_test_mic9404data_t*)test->data)->driver, &state_orig);
68 70
  if (status == APAL_STATUS_OK) {
test/periphery-lld/MPR121_v1/aos_test_MPR121.c
52 52
  aosDbgCheck(test->data != NULL && ((aos_test_mpr121data_t*)test->data)->mprd != NULL);
53 53

  
54 54
  // local variables
55
  aos_testresult_t result = {0, 0};
55
  aos_testresult_t result;
56 56
  int32_t status;
57 57
  mpr121_lld_config_t cfg;
58 58
  uint8_t data = 0;
......
63 63
  event_listener_t event_listener;
64 64
  aos_timestamp_t tstart, tcurrent, tend;
65 65

  
66
  aosTestResultInit(&result);
67

  
66 68
  chprintf(stream, "soft reset...\n");
67 69
  status = mpr121_lld_soft_reset(((aos_test_mpr121data_t*)test->data)->mprd, ((aos_test_mpr121data_t*)test->data)->timeout);
68 70
  status |= mpr121_lld_read_config(((aos_test_mpr121data_t*)test->data)->mprd, &cfg, ((aos_test_mpr121data_t*)test->data)->timeout);
test/periphery-lld/MPU6050_v1/aos_test_MPU6050.c
47 47

  
48 48
aos_testresult_t aosTestMpu6050Func(BaseSequentialStream* stream, const aos_test_t* test)
49 49
{
50
    aos_testresult_t result = {0, 0};
50
    aos_testresult_t result;
51 51

  
52 52
    uint8_t data[1] = {0};
53 53
    int32_t status;
54 54

  
55
  aosTestResultInit(&result);
56

  
55 57
    status = mpu6050_lld_read_register(((aos_test_mpu6050data_t*)test->data)->mpu, MPU6050_LLD_WHO_AM_I, data, 1, ((aos_test_mpu6050data_t*)test->data)->timeout);
56 58
    if (status == APAL_STATUS_OK && data[0] == MPU6050_I_AM) {
57 59
      aosTestPassed(stream, &result);
test/periphery-lld/PCA9544A_v1/aos_test_PCA9544A.c
50 50
  aosDbgCheck(test->data != NULL && ((aos_test_pca9544adata_t*)test->data)->driver != NULL);
51 51

  
52 52
  // local variables
53
  aos_testresult_t result = {0,0};
53
  aos_testresult_t result;
54 54
  int32_t status;
55 55
  uint8_t ctrlreg;
56 56
  pca9544a_lld_intstatus_t interrupt;
57 57
  pca9544a_lld_chid_t channel;
58 58
  uint8_t test_mask = 0x00u;
59 59

  
60
  aosTestResultInit(&result);
61

  
60 62
  chprintf(stream, "reading control register...\n");
61 63
  status = pca9544a_lld_read(((aos_test_pca9544adata_t*)test->data)->driver, &ctrlreg, ((aos_test_pca9544adata_t*)test->data)->timeout);
62 64
  if (status == APAL_STATUS_OK || status == APAL_STATUS_WARNING) {
test/periphery-lld/PCAL6524_v1/aos_test_PCAL6524.c
52 52
  aosDbgCheck((test->data != NULL) && (((aos_test_pcal6524data_t*)test->data)->pcal6524d != NULL));
53 53

  
54 54
  // local variables
55
  aos_testresult_t result = {0, 0};
55
  aos_testresult_t result;
56 56
  int32_t status;
57 57
  uint8_t buffer[24];
58 58
  memset(buffer, 0xAA, sizeof(buffer));
59 59

  
60
  aosTestResultInit(&result);
61

  
60 62
// This test is currently not supported. See PCAL6524 driver implementation for further information.
61 63
//  chprintf(stream, "reading device ID...\n");
62 64
//  status = pcal6524_lld_read_id(((aos_test_pcal6524data_t*)test->data)->pcal6524d, buffer, ((aos_test_pcal6524data_t*)test->data)->timeout);
test/periphery-lld/PKxxxExxx_v1/aos_test_PKxxxExxx.c
50 50
  aosDbgCheck(test->data != NULL && ((aos_test_pkxxxexxxdata_t*)test->data)->driver != NULL);
51 51

  
52 52
  // local variables
53
  aos_testresult_t result = {0, 0};
53
  aos_testresult_t result;
54 54
  int32_t status;
55 55

  
56
  aosTestResultInit(&result);
57

  
56 58
  chprintf(stream, "checking PWM configuration...\n");
57 59
  status = pkxxxexxx_lld_checkPWMconfiguration(((aos_test_pkxxxexxxdata_t*)test->data)->driver);
58 60
  if (status == APAL_STATUS_OK) {
test/periphery-lld/TLC5947_v1/aos_test_TLC5947.c
60 60
  aosDbgCheck(test->data != NULL && ((aos_test_tlc5947data_t*)test->data)->driver != NULL);
61 61

  
62 62
  // local variables
63
  aos_testresult_t result = {0, 0};
63
  aos_testresult_t result;
64 64
  int32_t status;
65 65
  tlc5947_lld_blank_t blank;
66 66
  tlc5947_lld_buffer_t buffer;
67 67

  
68
  aosTestResultInit(&result);
69

  
68 70
  chprintf(stream, "reading blank pin...\n");
69 71
  status = tlc5947_lld_getBlank(((aos_test_tlc5947data_t*)test->data)->driver, &blank);
70 72
  if (status == APAL_STATUS_OK) {
test/periphery-lld/TPS20xxB_v1/aos_test_TPS20xxB.c
58 58
  aosDbgCheck(test->data != NULL && ((aos_test_tps20xxbdata_t*)test->data)->driver != NULL);
59 59

  
60 60
  // local variables
61
  aos_testresult_t result = {0, 0};
61
  aos_testresult_t result;
62 62
  int32_t status;
63 63
  tps20xxb_lld_enable_t en;
64 64
  tps20xxb_lld_overcurrent_t oc;
65 65

  
66
  aosTestResultInit(&result);
67

  
66 68
  chprintf(stream, "write laser enable...\n");
67 69
  status = tps20xxb_lld_set_enable(((aos_test_tps20xxbdata_t*)test->data)->driver, TPS20xxB_LLD_ENABLE);
68 70
  if (status == APAL_STATUS_SUCCESS) {
test/periphery-lld/TPS6211x_v1/aos_test_TPS6211x.c
50 50
  aosDbgCheck(test->data != NULL && ((aos_test_tps6211xbdata_t*)test->data)->driver != NULL);
51 51

  
52 52
  // local variables
53
  aos_testresult_t result = {0,0};
53
  aos_testresult_t result;
54 54
  int32_t status;
55 55
  tps6211x_lld_power_en_t power;
56 56

  
57
  aosTestResultInit(&result);
58

  
57 59
  chprintf(stream, "read pin...\n");
58 60
  status = tps6211x_lld_get_power_en(((aos_test_tps6211xbdata_t*)test->data)->driver, &power);
59 61
  if(status == APAL_STATUS_SUCCESS){
test/periphery-lld/TPS6211x_v1_INA219_v1/aos_test_TPS6211x_INA219.c
50 50
  aosDbgCheck(test->data != NULL && ((aos_test_tps6211xina219data_t*)test->data)->tps6211x != NULL && ((aos_test_tps6211xina219data_t*)test->data)->ina219 != NULL);
51 51

  
52 52
  // local variables
53
  aos_testresult_t result = {0, 0};
53
  aos_testresult_t result;
54 54
  int32_t status;
55 55
  tps6211x_lld_power_en_t power;
56 56
  uint32_t v_buson, v_busoff;
57 57

  
58
  aosTestResultInit(&result);
59

  
58 60
  chprintf(stream, "read pin...\n");
59 61
  status = tps6211x_lld_get_power_en(((aos_test_tps6211xina219data_t*)test->data)->tps6211x, &power);
60 62
  aosThdSSleep(1);
test/periphery-lld/VCNL4020_v1/aos_test_VCNL4020.c
56 56
              (((aos_test_vcnl4020data_t*)(test->data))->evtsource != NULL));
57 57

  
58 58
  // local variables
59
  aos_testresult_t result = {0, 0};
59
  aos_testresult_t result;
60 60
  int32_t status;
61 61
  uint8_t reg_buf[4] = {0};
62 62
  uint8_t* reg_8 = (uint8_t*)(reg_buf);
......
64 64
  event_listener_t event_listener;
65 65
  aos_timestamp_t tcurrent, tend;
66 66

  
67
  aosTestResultInit(&result);
68

  
67 69
  chprintf(stream, "reading register...\n");
68 70
  status = vcnl4020_lld_readreg(((aos_test_vcnl4020data_t*)(test->data))->vcnld, VCNL4020_LLD_REGADDR_IDREV, &reg_8[0], ((aos_test_vcnl4020data_t*)(test->data))->timeout);
69 71
  if ((status == APAL_STATUS_OK || status == APAL_STATUS_WARNING) && reg_8[0] == 0x21u) {
test/periphery-lld/bq241xx_v1/aos_test_bq241xx.c
51 51
  aosDbgCheck(test->data != NULL);
52 52

  
53 53
  // local variables
54
  aos_testresult_t result = {0, 0};
54
  aos_testresult_t result;
55 55
  int32_t status;
56 56
  bq241xx_lld_enable_t en[3];
57 57
  bq241xx_lld_charge_state_t charge;
58 58

  
59
  aosTestResultInit(&result);
60

  
59 61
  chprintf(stream, "read enable pin...\n");
60 62
  status = bq241xx_lld_get_enabled(((aos_test_bq241xxdata_t*)test->data)->driver, &en[0]);
61 63
  chprintf(stream, "\t\tcurrently %s\n", (en[0] == BQ241xx_LLD_ENABLED) ? "enabled" : "disabled");
test/periphery-lld/bq27500_v1/aos_test_bq27500.c
280 280
  aosDbgCheck(test->data != NULL && ((aos_test_bq27500data_t*)(test->data))->driver != NULL);
281 281

  
282 282
  // local variables
283
  aos_testresult_t result = {0, 0};
283
  aos_testresult_t result;
284 284
  int32_t status;
285 285
  bq27500_lld_batlow_t bl;
286 286
  bq27500_lld_batgood_t bg;
......
298 298
  bool success;
299 299
  bool success2;
300 300

  
301
  aosTestResultInit(&result);
302

  
301 303
  chprintf(stream, "read battery low gpio...\n");
302 304
  status = bq27500_lld_read_batlow(((aos_test_bq27500data_t*)test->data)->driver, &bl);
303 305
  chprintf(stream, "\t\tbattery low: 0x%X\n", bl);
test/periphery-lld/bq27500_v1_bq241xx_v1/aos_test_bq27500_bq241xx.c
51 51
  aosDbgCheck(test->data != NULL && ((aos_test_bq27500bq241xxdata_t*)test->data)->bq27500 != NULL && ((aos_test_bq27500bq241xxdata_t*)test->data)->bq241xx != NULL);
52 52

  
53 53
  // local variables
54
  aos_testresult_t result = {0, 0};
54
  aos_testresult_t result;
55 55
  int32_t status;
56 56
  uint16_t dst;
57 57
  bq27500_lld_flags_t flags;
......
60 60
  uint32_t sleeptime_s;
61 61
  bq241xx_lld_charge_state_t charge;
62 62

  
63
  aosTestResultInit(&result);
64

  
63 65
  chprintf(stream, "check for battery...\n");
64 66
  status = bq27500_lld_std_command(((aos_test_bq27500bq241xxdata_t*)test->data)->bq27500, BQ27500_LLD_STD_CMD_Flags, &dst, ((aos_test_bq27500bq241xxdata_t*)test->data)->timeout);
65 67
  flags.value = dst;
test/periphery-lld/button_v1/aos_test_button.c
62 62
      ((aos_test_buttondata_t*)test->data)->evtsource != NULL);
63 63

  
64 64
  // local variables
65
  aos_testresult_t result = {0, 0};
65
  aos_testresult_t result;
66 66
  int32_t status;
67 67
  unsigned int count = 0;
68 68
  button_lld_state_t bstate;
69 69
  event_listener_t evtlistener;
70 70
  aos_timestamp_t tcurrent, tend;
71 71

  
72
  aosTestResultInit(&result);
73

  
72 74
  chprintf(stream, "test interrupts for ten seconds...\n");
73 75
  chEvtRegister(((aos_test_buttondata_t*)test->data)->evtsource, &evtlistener, INTERRUPT_EVENT_ID);
74 76
  status = APAL_STATUS_OK;

Also available in: Unified diff