I've got a Moto G4 Play with Android 6.0.1 and despite being rooted xpcshell tests fail to run in the default configuration: DMError: Error pushing file /home/jan/Mozilla/mozilla-central/objdir-droid/dist/bin/xpcshell -> /data/local/xpcb/xpcshell; output: ['[ 22%] /data/local/xpcb/xpcshell', '[ 44%] /data/local/xpcb/xpcshell', '[ 66%] /data/local/xpcb/xpcshell', '[ 89%] /data/local/xpcb/xpcshell', '[100%] /data/local/xpcb/xpcshell', "adb: error: failed to copy '/home/jan/Mozilla/mozilla-central/objdir-droid/dist/bin/xpcshell' to '/data/local/xpcb/xpcshell': Permission denied"] Switching the SELinux mode to "permissive" makes things working again, so maybe the test harness could check the current SELinux mode, set it to "permissive" if necessary and restore the original state again afterwards.
adb_android.py tries to do this, but that's not used for most of our tests. https://dxr.mozilla.org/mozilla-central/rev/7ef1e9abd296a8edc39b7efc8d637767ba2f77ed/testing/mozbase/mozdevice/mozdevice/adb_android.py#89
Changing the SELinux mode isn't persistent so there is no need to restore really. It will be reset after the next boot anyway.
Sure, but from a UX point of view rebooting is more of a hassle than just flipping it back on.