|
33 | 33 | #error [NOT_SUPPORTED] USB Device not supported for this target
|
34 | 34 | #endif
|
35 | 35 |
|
| 36 | + |
| 37 | +#define OS_WINDOWS 1 |
| 38 | +#define OS_LINUX 2 |
| 39 | +#define OS_MAC 3 |
| 40 | + |
| 41 | +// Host side unmount was disabled for windows machines. |
| 42 | +// PowerShell execution policies/restrictions cause that |
| 43 | +// on some windows machines unmount is failing |
| 44 | +// To re-enable it comment out below line. |
| 45 | +#define DISABLE_HOST_SIDE_UMOUNT |
| 46 | + |
36 | 47 | #ifdef MIN
|
37 | 48 | #undef MIN
|
38 | 49 | #endif
|
@@ -313,19 +324,30 @@ void mount_unmount_test(BlockDevice *bd, FileSystem *fs)
|
313 | 324 | uint64_t ret_size = atoll(_key);
|
314 | 325 | TEST_ASSERT_EQUAL_UINT64(get_fs_mount_size(fs), ret_size);
|
315 | 326 |
|
316 |
| - // unmount msd device on host side |
317 |
| - greentea_send_kv("unmount", 0); |
| 327 | +#ifdef DISABLE_HOST_SIDE_UMOUNT |
| 328 | + greentea_send_kv("get_os_type", 0); |
318 | 329 | greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
|
319 |
| - TEST_ASSERT_EQUAL_STRING_LOOP("passed", _key, i); |
320 |
| - |
321 |
| - // wait for unmount event (set 10s timeout) |
322 |
| - media_remove_event.wait(10000); |
323 |
| - if (!usb.media_removed()) { |
324 |
| - TEST_ASSERT_EQUAL_LOOP(true, usb.media_removed(), i); |
| 330 | + int32_t os_type = atoi(_key); |
| 331 | + if (os_type != OS_WINDOWS) { |
| 332 | +#endif |
| 333 | + // unmount msd device on host side |
| 334 | + greentea_send_kv("unmount", 0); |
| 335 | + greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value)); |
| 336 | + TEST_ASSERT_EQUAL_STRING_LOOP("passed", _key, i); |
| 337 | + |
| 338 | + // wait for unmount event (set 10s timeout) |
| 339 | + media_remove_event.wait(10000); |
| 340 | + if (!usb.media_removed()) { |
| 341 | + TEST_ASSERT_EQUAL_LOOP(true, usb.media_removed(), i); |
| 342 | + } |
| 343 | +#ifdef DISABLE_HOST_SIDE_UMOUNT |
| 344 | + // unmount since media_removed doesn't disconnects device side |
| 345 | + usb.disconnect(); |
325 | 346 | }
|
326 |
| - // unmount since media_removed doesn't disconnects device side |
| 347 | +#else |
| 348 | + // unmount |
327 | 349 | usb.disconnect();
|
328 |
| - |
| 350 | +#endif |
329 | 351 | // check if device is detached on host side
|
330 | 352 | greentea_send_kv("check_if_not_mounted", 0);
|
331 | 353 | greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
|
|
0 commit comments