计算机科学 ›› 2017, Vol. 44 ›› Issue (11): 27-32.doi: 10.11896/j.issn.1002-137X.2017.11.005

• 2016 年全国软件与应用学术会议 • 上一篇    下一篇

基于测试例生成的Android应用数据竞争验证方法

佘艺,唐弘胤,吴国全,陈伟,魏峻,黄涛   

  1. 中国科学院软件研究所软件工程技术研发中心 北京100190,中国科学院软件研究所软件工程技术研发中心 北京100190,中国科学院软件研究所软件工程技术研发中心 北京100190,中国科学院软件研究所软件工程技术研发中心 北京100190,中国科学院软件研究所软件工程技术研发中心 北京100190,中国科学院软件研究所软件工程技术研发中心 北京100190
  • 出版日期:2018-12-01 发布日期:2018-12-01
  • 基金资助:
    本文受科技支撑(2015BAF05B01),国家自然科学基金(61472407)资助

Concurrency Bugs Verification in Android Applications Based on Test Case Generation

SHE Yi, TANG Hong-yin, WU Guo-quan, CHEN Wei, WEI Jun and HUANG Tao   

  • Online:2018-12-01 Published:2018-12-01

摘要: Android应用是一种事件驱动的并发程序。后台线程与异步事件执行顺序的不确定,导致数据竞争在Android应用中普遍存在。现有的针对Android应用的竞争检测工具会产生大量误报,且不能确定地重现竞争。针对以上问题,在现有的竞争检测结果的基础上,提出了一种基于测试用例生成的Android应用数据竞争验证方法。该方法首先构建应用的状态转化图,并基于状态转化图和现有竞争检测工具的检测结果自动生成包含潜在数据竞争的测试用例,然后在测试用例执行的过程中通过控制事件分发和线程的执行顺序来暴露竞争,观察竞争是否会引起程序异常。实验结果表明,该方法能有效地重现数据竞争引起的并发错误,并指出检测结果中的误报。

关键词: 录制/重放,数据竞争,移动应用,Android,测试

Abstract: Android application is an event-based concurrent program.Data race is common in Android apps due to unforeseen threads interleaving coupled with non-deterministic reordering of asynchronous events.Existing race detection tools for Android applications will report false positive,and cannot replay the concurrent bugs caused by race.To address this issue,this paper proposed a new technique to expose race based on the results obtained from existing race detection tools.Our technique firstly builds state transition graph (STG) for targeted application,and generates a test case that has potential data races based on the STG and the results reported by existing race detection tools.Then it resche-dules test cases execution by controlling event dispatching and thread interleaving to determine whether such potential races really lead to thrown exceptions.Our experiments show that this technique is effective,and it can confirm and replay concurrency bug caused by real data races,while at the same time eliminates false warnings for Android apps.

Key words: Record/Replay,Data race,Mobile application,Android,Testing

[1] SAFI G,SHAHBAZIAN A,HALFOND W G J,et al.Detecting event anomalies in event-based systems[C]∥Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering.ACM,2015:25-37.
[2] BIELIK P,RAYCHEV V,VECHEV M.Scalable race detection for android applications[J].ACM SIGPLAN Notices,2015,50(10):332-348.
[3] YANG S,YAN D,WU H,et al.Static control-flow analysis of user-driven callbacks in Android applications[C]∥Proceedings of the 37th International Conference on Software Engineering-Volume 1.IEEE,2015:89-99.
[4] YANG S,ZHANG H,WU H,et al.Static Window Transition Graphs for Android (T)[C]∥2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE).IEEE,2015:658-668.
[5] CHOI W,NECULA G,SEN K.Guided gui testing of android apps with minimal restart and approximate learning[J].ACM SIGPLAN Notices,2013,48(10):623-640.
[6] AZIM T,NEAMTIU I.Targeted and depth-first exploration for systematic testing of android apps[J].ACM SIGPLAN Notices,2013,48(10):641-660.
[7] MAIYA P,KANADE A,MAJUMDAR R.Race detection forAndroid applications[C]∥ACM SIGPLAN Notices.2014:316-325.
[8] HSIAO C H,YU J,NARAYANASAMY S,et al.Race detection for event-driven mobile applications[J].ACM SIGPLAN Notices,2014,49(6):326-336.
[9] Espresso.https://google.github.io/android-testing-sup-port-library/docs/espresso.
[10] PETROV B,VECHEV M,SRIDHARAN M,et al.Race detection for web applications[J].ACM SIGPLAN Notices,2012,47(6):251-262.
[11] RAYCHEV V,VECHEV M,S RIDHARAN M.Effective race detection for event-driven programs[J].ACM SIGPLAN Notices,2013,48(10):151-166.
[12] LIN Y,RADOI C,DIG D.Retrofitting concurrency for android applications through refactoring[C]∥Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering.ACM,2014:341-352.
[13] SEN K.Race directed random testing of concurrent programs[J].ACM SIGPLAN Notices,2008,43(6):11-21.
[14] Robtotium.Github.https://github.com/RobotiumTech/robotium.

No related articles found!
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!