Fix shill unittest bugs - singleton instances must be handled properly across different unittests.

Unittests for shill is a single executable, which run each unittest
one by one, so for each singleton, we must setup up and clear
properly, we must not make any assumption that this singleton is used
only for a particular test.

For instance in config80211_unittest.cc, singleton member
'Config80211::sock_' is assigned a value which invalidates right after
Config80211Test finishes, when later ShillDaemonTest::Start comes to
this non-NULL value, thinking that this is properly initialized and
makes a call on it, the program crashes.

TEST=all shill tests passed after fixing (was crashing)
BUG=None

Change-Id: Ifd17bfca319e4f5d93cb82bdde010d9a5db36dcd
Reviewed-on: https://gerrit.chromium.org/gerrit/39771
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Han Shen <shenhan@chromium.org>
Tested-by: Han Shen <shenhan@chromium.org>
4 files changed
tree: 3b14e3127d83d63fcef1e7f14c19c03b92f17bea
  1. bin/
  2. data/
  3. dbus_bindings/
  4. doc/
  5. shims/
  6. .gitignore
  7. accessor_interface.h
  8. adaptor_interfaces.h
  9. arp_client.cc
  10. arp_client.h
  11. arp_client_unittest.cc
  12. arp_packet.cc
  13. arp_packet.h
  14. arp_packet_unittest.cc
  15. async_connection.cc
  16. async_connection.h
  17. async_connection_unittest.cc
  18. byte_string.cc
  19. byte_string.h
  20. byte_string_unittest.cc
  21. callback80211_metrics.cc
  22. callback80211_metrics.h
  23. callback80211_object.cc
  24. callback80211_object.h
  25. callbacks.h
  26. cellular.cc
  27. cellular.h
  28. cellular_capability.cc
  29. cellular_capability.h
  30. cellular_capability_cdma.cc
  31. cellular_capability_cdma.h
  32. cellular_capability_cdma_unittest.cc
  33. cellular_capability_classic.cc
  34. cellular_capability_classic.h
  35. cellular_capability_classic_unittest.cc
  36. cellular_capability_gsm.cc
  37. cellular_capability_gsm.h
  38. cellular_capability_gsm_unittest.cc
  39. cellular_capability_universal.cc
  40. cellular_capability_universal.h
  41. cellular_capability_universal_unittest.cc
  42. cellular_error.cc
  43. cellular_error.h
  44. cellular_operator_info.cc
  45. cellular_operator_info.h
  46. cellular_operator_info_unittest.cc
  47. cellular_service.cc
  48. cellular_service.h
  49. cellular_service_unittest.cc
  50. cellular_unittest.cc
  51. config80211.cc
  52. config80211.h
  53. config80211_unittest.cc
  54. connection.cc
  55. connection.h
  56. connection_unittest.cc
  57. control_interface.h
  58. crypto_des_cbc.cc
  59. crypto_des_cbc.h
  60. crypto_des_cbc_unittest.cc
  61. crypto_interface.h
  62. crypto_provider.cc
  63. crypto_provider.h
  64. crypto_provider_unittest.cc
  65. crypto_rot47.cc
  66. crypto_rot47.h
  67. crypto_rot47_unittest.cc
  68. dbus_adaptor.cc
  69. dbus_adaptor.h
  70. dbus_adaptor_unittest.cc
  71. dbus_control.cc
  72. dbus_control.h
  73. dbus_manager.cc
  74. dbus_manager.h
  75. dbus_manager_unittest.cc
  76. dbus_objectmanager_proxy.cc
  77. dbus_objectmanager_proxy.h
  78. dbus_objectmanager_proxy_interface.h
  79. dbus_properties.cc
  80. dbus_properties.h
  81. dbus_properties_proxy.cc
  82. dbus_properties_proxy.h
  83. dbus_properties_proxy_interface.h
  84. dbus_properties_unittest.cc
  85. dbus_property_matchers.h
  86. dbus_service_proxy.cc
  87. dbus_service_proxy.h
  88. dbus_service_proxy_interface.h
  89. default_profile.cc
  90. default_profile.h
  91. default_profile_unittest.cc
  92. device.cc
  93. device.h
  94. device_dbus_adaptor.cc
  95. device_dbus_adaptor.h
  96. device_info.cc
  97. device_info.h
  98. device_info_unittest.cc
  99. device_stub.h
  100. device_unittest.cc
  101. dhcp_config.cc
  102. dhcp_config.h
  103. dhcp_config_unittest.cc
  104. dhcp_provider.cc
  105. dhcp_provider.h
  106. dhcp_provider_unittest.cc
  107. dhcp_proxy_interface.h
  108. dhcpcd_proxy.cc
  109. dhcpcd_proxy.h
  110. diagnostics_reporter.cc
  111. diagnostics_reporter.h
  112. diagnostics_reporter_unittest.cc
  113. dns_client.cc
  114. dns_client.h
  115. dns_client_unittest.cc
  116. endpoint.cc
  117. endpoint.h
  118. ephemeral_profile.cc
  119. ephemeral_profile.h
  120. error.cc
  121. error.h
  122. error_unittest.cc
  123. ethernet.cc
  124. ethernet.h
  125. ethernet_service.cc
  126. ethernet_service.h
  127. ethernet_service_unittest.cc
  128. event_dispatcher.cc
  129. event_dispatcher.h
  130. geolocation_info.cc
  131. geolocation_info.h
  132. glib.cc
  133. glib.h
  134. glib_io_input_handler.cc
  135. glib_io_input_handler.h
  136. glib_io_ready_handler.cc
  137. glib_io_ready_handler.h
  138. HACKING
  139. hook_table.cc
  140. hook_table.h
  141. hook_table_unittest.cc
  142. http_proxy.cc
  143. http_proxy.h
  144. http_proxy_unittest.cc
  145. http_request.cc
  146. http_request.h
  147. http_request_unittest.cc
  148. http_url.cc
  149. http_url.h
  150. http_url_unittest.cc
  151. ieee80211.h
  152. io_handler.h
  153. ip_address.cc
  154. ip_address.h
  155. ip_address_unittest.cc
  156. ipconfig.cc
  157. ipconfig.h
  158. ipconfig_dbus_adaptor.cc
  159. ipconfig_dbus_adaptor.h
  160. ipconfig_unittest.cc
  161. kernel_bound_nlmessage.cc
  162. kernel_bound_nlmessage.h
  163. key_file_store.cc
  164. key_file_store.h
  165. key_file_store_unittest.cc
  166. key_value_store.cc
  167. key_value_store.h
  168. key_value_store_matcher.h
  169. key_value_store_unittest.cc
  170. l2tp_ipsec_driver.cc
  171. l2tp_ipsec_driver.h
  172. l2tp_ipsec_driver_unittest.cc
  173. LICENSE
  174. link_monitor.cc
  175. link_monitor.h
  176. link_monitor_unittest.cc
  177. logging.h
  178. Makefile
  179. manager.cc
  180. manager.h
  181. manager_dbus_adaptor.cc
  182. manager_dbus_adaptor.h
  183. manager_unittest.cc
  184. memory_log.cc
  185. memory_log.h
  186. memory_log_unittest.cc
  187. metrics.cc
  188. metrics.h
  189. metrics_unittest.cc
  190. minijail.cc
  191. minijail.h
  192. mm1_bearer_proxy.cc
  193. mm1_bearer_proxy.h
  194. mm1_bearer_proxy_interface.h
  195. mm1_modem_modem3gpp_proxy.cc
  196. mm1_modem_modem3gpp_proxy.h
  197. mm1_modem_modem3gpp_proxy_interface.h
  198. mm1_modem_modemcdma_proxy.cc
  199. mm1_modem_modemcdma_proxy.h
  200. mm1_modem_modemcdma_proxy_interface.h
  201. mm1_modem_proxy.cc
  202. mm1_modem_proxy.h
  203. mm1_modem_proxy_interface.h
  204. mm1_modem_simple_proxy.cc
  205. mm1_modem_simple_proxy.h
  206. mm1_modem_simple_proxy_interface.h
  207. mm1_modem_time_proxy.cc
  208. mm1_modem_time_proxy.h
  209. mm1_modem_time_proxy_interface.h
  210. mm1_sim_proxy.cc
  211. mm1_sim_proxy.h
  212. mm1_sim_proxy_interface.h
  213. mock_adaptors.cc
  214. mock_adaptors.h
  215. mock_ares.cc
  216. mock_ares.h
  217. mock_arp_client.cc
  218. mock_arp_client.h
  219. mock_async_connection.cc
  220. mock_async_connection.h
  221. mock_callback80211_object.h
  222. mock_cellular.cc
  223. mock_cellular.h
  224. mock_cellular_operator_info.cc
  225. mock_cellular_operator_info.h
  226. mock_cellular_service.cc
  227. mock_cellular_service.h
  228. mock_connection.cc
  229. mock_connection.h
  230. mock_control.cc
  231. mock_control.h
  232. mock_dbus_manager.cc
  233. mock_dbus_manager.h
  234. mock_dbus_objectmanager_proxy.cc
  235. mock_dbus_objectmanager_proxy.h
  236. mock_dbus_properties_proxy.cc
  237. mock_dbus_properties_proxy.h
  238. mock_dbus_service_proxy.cc
  239. mock_dbus_service_proxy.h
  240. mock_device.cc
  241. mock_device.h
  242. mock_device_info.cc
  243. mock_device_info.h
  244. mock_dhcp_config.cc
  245. mock_dhcp_config.h
  246. mock_dhcp_provider.cc
  247. mock_dhcp_provider.h
  248. mock_dhcp_proxy.cc
  249. mock_dhcp_proxy.h
  250. mock_diagnostics_reporter.cc
  251. mock_diagnostics_reporter.h
  252. mock_dns_client.cc
  253. mock_dns_client.h
  254. mock_ethernet.cc
  255. mock_ethernet.h
  256. mock_event_dispatcher.cc
  257. mock_event_dispatcher.h
  258. mock_glib.cc
  259. mock_glib.h
  260. mock_http_request.cc
  261. mock_http_request.h
  262. mock_ipconfig.cc
  263. mock_ipconfig.h
  264. mock_link_monitor.cc
  265. mock_link_monitor.h
  266. mock_log.cc
  267. mock_log.h
  268. mock_log_unittest.cc
  269. mock_manager.cc
  270. mock_manager.h
  271. mock_metrics.cc
  272. mock_metrics.h
  273. mock_minijail.cc
  274. mock_minijail.h
  275. mock_mm1_bearer_proxy.cc
  276. mock_mm1_bearer_proxy.h
  277. mock_mm1_modem_modem3gpp_proxy.cc
  278. mock_mm1_modem_modem3gpp_proxy.h
  279. mock_mm1_modem_modemcdma_proxy.cc
  280. mock_mm1_modem_modemcdma_proxy.h
  281. mock_mm1_modem_proxy.cc
  282. mock_mm1_modem_proxy.h
  283. mock_mm1_modem_simple_proxy.cc
  284. mock_mm1_modem_simple_proxy.h
  285. mock_mm1_modem_time_proxy.cc
  286. mock_mm1_modem_time_proxy.h
  287. mock_mm1_sim_proxy.cc
  288. mock_mm1_sim_proxy.h
  289. mock_modem.cc
  290. mock_modem.h
  291. mock_modem_cdma_proxy.cc
  292. mock_modem_cdma_proxy.h
  293. mock_modem_gobi_proxy.cc
  294. mock_modem_gobi_proxy.h
  295. mock_modem_gsm_card_proxy.cc
  296. mock_modem_gsm_card_proxy.h
  297. mock_modem_gsm_network_proxy.cc
  298. mock_modem_gsm_network_proxy.h
  299. mock_modem_info.cc
  300. mock_modem_info.h
  301. mock_modem_manager_proxy.cc
  302. mock_modem_manager_proxy.h
  303. mock_modem_proxy.cc
  304. mock_modem_proxy.h
  305. mock_modem_simple_proxy.cc
  306. mock_modem_simple_proxy.h
  307. mock_nl80211_socket.h
  308. mock_nss.cc
  309. mock_nss.h
  310. mock_openvpn_driver.cc
  311. mock_openvpn_driver.h
  312. mock_openvpn_management_server.cc
  313. mock_openvpn_management_server.h
  314. mock_portal_detector.cc
  315. mock_portal_detector.h
  316. mock_power_manager.cc
  317. mock_power_manager.h
  318. mock_power_manager_proxy.cc
  319. mock_power_manager_proxy.h
  320. mock_process_killer.cc
  321. mock_process_killer.h
  322. mock_profile.cc
  323. mock_profile.h
  324. mock_property_store.cc
  325. mock_property_store.h
  326. mock_proxy_factory.cc
  327. mock_proxy_factory.h
  328. mock_resolver.cc
  329. mock_resolver.h
  330. mock_routing_table.cc
  331. mock_routing_table.h
  332. mock_rtnl_handler.cc
  333. mock_rtnl_handler.h
  334. mock_service.cc
  335. mock_service.h
  336. mock_sockets.cc
  337. mock_sockets.h
  338. mock_store.cc
  339. mock_store.h
  340. mock_supplicant_bss_proxy.cc
  341. mock_supplicant_bss_proxy.h
  342. mock_supplicant_interface_proxy.cc
  343. mock_supplicant_interface_proxy.h
  344. mock_supplicant_process_proxy.cc
  345. mock_supplicant_process_proxy.h
  346. mock_time.cc
  347. mock_time.h
  348. mock_vpn.cc
  349. mock_vpn.h
  350. mock_vpn_driver.cc
  351. mock_vpn_driver.h
  352. mock_vpn_provider.cc
  353. mock_vpn_provider.h
  354. mock_vpn_service.cc
  355. mock_vpn_service.h
  356. mock_wifi.cc
  357. mock_wifi.h
  358. mock_wifi_service.cc
  359. mock_wifi_service.h
  360. mock_wimax.cc
  361. mock_wimax.h
  362. mock_wimax_device_proxy.cc
  363. mock_wimax_device_proxy.h
  364. mock_wimax_manager_proxy.cc
  365. mock_wimax_manager_proxy.h
  366. mock_wimax_network_proxy.cc
  367. mock_wimax_network_proxy.h
  368. mock_wimax_provider.cc
  369. mock_wimax_provider.h
  370. mock_wimax_service.cc
  371. mock_wimax_service.h
  372. modem.cc
  373. modem.h
  374. modem_1.cc
  375. modem_1_unittest.cc
  376. modem_cdma_proxy.cc
  377. modem_cdma_proxy.h
  378. modem_cdma_proxy_interface.h
  379. modem_classic.cc
  380. modem_gobi_proxy.cc
  381. modem_gobi_proxy.h
  382. modem_gobi_proxy_interface.h
  383. modem_gsm_card_proxy.cc
  384. modem_gsm_card_proxy.h
  385. modem_gsm_card_proxy_interface.h
  386. modem_gsm_network_proxy.cc
  387. modem_gsm_network_proxy.h
  388. modem_gsm_network_proxy_interface.h
  389. modem_info.cc
  390. modem_info.h
  391. modem_info_unittest.cc
  392. modem_manager.cc
  393. modem_manager.h
  394. modem_manager_1.cc
  395. modem_manager_proxy.cc
  396. modem_manager_proxy.h
  397. modem_manager_proxy_interface.h
  398. modem_manager_unittest.cc
  399. modem_proxy.cc
  400. modem_proxy.h
  401. modem_proxy_interface.h
  402. modem_simple_proxy.cc
  403. modem_simple_proxy.h
  404. modem_simple_proxy_interface.h
  405. modem_unittest.cc
  406. netlink_socket.cc
  407. netlink_socket.h
  408. nice_mock_control.cc
  409. nice_mock_control.h
  410. nl80211_attribute.cc
  411. nl80211_attribute.h
  412. nl80211_socket.cc
  413. nl80211_socket.h
  414. nss.cc
  415. nss.h
  416. nss_unittest.cc
  417. openvpn_driver.cc
  418. openvpn_driver.h
  419. openvpn_driver_unittest.cc
  420. openvpn_management_server.cc
  421. openvpn_management_server.h
  422. openvpn_management_server_unittest.cc
  423. portal_detector.cc
  424. portal_detector.h
  425. portal_detector_unittest.cc
  426. power_manager.cc
  427. power_manager.h
  428. power_manager_proxy.cc
  429. power_manager_proxy.h
  430. power_manager_proxy_interface.h
  431. power_manager_unittest.cc
  432. process_killer.cc
  433. process_killer.h
  434. process_killer_unittest.cc
  435. profile.cc
  436. profile.h
  437. profile_dbus_adaptor.cc
  438. profile_dbus_adaptor.h
  439. profile_dbus_property_exporter.cc
  440. profile_dbus_property_exporter.h
  441. profile_dbus_property_exporter_unittest.cc
  442. profile_unittest.cc
  443. property_accessor.h
  444. property_accessor_unittest.cc
  445. property_iterator.h
  446. property_store.cc
  447. property_store.h
  448. property_store_inspector.cc
  449. property_store_inspector.h
  450. property_store_unittest.cc
  451. property_store_unittest.h
  452. provider_db_unittest.bfd
  453. proxy_factory.cc
  454. proxy_factory.h
  455. refptr_types.h
  456. resolver.cc
  457. resolver.h
  458. resolver_unittest.cc
  459. routing_table.cc
  460. routing_table.h
  461. routing_table_entry.h
  462. routing_table_unittest.cc
  463. rpc_task.cc
  464. rpc_task.h
  465. rpc_task_dbus_adaptor.cc
  466. rpc_task_dbus_adaptor.h
  467. rpc_task_unittest.cc
  468. rtnl_handler.cc
  469. rtnl_handler.h
  470. rtnl_handler_unittest.cc
  471. rtnl_listener.cc
  472. rtnl_listener.h
  473. rtnl_listener_unittest.cc
  474. rtnl_message.cc
  475. rtnl_message.h
  476. rtnl_message_unittest.cc
  477. scope_logger.cc
  478. scope_logger.h
  479. scope_logger_unittest.cc
  480. service.cc
  481. service.h
  482. service_dbus_adaptor.cc
  483. service_dbus_adaptor.h
  484. service_sorter.h
  485. service_under_test.cc
  486. service_under_test.h
  487. service_unittest.cc
  488. shill_ares.cc
  489. shill_ares.h
  490. shill_config.cc
  491. shill_config.h
  492. shill_daemon.cc
  493. shill_daemon.h
  494. shill_main.cc
  495. shill_test_config.cc
  496. shill_test_config.h
  497. shill_time.cc
  498. shill_time.h
  499. shill_unittest.cc
  500. sockets.cc
  501. sockets.h
  502. static_ip_parameters.cc
  503. static_ip_parameters.h
  504. static_ip_parameters_unittest.cc
  505. store_interface.h
  506. supplicant_bss_proxy.cc
  507. supplicant_bss_proxy.h
  508. supplicant_bss_proxy_interface.h
  509. supplicant_interface_proxy.cc
  510. supplicant_interface_proxy.h
  511. supplicant_interface_proxy_interface.h
  512. supplicant_process_proxy.cc
  513. supplicant_process_proxy.h
  514. supplicant_process_proxy_interface.h
  515. technology.cc
  516. technology.h
  517. technology_unittest.cc
  518. TESTING
  519. testrunner.cc
  520. user_bound_nlmessage.cc
  521. user_bound_nlmessage.h
  522. virtio_ethernet.cc
  523. virtio_ethernet.h
  524. vpn.cc
  525. vpn.h
  526. vpn_driver.cc
  527. vpn_driver.h
  528. vpn_driver_unittest.cc
  529. vpn_provider.cc
  530. vpn_provider.h
  531. vpn_provider_unittest.cc
  532. vpn_service.cc
  533. vpn_service.h
  534. vpn_service_unittest.cc
  535. vpn_unittest.cc
  536. wifi.cc
  537. wifi.h
  538. wifi_endpoint.cc
  539. wifi_endpoint.h
  540. wifi_endpoint_unittest.cc
  541. wifi_service.cc
  542. wifi_service.h
  543. wifi_service_unittest.cc
  544. wifi_unittest.cc
  545. wimax.cc
  546. wimax.h
  547. wimax_device_proxy.cc
  548. wimax_device_proxy.h
  549. wimax_device_proxy_interface.h
  550. wimax_manager_proxy.cc
  551. wimax_manager_proxy.h
  552. wimax_manager_proxy_interface.h
  553. wimax_network_proxy.cc
  554. wimax_network_proxy.h
  555. wimax_network_proxy_interface.h
  556. wimax_provider.cc
  557. wimax_provider.h
  558. wimax_provider_unittest.cc
  559. wimax_service.cc
  560. wimax_service.h
  561. wimax_service_unittest.cc
  562. wimax_unittest.cc
  563. wpa_supplicant.cc
  564. wpa_supplicant.h