Changeset b252e87 in mainline for uspace/lib/ddev/test/ddev.c
- Timestamp:
- 2020-02-11T11:17:22Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e1f2079
- Parents:
- b43edabe
- git-author:
- Jiri Svoboda <jiri@…> (2020-02-10 20:17:06)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-02-11 11:17:22)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ddev/test/ddev.c
rb43edabe rb252e87 49 49 50 50 static errno_t test_get_gc(void *, sysarg_t *, sysarg_t *); 51 static errno_t test_get_info(void *, ddev_info_t *); 51 52 static errno_t test_gc_set_color(void *, gfx_color_t *); 52 53 53 54 static ddev_ops_t test_ddev_ops = { 54 .get_gc = test_get_gc 55 .get_gc = test_get_gc, 56 .get_info = test_get_info 55 57 }; 56 58 … … 66 68 bool set_color_called; 67 69 ddev_srv_t *srv; 70 ddev_info_t info; 68 71 } test_response_t; 69 72 … … 172 175 } 173 176 177 /** ddev_get_info with server returning failure */ 178 PCUT_TEST(dev_get_info_failure) 179 { 180 errno_t rc; 181 service_id_t sid; 182 ddev_t *ddev = NULL; 183 test_response_t resp; 184 ddev_info_t info; 185 186 async_set_fallback_port_handler(test_ddev_conn, &resp); 187 188 // FIXME This causes this test to be non-reentrant! 189 rc = loc_server_register(test_ddev_server); 190 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 191 192 rc = loc_service_register(test_ddev_svc, &sid); 193 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 194 195 rc = ddev_open(test_ddev_svc, &ddev); 196 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 197 PCUT_ASSERT_NOT_NULL(ddev); 198 199 resp.rc = ENOMEM; 200 rc = ddev_get_info(ddev, &info); 201 PCUT_ASSERT_ERRNO_VAL(resp.rc, rc); 202 203 ddev_close(ddev); 204 rc = loc_service_unregister(sid); 205 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 206 } 207 208 /** ddev_get_info with server returning success */ 209 PCUT_TEST(dev_get_info_success) 210 { 211 errno_t rc; 212 service_id_t sid; 213 ddev_t *ddev = NULL; 214 test_response_t resp; 215 ddev_info_t info; 216 217 async_set_fallback_port_handler(test_ddev_conn, &resp); 218 219 // FIXME This causes this test to be non-reentrant! 220 rc = loc_server_register(test_ddev_server); 221 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 222 223 rc = loc_service_register(test_ddev_svc, &sid); 224 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 225 226 rc = ddev_open(test_ddev_svc, &ddev); 227 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 228 PCUT_ASSERT_NOT_NULL(ddev); 229 230 resp.rc = EOK; 231 232 ddev_info_init(&resp.info); 233 resp.info.rect.p0.x = 1; 234 resp.info.rect.p0.y = 2; 235 resp.info.rect.p1.x = 3; 236 resp.info.rect.p1.y = 4; 237 238 rc = ddev_get_info(ddev, &info); 239 PCUT_ASSERT_ERRNO_VAL(resp.rc, rc); 240 241 PCUT_ASSERT_INT_EQUALS(resp.info.rect.p0.x, info.rect.p0.x); 242 PCUT_ASSERT_INT_EQUALS(resp.info.rect.p0.y, info.rect.p0.y); 243 PCUT_ASSERT_INT_EQUALS(resp.info.rect.p1.x, info.rect.p1.x); 244 PCUT_ASSERT_INT_EQUALS(resp.info.rect.p1.y, info.rect.p1.y); 245 246 ddev_close(ddev); 247 rc = loc_service_unregister(sid); 248 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 249 } 250 174 251 /** Test display device connection. 175 252 * … … 222 299 } 223 300 301 static errno_t test_get_info(void *arg, ddev_info_t *info) 302 { 303 test_response_t *resp = (test_response_t *) arg; 304 305 if (resp->rc != EOK) 306 return resp->rc; 307 308 *info = resp->info; 309 return EOK; 310 } 311 224 312 static errno_t test_gc_set_color(void *arg, gfx_color_t *color) 225 313 {
Note:
See TracChangeset
for help on using the changeset viewer.