├── .gitignore ├── .gitmodules ├── README.md ├── Vagrantfile ├── bin ├── check_gij_version.sh ├── clean_cache.sh ├── clean_shared.sh ├── delete_all_vbox_vms.sh ├── extract_gij_logs.sh ├── get_credentials.sh ├── package.sh ├── reset_vm.sh ├── stop.sh └── update_vm.sh ├── config_files ├── 57-android.rules └── firefox_profile.zip ├── launch.sh ├── menu.png ├── scripts ├── check_gij_version.sh ├── flash_b2g.sh ├── fuzz_executor.sh ├── gij_per_app.sh ├── gij_phone_device.sh ├── gij_phone_emulator.sh ├── gij_phone_mulet.sh ├── gij_provision.sh ├── gij_tv_mulet.sh ├── gip_phone_device.sh ├── gip_phone_mulet.sh ├── gip_provision.sh ├── greet │ ├── mozitp.sh │ └── taskcluster.sh ├── install │ ├── adb_fastboot.sh │ ├── all.sh │ ├── b2g_and_tc_tools.sh │ ├── firefox_trunk.sh │ ├── nvm.sh │ ├── system_provision.sh │ └── xwindow.sh ├── menu.sh └── x │ ├── b2g_installer.desktop │ ├── b2g_installer.sh │ ├── gij.desktop │ ├── startgui.sh │ ├── startgui_b2g_installer.sh │ ├── startgui_gij.sh │ ├── startgui_only.sh │ ├── startgui_tv_mulet.sh │ ├── tv_mulet.desktop │ ├── tv_mulet.sh │ └── uxterm.desktop ├── test ├── all.sh ├── all_without_device.sh ├── flashtool_sanity_test.sh ├── gij_phone_device_sanity_test.sh ├── gij_phone_mulet_sanity_test.sh ├── gij_tv_mulet_sanity_test.sh ├── gip_phone_device_sanity_test.sh └── gip_phone_mulet_sanity_test.sh └── util ├── .simplefilter.list ├── __init__.py ├── config_handler.py ├── logging_policy.py ├── onceaday.py └── simplefilter.py /.gitignore: -------------------------------------------------------------------------------- 1 | # This project's things 2 | env-* 3 | docs/ 4 | shared/* 5 | !shared/.placeholder # We need to checking the placeholder so the folder exist when pulled 6 | .vagrant 7 | 8 | # OS X 9 | .DS_Store 10 | 11 | # PyCharm 12 | .idea/ 13 | 14 | # Vim 15 | [._]*.s[a-w][a-z] 16 | [._]s[a-w][a-z] 17 | *.un~ 18 | Session.vim 19 | .netrwhist 20 | *~ 21 | 22 | # Node downloads 23 | node-v*/ 24 | node_modules/ 25 | 26 | # Byte-compiled / optimized / DLL files 27 | __pycache__/ 28 | *.py[cod] 29 | 30 | # C extensions 31 | *.so 32 | 33 | # Distribution / packaging 34 | .Python 35 | env/ 36 | build/ 37 | develop-eggs/ 38 | dist/ 39 | downloads/ 40 | eggs/ 41 | lib/ 42 | lib64/ 43 | parts/ 44 | sdist/ 45 | var/ 46 | *.egg-info/ 47 | .installed.cfg 48 | *.egg 49 | 50 | # PyInstaller 51 | # Usually these files are written by a python script from a template 52 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 53 | *.manifest 54 | *.spec 55 | 56 | # Installer logs 57 | pip-log.txt 58 | pip-delete-this-directory.txt 59 | 60 | # Unit test / coverage reports 61 | htmlcov/ 62 | .tox/ 63 | .coverage 64 | .cache 65 | nosetests.xml 66 | coverage.xml 67 | 68 | # Translations 69 | *.mo 70 | *.pot 71 | 72 | # Django stuff: 73 | *.log 74 | 75 | # Sphinx documentation 76 | docs/_build/ 77 | 78 | # PyBuilder 79 | target/ 80 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla-b2g/MozITP/aceb8be6c76b5b92c788f8b91aa9b79ad0c0acf8/.gitmodules -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Mozilla Integrated Tool Package 2 | =============================== 3 | 4 | The Mozilla integrated tools package (MozITP) is a one-stop shop for setting up Firefox OS-related tools, which can handle automatic Testing on Mulet or a real device, [flashing TaskCluster images](https://pypi.python.org/pypi/b2g_util), flashing with the [B2G installer add-on](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Building_and_installing_Firefox_OS/B2G_installer_add-on), and running the TV and phone versions of Mulet. 5 | 6 | # Environment setup 7 | 8 | MozITP depends on **Vagrant** and **Virtualbox**. 9 | 10 | By default, VM in VirtualBox will enable **VT-x/AMD-V** and **Nested Paging**, so you have to enable **VT-x/AMD-V** feature of your host. 11 | 12 | Let's look at how to set up the environment on Linux, Mac OS X, and Windows. 13 | 14 | ## Ubuntu 15 | 16 | * Download [Vagrant's Debian package](https://www.vagrantup.com/downloads.html). 17 | * Install Vagrant using this: `sudo dpkg -i ` 18 | * Install VirtualBox using this: `sudo apt-get install virtualbox virtualbox-dkms virtualbox-qt` 19 | * Reboot your computer after the Virtualbox installation has finished. 20 | * Download and install the [VirtualBox Extension Pack](https://www.virtualbox.org/wiki/Downloads). 21 | * [Set up the USB for VirtualBox](https://help.ubuntu.com/community/VirtualBox/USB) using the following command: `sudo adduser vboxusers` 22 | * Re-login or restart your computer. 23 | * Make sure you enable Intel VT-x and VT-d in the BIOS. 24 | 25 | ## Mac OS X 26 | 27 | * Install [Brew Cask](http://caskroom.io/). 28 | * Install Vagrant using this: `sudo brew cask install vagrant; sudo brew cask install vagrant-manager` 29 | * Install VirtualBox using this: `sudo brew cask install virtualbox` 30 | * Install the VirtualBox Extension Pack using the following: `sudo brew cask install virtualbox-extension-pack` 31 | * Make sure you enable Intel VT-x and VT-d in the BIOS. 32 | 33 | ## Windows (experimental) 34 | 35 | * Install the [Windows version of Git](http://www.git-scm.com/download/win). Make sure that you don't let Git change the line ending symbol to windows format. 36 | * Install the [Windows bash shell](http://win-bash.sourceforge.net/). 37 | * Install [Vagrant for Windows](https://www.vagrantup.com/downloads.html). 38 | * Install [Virtualbox for Windows](https://www.virtualbox.org/wiki/Downloads). 39 | * Run `launch.sh` in PowerShell or git-bash 40 | * Make sure you enable Intel VT-x and VT-d in the BIOS. 41 | * If your VirtualBox VM failed to start, try enabling *Hyper-V* in *VirtualBox > Settings > System > Accleration > Paravirtualization Interface*. 42 | 43 | ## Other Platforms 44 | 45 | Whatever the case, you need to install [Vagrant](https://docs.vagrantup.com/v2/installation/index.html) — see the [Installing Vagrant](https://docs.vagrantup.com/v2/installation/index.html) guide for more details. 46 | 47 | You also need to install a VM [provider](https://docs.vagrantup.com/v2/providers/index.html) for Vagrant. We are assuming the use of [VirtualBox](http://www.virtualbox.org/) throughout our article. 48 | 49 | 50 | # Cloning the Repo 51 | 52 | After the environment has been set up, you need to clone the MozITP repo. 53 | 54 | Do so with the following command: 55 | 56 | ``` bash 57 | $ git clone https://github.com/mozilla-b2g/MozITP.git 58 | ``` 59 | 60 | And you can run `git pull` to get the latest version of this repo. 61 | 62 | 63 | # Usage 64 | 65 | Now you've set up the environment and cloned the repo, you can start using MozITP. 66 | 67 | > **Note**: The following commands should be run from inside the *MozITP* directory. 68 | 69 | ## Setting permissions 70 | If you get any problems running the scripts, you need to make sure you have the necessary permissions set on the commands. Add execute permissions, for example: 71 | 72 | ```bash 73 | $ chmod u+x launch.sh 74 | ``` 75 | 76 | ## Launching the MozITP 77 | Launch MozITP with the following command: 78 | 79 | ```bash 80 | $ ./launch.sh 81 | ``` 82 | 83 | At this point a Vagrant VM will be launched — you should see something like this: 84 | 85 | ![menu](https://raw.githubusercontent.com/Mozilla-TWQA/MozITP/master/menu.png) 86 | 87 | ## Stopping MozITP 88 | 89 | To stop the VM, running the following: 90 | 91 | ```bash 92 | $ ./bin/stop.sh 93 | ``` 94 | 95 | ## Resetting to factory 96 | 97 | To reset the VM to the factory defaults, run this command: 98 | 99 | ```bash 100 | $ ./bin/reset_vm.sh 101 | ``` 102 | 103 | ## Updating the VM 104 | 105 | To update to the latest version of the VM, run the following: 106 | 107 | ```bash 108 | $ ./bin/update_vm.sh 109 | ``` 110 | 111 | ## GIJ (Gaia Integration Test / JS Marionette) 112 | 113 | You can run the GIJ (Gaia integration tests in JavaScript) directly from inside MozITP, which is very useful for automation. See the **Supported Platforms** section for available targets. 114 | 115 | > **Warning**: Sometimes the test case itself has bugs, which makes the GIJ test fail. To verify if it's a GIJ platform bug or a test case bug, run `./test/gij_phone_mulet_sanity_test.sh` or `./test/gij_phone_device_sanity_test.sh` files, depending on whether you are running the tests on Mulet or a real device. If it passes, it could be a bug in the test case, not the platform. 116 | 117 | ### Running GIJ 118 | 119 | To run GIJ directly, run the following: 120 | 121 | ```bash 122 | $ ./launch.sh gij 123 | ``` 124 | 125 | To run GIJ just on a specific app, you'll need a command structure like the following: 126 | 127 | ```bash 128 | $ export APP=video; ./launch.sh gij # The `export` is important, don't miss it 129 | ``` 130 | 131 | To run GIJ on a specific test file: 132 | 133 | ```bash 134 | $ export TEST_FILES=apps/clock/test/marionette/hour_format_test.js 135 | $ ./launch.sh gij 136 | ``` 137 | 138 | ### Running GIJ directly on a device 139 | 140 | To run GIJ directly on the device. The device must be connected through USB before you run the command: 141 | 142 | ```bash 143 | $ ./launch.sh gij device 144 | ``` 145 | 146 | ### Running GIJ with your own Gaia build 147 | 148 | If you already have a Gaia repository you want to test, you can use the following commands: 149 | 150 | ```bash 151 | $ export GAIA=/path/to/your/gaia 152 | $ ./launch.sh 153 | ``` 154 | 155 | If you change your mind and want to use the latest Gaia instead, you can do this: 156 | 157 | ```bash 158 | $ ./reset_vm.sh 159 | $ unset GAIA 160 | $ ./launch.sh 161 | ``` 162 | 163 | Or if you want to keep the VM, you can do this: 164 | 165 | ```bash 166 | $ unset GAIA 167 | $ ./launch.sh 168 | $ vagrant ssh -c "rm ~/.users_gaia_exists" # Remove the flag 169 | $ ./bin/stop.sh # Restart the VM 170 | $ ./launch.sh 171 | ``` 172 | 173 | ### Running GIJ on TV mulet 174 | 175 | To run GIJ on TV mulet, run the following: 176 | 177 | ```bash 178 | $ ./launch.sh gij-tv 179 | ``` 180 | 181 | ## GIP (Python Gaia Integration Test) 182 | 183 | See **Supported Platforms** section for available targets. 184 | 185 | ### Running GIP 186 | 187 | To run GIP, do the following: 188 | 189 | ```bash 190 | $ ./launch.sh gip 191 | ``` 192 | 193 | ## Fuzz 194 | 195 | The [MozCingi](https://github.com/ShakoHo/mozCingi), fuzz testing of B2G. 196 | 197 | ### Running Fuzz 198 | 199 | To run fuzz testing, do the following: 200 | 201 | ```bash 202 | $ ./launch.sh fuzz 203 | ``` 204 | 205 | ## Flashing 206 | 207 | Let's look at how to flash a TaskCluster image onto your instance of MozITP. 208 | 209 | If you already have TaskCluster credentials: 210 | 211 | * For flashing the TaskCluster image (needs credentials), please run `./bin/get_credentials.sh` before flashing. 212 | * Next, run `./launch.sh` and select *Flashing B2G Image*. 213 | * Or just run `./launch.sh flash`. 214 | 215 | If you don't have TaskCluster credentials: 216 | 217 | * You can use the B2G installer add-on to handle this. 218 | * Run `./launch.sh` and select *Enter Firefox b2g-installer Add-on* from the menu. 219 | 220 | 221 | ## Shared Folder 222 | 223 | You can put files/folders into **shared** folder. 224 | 225 | * The **shared** folder will be pushed from host into VM when you run `./launch.sh`. 226 | * The **shared** folder will be pulled from VM to host when you exit the `./launch.sh` script, or when run `./bin/stop.sh`. 227 | 228 | The following table contains a summary of the commands: 229 | 230 | | Command | From | To | 231 | |---------------------|------|------| 232 | | run `./launch.sh` | host | VM | 233 | | exit `./launch.sh` | VM | host | 234 | | run `./bin/stop.sh` | VM | host | 235 | 236 | 237 | # Troubleshooting 238 | * To run `launch.sh` in jenkins or over SSH, use `xvfb-run ./launch.sh`, otherwise the `vagrant up` command will fail. 239 | * To run tests on a device connected via USB device, you need to first add the user to the vboxusers group using the following command structure: 240 | 241 | ```bash 242 | $ sudo adduser vboxusers 243 | ``` 244 | * If you want to run tests against USB-connected devices in Jenkins, also add the *jenkins* user to the *vboxusers* group. 245 | 246 | # Supported Platforms 247 | 248 | The following platforms are supported by MozITP: 249 | 250 | * Linux 251 | * OS X 252 | * Windows (experimental) 253 | * Flashable devices: Aries (Sony Z3C), Flame 254 | 255 | The following table shows the different environments that can be tested/emulated by MozITP, and how well specific tests currently work on those environments: 256 | 257 | | Platform | GIJ | GIP | Fuzz | 258 | |----------------|--------------|-------|---------| 259 | | Phone Mulet | OK (headless)| OK | OK | 260 | | Phone Device | OK | OK | OK | 261 | | Phone Emulator | Too slow | by request* | by request* | 262 | | TV Mulet | OK | by request* | by request* | 263 | | TV Device | by request* | by request* | by request* | 264 | | TV Emulator | by request* | by request* | by request* | 265 | 266 | \* This combination doesn't currently work. If you need it/want to help with getting it running, please file a bug or email us. 267 | 268 | # See Also 269 | 270 | * [MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Automated_testing/MozITP) 271 | * [Wiki](https://wiki.mozilla.org/B2G/MozITP) 272 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Credit: Thanks to Fred Lin's FoxBox project 5 | # 6 | # To use this script and prepare your build environment, run the following 7 | # command in the same directory as the Vagrantfile. 8 | # B2G_PATH={path to your B2G directory} vagrant up 9 | 10 | VAGRANTFILE_API_VERSION = "2" 11 | 12 | # This script will be run on the first start and it will set up the build 13 | # environment. 14 | # All you need to do afterwards is: 15 | # * vagrant ssh 16 | # * Unplug/Plug the phone; run `adb devices` to make sure that the phone is 17 | # listed. 18 | # * cd B2G 19 | # * ./configure.sh {your device} 20 | # * ./build.sh 21 | 22 | # $bootstrap = <