Skip to content

zhendong2050/TimeMachine

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TimeMachine

TimeMachine is an automated testing tool for Android apps, which can automatically jump to the most progressive state observed in the past when progress is slow.

TimeMachine leverages virtualization technology such as emulator to save an app state and restore it when needed. TimeMachine identifies an app state with GUI layout and memories all discovered states. When a state is considered interesting, e.g., new code is covered, TimeMachine saves the state. Meanwhile, TimeMachine observes most-recently-visited states to check whether progress is slow, e.g., being stuck in a state loop. Once progress is considered slow, TimeMachine restores the most progressive one from saved states for further exploration so that more program behavior is exercised in a short time.

Publication

The paper PDF can be found at https://www.comp.nus.edu.sg/~abhik/pdf/ICSE20TM.pdf

@InProceedings{zhendong:icse:2020,
author = {Dong, Zhen and B{\"o}hme, Marcel and Cojocaru, Lucia and Roychoudhury, Abhik},
title = {Time-travel Testing of Android Apps},
booktitle = {Proceedings of the 42nd International Conference on Software Engineering},
series = {ICSE '20},
year = {2020},
pages={1-12}}

Architecture

The figure above shows TimeMachine's architecture. The whole system runs in a docker container with the Ubuntu operating system. App under test is installed in an Android virtual machine. TimeMachine connects the virtual machine via ADB to test the app. Main Components are configured as followed:

  • Android SDK Version 25
  • Android-x86-7.1.r2
  • Virtualbox 5.1.38 or 5.0.18
  • Docker API v1.13 or above
  • Python 2.7.2

Todo

Ubuntu version needs to be specified in the current setting, Ubuntu 18.04 for now.
Develop a module to dynamically identify versions of the operation system for image building.

Setup

The following is required to set up TimeMachine:

  • at least 100 GB hard drive
  • 8 GB memory
  • Ububntu 18.04 64-bit

Step 1: clone repository

git clone https://github.com/DroidTest/TimeMachine.git

Step 2: install dependencies

install and configure docker

sudo apt-get install docker.io
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker 

step 3: build an docker image

docker build -t droidtest/timemachine:1.0 .

It takes serveral minutes. Note: you should build the docker image whenever your running Linux kernel has been changed(e.g. kernel updated).

Usage

TimeMachine takes as input apks instrumented with Android apps instrumenting tool Emma or Ella. Under folder two_apps_under_test are closed-source apks instrumented with Ella, i.e., Microsoft Word and Duolingo.

cd fuzzingandroid

Test example apps in a container

#USAGE: exec-single.bash APP_DIR OPEN_SOURCE DOCKER_IMAGE TIMEOUT [OUTPUT_PATH]

./exec-single-app.bash ../two_apps_under_test/ms_word/ 0 droidtest/timemachine:1.0 1800 ../word_output
./exec-single-app.bash ../two_apps_under_test/duolingo/ 0 droidtest/timemachine:1.0 1800 ../duolingo_output

Output

check method coverage

./compute_cov_aver.bash ../word_output/ ../two_apps_under_test/ms_word/
./compute_cov_aver.bash ../duolingo_output/ ../two_apps_under_test/duolingo/

check crashes

cat word_output/timemachine-output/crashes.log
cat duolingo_output/timemachine-output/crashes.log 

Need help?

  • If failed to connect VM, please check whether virtualbox is correctly installed. TimeMachine was tested on virtualbox 5.0.18 and virtualbox 5.1.38.
  • Contact Zhen Dong for further issues.

Contributors

  • Zhen Dong (zhendng@gmail.com)
  • Lucia Cojocaru
  • Xiao Liang Yu
  • Marcel Böhme
  • Abhik Roychoudhury