Revise loopback device handling to be parallelization safe.

Update engine tests were allocating loopback devices in a non-atomic fashion.
When they were run in parallel with other tests that were using loopback
devices, this could lead to two tests using the same device and failing.

This change follows jrbarnette's advice and allocates loopback devices
atomically using "losetup --show -f <file to bind>".

NOTE: integration_unittest.cc is not currently being built or run, and
so the change here has not been verified. I only discovered it wasn't being
built while making this change, and fixing/deleting it seemed out of scope
for the change.

BUG=chromium-os:24975
TEST=Ran unittests

Change-Id: Ica060c8add009cac134e22b46b4e87588d0246e0
Reviewed-on: https://gerrit.chromium.org/gerrit/15128
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Don Garrett <dgarrett@chromium.org>
5 files changed
tree: 1604e80570aa9d37026ccb484b42279c57928c18
  1. .gitignore
  2. action.h
  3. action_mock.h
  4. action_pipe.h
  5. action_pipe_unittest.cc
  6. action_processor.cc
  7. action_processor.h
  8. action_processor_mock.h
  9. action_processor_unittest.cc
  10. action_unittest.cc
  11. bzip.cc
  12. bzip.h
  13. bzip_extent_writer.cc
  14. bzip_extent_writer.h
  15. bzip_extent_writer_unittest.cc
  16. certificate_checker.cc
  17. certificate_checker.h
  18. certificate_checker_mock.h
  19. certificate_checker_unittest.cc
  20. chrome_browser_proxy_resolver.cc
  21. chrome_browser_proxy_resolver.h
  22. chrome_browser_proxy_resolver_unittest.cc
  23. chrome_proxy_resolver.cc
  24. chrome_proxy_resolver.h
  25. chrome_proxy_resolver_unittest.cc
  26. cycle_breaker.cc
  27. cycle_breaker.h
  28. cycle_breaker_unittest.cc
  29. dbus_constants.h
  30. dbus_interface.h
  31. dbus_service.cc
  32. dbus_service.h
  33. delta_diff_generator.cc
  34. delta_diff_generator.h
  35. delta_diff_generator_unittest.cc
  36. delta_performer.cc
  37. delta_performer.h
  38. delta_performer_unittest.cc
  39. download_action.cc
  40. download_action.h
  41. download_action_unittest.cc
  42. extent_mapper.cc
  43. extent_mapper.h
  44. extent_mapper_unittest.cc
  45. extent_ranges.cc
  46. extent_ranges.h
  47. extent_ranges_unittest.cc
  48. extent_writer.cc
  49. extent_writer.h
  50. extent_writer_unittest.cc
  51. file_writer.cc
  52. file_writer.h
  53. file_writer_mock.h
  54. file_writer_unittest.cc
  55. filesystem_copier_action.cc
  56. filesystem_copier_action.h
  57. filesystem_copier_action_unittest.cc
  58. filesystem_iterator.cc
  59. filesystem_iterator.h
  60. filesystem_iterator_unittest.cc
  61. flimflam_proxy.cc
  62. flimflam_proxy.h
  63. flimflam_proxy_unittest.cc
  64. full_update_generator.cc
  65. full_update_generator.h
  66. full_update_generator_unittest.cc
  67. gen_coverage_html.sh
  68. generate_delta_main.cc
  69. graph_types.h
  70. graph_utils.cc
  71. graph_utils.h
  72. graph_utils_unittest.cc
  73. http_common.cc
  74. http_common.h
  75. http_fetcher.cc
  76. http_fetcher.h
  77. http_fetcher_unittest.cc
  78. http_fetcher_unittest.h
  79. inherit-review-settings-ok
  80. install_plan.h
  81. integration_unittest.cc
  82. libcurl_http_fetcher.cc
  83. libcurl_http_fetcher.h
  84. LICENSE
  85. local_coverage_rate.sh
  86. main.cc
  87. marshal.list
  88. metadata.cc
  89. metadata.h
  90. metadata_unittest.cc
  91. mock_dbus_interface.h
  92. mock_file_writer.h
  93. mock_http_fetcher.cc
  94. mock_http_fetcher.h
  95. multi_range_http_fetcher.cc
  96. multi_range_http_fetcher.h
  97. omaha_hash_calculator.cc
  98. omaha_hash_calculator.h
  99. omaha_hash_calculator_unittest.cc
  100. omaha_request_action.cc
  101. omaha_request_action.h
  102. omaha_request_action_unittest.cc
  103. omaha_request_params.cc
  104. omaha_request_params.h
  105. omaha_request_params_unittest.cc
  106. omaha_response_handler_action.cc
  107. omaha_response_handler_action.h
  108. omaha_response_handler_action_unittest.cc
  109. org.chromium.UpdateEngine.service
  110. payload_signer.cc
  111. payload_signer.h
  112. payload_signer_unittest.cc
  113. postinstall_runner_action.cc
  114. postinstall_runner_action.h
  115. postinstall_runner_action_unittest.cc
  116. prefs.cc
  117. prefs.h
  118. prefs_interface.h
  119. prefs_mock.h
  120. prefs_unittest.cc
  121. proxy_resolver.cc
  122. proxy_resolver.h
  123. SConstruct
  124. setup_dev_packages
  125. simple_key_value_store.cc
  126. simple_key_value_store.h
  127. simple_key_value_store_unittest.cc
  128. subprocess.cc
  129. subprocess.h
  130. subprocess_unittest.cc
  131. tarjan.cc
  132. tarjan.h
  133. tarjan_unittest.cc
  134. terminator.cc
  135. terminator.h
  136. terminator_unittest.cc
  137. test_http_server.cc
  138. test_utils.cc
  139. test_utils.h
  140. testrunner.cc
  141. topological_sort.cc
  142. topological_sort.h
  143. topological_sort_unittest.cc
  144. unittest_key.pem
  145. unittest_key2.pem
  146. update_attempter.cc
  147. update_attempter.h
  148. update_attempter_mock.h
  149. update_attempter_unittest.cc
  150. update_check_scheduler.cc
  151. update_check_scheduler.h
  152. update_check_scheduler_unittest.cc
  153. update_engine.xml
  154. update_engine_client.cc
  155. update_metadata.proto
  156. UpdateEngine.conf
  157. utils.cc
  158. utils.h
  159. utils_unittest.cc
  160. WATCHLISTS
  161. zip_unittest.cc